The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Migrate tooltips to Base UI (#26088)
Raphaël Bosid1b696efd0e8
diff --git a/packages/twenty-docs/scripts/generate-ui-reference.ts b/packages/twenty-docs/scripts/generate-ui-reference.tsindex 906048ac034..233cdc419fb 100644--- a/packages/twenty-docs/scripts/generate-ui-reference.ts+++ b/packages/twenty-docs/scripts/generate-ui-reference.ts@@ -6,10 +6,8 @@ import {type TokenDocumentation,} from '../../twenty-ui/docs/types';import { checkUiReferenceImports } from './ui/check-ui-reference-imports';-import {- renderComponentReference,- renderTokenReference,-} from './ui/render-ui-reference';+import { renderComponentReference } from './ui/render-component-reference';+import { renderTokenReference } from './ui/render-ui-reference';import { syncUiReferenceFiles } from './ui/sync-ui-reference-files';const GENERATED_HEADER = `{/*diff --git a/packages/twenty-docs/scripts/ui/__tests__/documentation-defaults.spec.ts b/packages/twenty-docs/scripts/ui/__tests__/documentation-defaults.spec.tsindex a5174315684..f36d7162fc4 100644--- a/packages/twenty-docs/scripts/ui/__tests__/documentation-defaults.spec.ts+++ b/packages/twenty-docs/scripts/ui/__tests__/documentation-defaults.spec.ts@@ -1,7 +1,7 @@import { describe, expect, it } from 'vitest';import { normalizeDocumentationDefaultValue } from '../../../../twenty-ui/docs/normalizeDocumentationDefaultValue';-import { renderComponentReference } from '../render-ui-reference';+import { renderComponentReference } from '../render-component-reference';describe('documentation defaults', () => {it.each([diff --git a/packages/twenty-docs/scripts/ui/__tests__/render-ui-reference.spec.ts b/packages/twenty-docs/scripts/ui/__tests__/render-ui-reference.spec.tsindex 70d028db910..a97856994dd 100644--- a/packages/twenty-docs/scripts/ui/__tests__/render-ui-reference.spec.ts+++ b/packages/twenty-docs/scripts/ui/__tests__/render-ui-reference.spec.ts@@ -1,9 +1,7 @@import { describe, expect, it } from 'vitest';-import {- renderComponentReference,- renderTokenReference,-} from '../render-ui-reference';+import { renderComponentReference } from '../render-component-reference';+import { renderTokenReference } from '../render-ui-reference';describe('renderComponentReference', () => {it('escapes attributes and prose while keeping markdown and code intact', () => {@@ -41,6 +39,44 @@ describe('renderComponentReference', () => {});describe('compound component references', () => {+ it('includes convenience props before compound parts', () => {+ const reference = renderComponentReference({+ name: 'Tooltip',+ entryPoint: 'twenty-ui/primitives/surfaces',+ slug: 'surfaces/tooltip',+ props: [+ {+ name: 'content',+ type: 'ReactNode',+ required: true,+ defaultValue: null,+ description: 'Tooltip content.',+ },+ ],+ parts: [+ {+ name: 'Popup',+ props: [+ {+ name: 'arrow',+ type: 'boolean',+ required: false,+ defaultValue: 'false',+ description: 'Show an arrow.',+ },+ ],+ },+ ],+ });++ expect(reference).toContain('<ParamField body="content"');+ expect(reference).toContain('### Tooltip.Popup');+ expect(reference).toContain('<ParamField body="Popup.arrow"');+ expect(reference.indexOf('body="content"')).toBeLessThan(+ reference.indexOf('### Tooltip.Popup'),+ );+ });+it('distinguishes identically named props on different parts and retains defaults', () => {const reference = renderComponentReference({name: 'Menu',diff --git a/packages/twenty-docs/scripts/ui/render-component-reference.ts b/packages/twenty-docs/scripts/ui/render-component-reference.tsnew file mode 100644index 00000000000..5ab2b360956--- /dev/null+++ b/packages/twenty-docs/scripts/ui/render-component-reference.ts@@ -0,0 +1,72 @@+import { type ComponentDocumentation } from '../../../twenty-ui/docs/types';++const CODE_SEGMENT_PATTERN = /(`{3,})[\s\S]*?\1|`[^`\n]+`/g;++const escapeAttributeValue = (value: string): string =>+ value+ .replace(/&/g, '&')+ .replace(/</g, '<')+ .replace(/>/g, '>')+ .replace(/"/g, '"');++const escapeProseText = (text: string): string =>+ text+ .replace(/&/g, '&')+ .replace(/</g, '<')+ .replace(/\{/g, '{')+ .replace(/\}/g, '}');++const escapeMarkdown = (markdown: string): string => {+ let escaped = '';+ let proseStart = 0;++ for (const codeSegment of markdown.matchAll(CODE_SEGMENT_PATTERN)) {+ escaped +=+ escapeProseText(markdown.slice(proseStart, codeSegment.index)) ++ codeSegment[0];+ proseStart = codeSegment.index + codeSegment[0].length;+ }++ return escaped + escapeProseText(markdown.slice(proseStart));+};++const indent = (text: string): string =>+ text+ .split('\n')+ .map((line) => (line.length > 0 ? ` ${line}` : line))+ .join('\n');++const renderProps = ({+ props,+ partName,+}: {+ props: ComponentDocumentation['props'];+ partName?: string;+}): string =>+ props+ .map((prop) => {+ const attributes = [+ `body="${escapeAttributeValue(partName ? `${partName}.${prop.name}` : prop.name)}"`,+ `type="${escapeAttributeValue(prop.type)}"`,+ ...(prop.required ? ['required'] : []),+ ...(prop.defaultValue === null+ ? []+ : [`default="${escapeAttributeValue(prop.defaultValue)}"`]),+ ];++ return `<ParamField ${attributes.join(' ')}>\n${indent(escapeMarkdown(prop.description))}\n</ParamField>`;+ })+ .join('\n\n') + '\n';++export const renderComponentReference = (+ component: ComponentDocumentation,+): string =>+ [+ ...(component.props.length > 0+ ? [renderProps({ props: component.props })]+ : []),+ ...(component.parts ?? []).map(+ (part) =>+ `### ${component.name}.${part.name}\n\n${renderProps({ props: part.props, partName: part.name })}`,+ ),+ ].join('\n');diff --git a/packages/twenty-docs/scripts/ui/render-ui-reference.ts b/packages/twenty-docs/scripts/ui/render-ui-reference.tsindex e71ea81cb74..235315d591c 100644--- a/packages/twenty-docs/scripts/ui/render-ui-reference.ts+++ b/packages/twenty-docs/scripts/ui/render-ui-reference.ts@@ -1,77 +1,4 @@-import {- type ComponentDocumentation,- type TokenDocumentation,-} from '../../../twenty-ui/docs/types';--const CODE_SEGMENT_PATTERN = /(`{3,})[\s\S]*?\1|`[^`\n]+`/g;--const escapeAttributeValue = (value: string): string =>- value- .replace(/&/g, '&')- .replace(/</g, '<')- .replace(/>/g, '>')- .replace(/"/g, '"');--const escapeProseText = (text: string): string =>- text- .replace(/&/g, '&')- .replace(/</g, '<')- .replace(/\{/g, '{')- .replace(/\}/g, '}');--const escapeMarkdown = (markdown: string): string => {- let escaped = '';- let proseStart = 0;-- for (const codeSegment of markdown.matchAll(CODE_SEGMENT_PATTERN)) {- escaped +=- escapeProseText(markdown.slice(proseStart, codeSegment.index)) +- codeSegment[0];- proseStart = codeSegment.index + codeSegment[0].length;- }-- return escaped + escapeProseText(markdown.slice(proseStart));-};--const indent = (text: string): string =>- text- .split('\n')- .map((line) => (line.length > 0 ? ` ${line}` : line))- .join('\n');--const renderProps = ({- props,- partName,-}: {- props: ComponentDocumentation['props'];- partName?: string;-}): string =>- props- .map((prop) => {- const attributes = [- `body="${escapeAttributeValue(partName ? `${partName}.${prop.name}` : prop.name)}"`,- `type="${escapeAttributeValue(prop.type)}"`,- ...(prop.required ? ['required'] : []),- ...(prop.defaultValue === null- ? []- : [`default="${escapeAttributeValue(prop.defaultValue)}"`]),- ];-- return `<ParamField ${attributes.join(' ')}>\n${indent(escapeMarkdown(prop.description))}\n</ParamField>`;- })- .join('\n\n') + '\n';--export const renderComponentReference = (- component: ComponentDocumentation,-): string =>- component.parts- ? component.parts- .map(- (part) =>- `### ${component.name}.${part.name}\n\n${renderProps({ props: part.props, partName: part.name })}`,- )- .join('\n')- : renderProps({ props: component.props });+import { type TokenDocumentation } from '../../../twenty-ui/docs/types';const escapeTableCell = (value: string): string =>valuediff --git a/packages/twenty-docs/snippets/ui/generated/data-display/chip.mdx b/packages/twenty-docs/snippets/ui/generated/data-display/chip.mdxindex bf55ccf970f..9688b5051ff 100644--- a/packages/twenty-docs/snippets/ui/generated/data-display/chip.mdx+++ b/packages/twenty-docs/snippets/ui/generated/data-display/chip.mdx@@ -78,7 +78,7 @@Tooltip content for a string label. Defaults to the label text.</ParamField>-<ParamField body="tooltipPlace" type=""top" | "left" | "right" | "bottom"">+<ParamField body="tooltipPlace" type=""top" | "right" | "bottom" | "left"">Position of the string-label tooltip.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/input/icon-button.mdx b/packages/twenty-docs/snippets/ui/generated/input/icon-button.mdxindex 5d806538d02..06ac49368dc 100644--- a/packages/twenty-docs/snippets/ui/generated/input/icon-button.mdx+++ b/packages/twenty-docs/snippets/ui/generated/input/icon-button.mdx@@ -15,6 +15,10 @@Required accessible name describing the action.</ParamField>+<ParamField body="children" type="ReactNode" required>+ Icon content. Decorative and hidden from assistive technology.+</ParamField>+<ParamField body="className" type="string | ((state: ButtonState) => string | undefined)">CSS class applied to the element, or a function thatreturns a class based on the component's state.@@ -53,7 +57,7 @@Text displayed when hovering or focusing the button.</ParamField>-<ParamField body="tooltipDelay" type=""0ms" | "300ms" | "500ms" | "1000ms"" default="TooltipDelay.longDelay">+<ParamField body="tooltipDelay" type="number" default="1000">Delay before showing the tooltip.</ParamField>@@ -61,7 +65,7 @@Distance in pixels between the button and the tooltip.</ParamField>-<ParamField body="tooltipPlace" type=""top" | "left" | "right" | "bottom"" default="TooltipPosition.Bottom">+<ParamField body="tooltipPlace" type=""top" | "right" | "bottom" | "left"" default="bottom">Preferred placement of the tooltip relative to the button.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/input/select.mdx b/packages/twenty-docs/snippets/ui/generated/input/select.mdxindex 593ab62a5e1..afcc980d927 100644--- a/packages/twenty-docs/snippets/ui/generated/input/select.mdx+++ b/packages/twenty-docs/snippets/ui/generated/input/select.mdx@@ -238,7 +238,7 @@Accepts a `ReactElement` or a function that returns the element to render.</ParamField>-<ParamField body="Popup.side" type=""top" | "bottom" | "left" | "right" | "inline-end" | "inline-start"" default="bottom">+<ParamField body="Popup.side" type=""top" | "right" | "bottom" | "left" | "inline-end" | "inline-start"" default="bottom">Which side of the anchor element to align the popup against.May automatically change to avoid collisions.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/surfaces/menu.mdx b/packages/twenty-docs/snippets/ui/generated/surfaces/menu.mdxindex 9c912f50a3f..8db53a962dc 100644--- a/packages/twenty-docs/snippets/ui/generated/surfaces/menu.mdx+++ b/packages/twenty-docs/snippets/ui/generated/surfaces/menu.mdx@@ -193,7 +193,7 @@Accepts a `ReactElement` or a function that returns the element to render.</ParamField>-<ParamField body="Popup.side" type=""top" | "bottom" | "left" | "right" | "inline-end" | "inline-start"">+<ParamField body="Popup.side" type=""top" | "right" | "bottom" | "left" | "inline-end" | "inline-start"">Side of the anchor the popup is placed on. Defaults to `bottom` for a menuand `inline-end` for a submenu.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/surfaces/popover.mdx b/packages/twenty-docs/snippets/ui/generated/surfaces/popover.mdxindex 3cf29010d82..844ac0dfadd 100644--- a/packages/twenty-docs/snippets/ui/generated/surfaces/popover.mdx+++ b/packages/twenty-docs/snippets/ui/generated/surfaces/popover.mdx@@ -191,7 +191,7 @@Accepts a `ReactElement` or a function that returns the element to render.</ParamField>-<ParamField body="Popup.side" type=""top" | "bottom" | "left" | "right" | "inline-end" | "inline-start"" default="bottom">+<ParamField body="Popup.side" type=""top" | "right" | "bottom" | "left" | "inline-end" | "inline-start"" default="bottom">Side of the anchor the popup is placed on.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/surfaces/tooltip.mdx b/packages/twenty-docs/snippets/ui/generated/surfaces/tooltip.mdxnew file mode 100644index 00000000000..3275df210cd--- /dev/null+++ b/packages/twenty-docs/snippets/ui/generated/surfaces/tooltip.mdx@@ -0,0 +1,416 @@+{/*+ * _____ _+ *|_ _|_ _____ _ __ | |_ _ _+ * | | \ \ /\ / / _ \ '_ \| __| | | | Auto-generated file+ * | | \ V V / __/ | | | |_| |_| | DO NOT EDIT - changes will be overwritten+ * |_| \_/\_/ \___|_| |_|\__|\__, | Generated by: npx nx generate:ui twenty-docs+ * |___/+ *+ * This file is generated from the documentation data in packages/twenty-ui/generated.+ * To update it, edit the component prop types or design tokens in twenty-ui and run:+ * npx nx generate:ui twenty-docs+ */}++<ParamField body="actionsRef" type="RefObject<TooltipRootActions | null>">+ A ref to imperative actions.+ - `unmount`: Unmounts the tooltip popup.+ - `close`: Closes the tooltip imperatively when called.+</ParamField>++<ParamField body="align" type=""center" | "start" | "end"">+ Alignment relative to the trigger. Defaults to center.+</ParamField>++<ParamField body="alignOffset" type="number | OffsetFunction" default="0">+ Offset along the alignment axis in pixels.+</ParamField>++<ParamField body="anchor" type="Element | VirtualElement | RefObject<Element | null> | (() => Element | VirtualElement | null) | null">+ An explicit positioning anchor for the popup.+</ParamField>++<ParamField body="arrow" type="boolean">+ Displays an arrow pointing to the trigger. Defaults to false.+</ParamField>++<ParamField body="children" type="ReactElement<unknown, string | JSXElementConstructor<any>>" required>+ A single trigger element. Custom components must forward their ref, native attributes, and event handlers.+</ParamField>++<ParamField body="className" type="string | ((state: TooltipPopupState) => string | undefined)">+ Additional CSS class for the popup.+</ParamField>++<ParamField body="closeDelay" type="number" default="0">+ Delay in milliseconds before closing after hover ends. Defaults to 0.+</ParamField>++<ParamField body="closeOnClick" type="boolean" default="true">+ Whether the tooltip should close when this trigger is clicked.+</ParamField>++<ParamField body="collisionAvoidance" type="CollisionAvoidance">+ Determines how to handle collisions when positioning the popup.++ `side` controls overflow on the preferred placement axis (`top`/`bottom` or `left`/`right`):+ - `'flip'`: keep the requested side when it fits; otherwise try the opposite side+ (`top` and `bottom`, or `left` and `right`).+ - `'shift'`: never change side; keep the requested side and move the popup within+ the clipping boundary so it stays visible.+ - `'none'`: do not correct side-axis overflow.++ `align` controls overflow on the alignment axis (`start`/`center`/`end`):+ - `'flip'`: keep side, but swap `start` and `end` when the requested alignment overflows.+ - `'shift'`: keep side and requested alignment, then nudge the popup along the+ alignment axis to fit.+ - `'none'`: do not correct alignment-axis overflow.++ `fallbackAxisSide` controls fallback behavior on the perpendicular axis when the+ preferred axis cannot fit:+ - `'start'`: allow perpendicular fallback and try the logical start side first+ (`top` before `bottom`, or `left` before `right` in LTR).+ - `'end'`: allow perpendicular fallback and try the logical end side first+ (`bottom` before `top`, or `right` before `left` in LTR).+ - `'none'`: do not fallback to the perpendicular axis.++ When `side` is `'shift'`, explicitly setting `align` only supports `'shift'` or `'none'`.+ If `align` is omitted, it defaults to `'flip'`.+</ParamField>++<ParamField body="collisionBoundary" type="Boundary" default="clipping-ancestors">+ An element or a rectangle that delimits the area that the popup is confined to.+</ParamField>++<ParamField body="collisionPadding" type="Padding" default="5">+ Additional space to maintain from the edge of the collision boundary.+</ParamField>++<ParamField body="container" type="HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null">+ Portal destination. Defaults to the current theme container.+</ParamField>++<ParamField body="content" type="ReactNode" required>+ Supplementary content displayed in the tooltip.+</ParamField>++<ParamField body="defaultOpen" type="boolean" default="false">+ Initial visibility when the tooltip manages its own state.+</ParamField>++<ParamField body="defaultTriggerId" type="string | null">+ ID of the trigger that the tooltip is associated with.+ This is useful in conjunction with the `defaultOpen` prop to create an initially open tooltip.+</ParamField>++<ParamField body="delay" type="number" default="600">+ Delay in milliseconds before opening on hover. Defaults to 600.+</ParamField>++<ParamField body="disableAnchorTracking" type="boolean" default="false">+ Whether to disable the popup from tracking any layout shift of its positioning anchor.+</ParamField>++<ParamField body="disabled" type="boolean" default="false">+ Prevents the tooltip from opening.+</ParamField>++<ParamField body="disableHoverablePopup" type="boolean" default="false">+ Prevents hovering over the popup from keeping it open.+</ParamField>++<ParamField body="keepMounted" type="boolean">+ Keeps the popup mounted while closed.+</ParamField>++<ParamField body="maxWidth" type="MaxWidth<string | number>">+ Maximum popup width. Defaults to 300 pixels.+</ParamField>++<ParamField body="onOpenChange" type="((open: boolean, eventDetails: TooltipRootChangeEventDetails) => void)">+ Called when an interaction requests a visibility change.+</ParamField>++<ParamField body="onOpenChangeComplete" type="((open: boolean) => void)">+ Event handler called after any animations complete when the tooltip is opened or closed.+</ParamField>++<ParamField body="open" type="boolean">+ Controlled visibility of the tooltip.+</ParamField>++<ParamField body="positionMethod" type=""absolute" | "fixed"" default="absolute">+ CSS positioning method for the popup.+</ParamField>++<ParamField body="render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipPopupState>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++<ParamField body="side" type=""top" | "right" | "bottom" | "left"">+ Preferred side of the trigger. Defaults to top and may change to avoid collisions.+</ParamField>++<ParamField body="sideOffset" type="number | OffsetFunction" default="10">+ Distance from the trigger in pixels. Defaults to 10.+</ParamField>++<ParamField body="sticky" type="boolean" default="false">+ Whether to maintain the popup in the viewport after+ the anchor element was scrolled out of view.+</ParamField>++<ParamField body="style" type="CSSProperties | ((state: TooltipPopupState) => CSSProperties | undefined)">+ Inline styles for the popup.+</ParamField>++<ParamField body="trackCursorAxis" type=""none" | "both" | "x" | "y"" default="none">+ Determines which axis the tooltip should track the cursor on.+</ParamField>++<ParamField body="triggerId" type="string | null">+ ID of the trigger that the tooltip is associated with.+ This is useful in conjunction with the `open` prop to create a controlled tooltip.+ There's no need to specify this prop when the tooltip is uncontrolled (that is, when the `open` prop is not set).+</ParamField>++### Tooltip.Root++<ParamField body="Root.actionsRef" type="RefObject<TooltipRootActions | null>">+ A ref to imperative actions.+ - `unmount`: Unmounts the tooltip popup.+ - `close`: Closes the tooltip imperatively when called.+</ParamField>++<ParamField body="Root.children" type="ReactNode | PayloadChildRenderFunction<Payload>">+ The content of the tooltip.+ This can be a regular React node or a render function that receives the `payload` of the active trigger.+</ParamField>++<ParamField body="Root.defaultOpen" type="boolean" default="false">+ Whether the tooltip is initially open.++ To render a controlled tooltip, use the `open` prop instead.+</ParamField>++<ParamField body="Root.defaultTriggerId" type="string | null">+ ID of the trigger that the tooltip is associated with.+ This is useful in conjunction with the `defaultOpen` prop to create an initially open tooltip.+</ParamField>++<ParamField body="Root.disabled" type="boolean" default="false">+ Whether the tooltip is disabled.+</ParamField>++<ParamField body="Root.disableHoverablePopup" type="boolean" default="false">+ Whether the tooltip contents can be hovered without closing the tooltip.+</ParamField>++<ParamField body="Root.handle" type="TooltipHandle<Payload>">+ A handle to associate the tooltip with a trigger.+ If specified, allows external triggers to control the tooltip's open state.+ Can be created with the Tooltip.createHandle() method.+</ParamField>++<ParamField body="Root.onOpenChange" type="((open: boolean, eventDetails: TooltipRootChangeEventDetails) => void)">+ Event handler called when the tooltip is opened or closed.+</ParamField>++<ParamField body="Root.onOpenChangeComplete" type="((open: boolean) => void)">+ Event handler called after any animations complete when the tooltip is opened or closed.+</ParamField>++<ParamField body="Root.open" type="boolean">+ Whether the tooltip is currently open.+</ParamField>++<ParamField body="Root.trackCursorAxis" type=""none" | "both" | "x" | "y"" default="none">+ Determines which axis the tooltip should track the cursor on.+</ParamField>++<ParamField body="Root.triggerId" type="string | null">+ ID of the trigger that the tooltip is associated with.+ This is useful in conjunction with the `open` prop to create a controlled tooltip.+ There's no need to specify this prop when the tooltip is uncontrolled (that is, when the `open` prop is not set).+</ParamField>++### Tooltip.Trigger++<ParamField body="Trigger.className" type="string | ((state: TooltipTriggerState) => string | undefined)">+ CSS class applied to the element, or a function that+ returns a class based on the component's state.+</ParamField>++<ParamField body="Trigger.closeDelay" type="number" default="0">+ How long to wait before closing the tooltip. Specified in milliseconds.+</ParamField>++<ParamField body="Trigger.closeOnClick" type="boolean" default="true">+ Whether the tooltip should close when this trigger is clicked.+</ParamField>++<ParamField body="Trigger.delay" type="number" default="600">+ How long to wait before opening the tooltip on hover. Specified in milliseconds.+</ParamField>++<ParamField body="Trigger.disabled" type="boolean" default="false">+ If `true`, the tooltip will not open when interacting with this trigger.+ Note that this doesn't apply the `disabled` attribute to the trigger element.+ If you want to disable the trigger element itself, you can pass the `disabled` prop to the trigger element via the `render` prop.+</ParamField>++<ParamField body="Trigger.handle" type="TooltipHandle<Payload>">+ A handle to associate the trigger with a tooltip.+</ParamField>++<ParamField body="Trigger.payload" type="Payload">+ A payload to pass to the tooltip when it is opened.+</ParamField>++<ParamField body="Trigger.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipTriggerState>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++<ParamField body="Trigger.style" type="CSSProperties | ((state: TooltipTriggerState) => CSSProperties | undefined)">+ Style applied to the element, or a function that+ returns a style object based on the component's state.+</ParamField>++### Tooltip.Popup++<ParamField body="Popup.align" type=""center" | "start" | "end"" default="center">+ Alignment relative to the trigger. Defaults to center.+</ParamField>++<ParamField body="Popup.alignOffset" type="number | OffsetFunction" default="0">+ Offset along the alignment axis in pixels.+</ParamField>++<ParamField body="Popup.anchor" type="Element | VirtualElement | RefObject<Element | null> | (() => Element | VirtualElement | null) | null">+ An explicit positioning anchor for the popup.+</ParamField>++<ParamField body="Popup.arrow" type="boolean" default="false">+ Displays an arrow pointing to the trigger. Defaults to false.+</ParamField>++<ParamField body="Popup.className" type="string | ((state: TooltipPopupState) => string | undefined)">+ Additional CSS class for the popup.+</ParamField>++<ParamField body="Popup.collisionAvoidance" type="CollisionAvoidance">+ Determines how to handle collisions when positioning the popup.++ `side` controls overflow on the preferred placement axis (`top`/`bottom` or `left`/`right`):+ - `'flip'`: keep the requested side when it fits; otherwise try the opposite side+ (`top` and `bottom`, or `left` and `right`).+ - `'shift'`: never change side; keep the requested side and move the popup within+ the clipping boundary so it stays visible.+ - `'none'`: do not correct side-axis overflow.++ `align` controls overflow on the alignment axis (`start`/`center`/`end`):+ - `'flip'`: keep side, but swap `start` and `end` when the requested alignment overflows.+ - `'shift'`: keep side and requested alignment, then nudge the popup along the+ alignment axis to fit.+ - `'none'`: do not correct alignment-axis overflow.++ `fallbackAxisSide` controls fallback behavior on the perpendicular axis when the+ preferred axis cannot fit:+ - `'start'`: allow perpendicular fallback and try the logical start side first+ (`top` before `bottom`, or `left` before `right` in LTR).+ - `'end'`: allow perpendicular fallback and try the logical end side first+ (`bottom` before `top`, or `right` before `left` in LTR).+ - `'none'`: do not fallback to the perpendicular axis.++ When `side` is `'shift'`, explicitly setting `align` only supports `'shift'` or `'none'`.+ If `align` is omitted, it defaults to `'flip'`.+</ParamField>++<ParamField body="Popup.collisionBoundary" type="Boundary" default="clipping-ancestors">+ An element or a rectangle that delimits the area that the popup is confined to.+</ParamField>++<ParamField body="Popup.collisionPadding" type="Padding" default="5">+ Additional space to maintain from the edge of the collision boundary.+</ParamField>++<ParamField body="Popup.container" type="HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null">+ Portal destination. Defaults to the current theme container.+</ParamField>++<ParamField body="Popup.disableAnchorTracking" type="boolean" default="false">+ Whether to disable the popup from tracking any layout shift of its positioning anchor.+</ParamField>++<ParamField body="Popup.keepMounted" type="boolean">+ Keeps the popup mounted while closed.+</ParamField>++<ParamField body="Popup.maxWidth" type="MaxWidth<string | number>" default="300px">+ Maximum popup width. Defaults to 300 pixels.+</ParamField>++<ParamField body="Popup.positionMethod" type=""absolute" | "fixed"" default="absolute">+ CSS positioning method for the popup.+</ParamField>++<ParamField body="Popup.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipPopupState>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++<ParamField body="Popup.side" type=""top" | "right" | "bottom" | "left"" default="top">+ Preferred side of the trigger. Defaults to top and may change to avoid collisions.+</ParamField>++<ParamField body="Popup.sideOffset" type="number | OffsetFunction" default="10">+ Distance from the trigger in pixels. Defaults to 10.+</ParamField>++<ParamField body="Popup.sticky" type="boolean" default="false">+ Whether to maintain the popup in the viewport after+ the anchor element was scrolled out of view.+</ParamField>++<ParamField body="Popup.style" type="CSSProperties | ((state: TooltipPopupState) => CSSProperties | undefined)">+ Inline styles for the popup.+</ParamField>++### Tooltip.Content++<ParamField body="Content.description" type="ReactNode">+ Secondary explanation beneath the primary text.+</ParamField>++<ParamField body="Content.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++<ParamField body="Content.startIcon" type="ReactNode">+ An icon displayed before the text.+</ParamField>++### Tooltip.Provider++<ParamField body="Provider.closeDelay" type="number">+ How long to wait before closing a tooltip. Specified in milliseconds.+</ParamField>++<ParamField body="Provider.delay" type="number">+ How long to wait before opening the tooltip on hover. Specified in milliseconds.+</ParamField>++<ParamField body="Provider.timeout" type="number" default="400">+ Another tooltip will open instantly if the previous tooltip+ is closed within this timeout. Specified in milliseconds.+</ParamField>diff --git a/packages/twenty-docs/ui/primitives/overview.mdx b/packages/twenty-docs/ui/primitives/overview.mdxindex 2d62e2da4c4..9ea03ba2d87 100644--- a/packages/twenty-docs/ui/primitives/overview.mdx+++ b/packages/twenty-docs/ui/primitives/overview.mdx@@ -91,6 +91,6 @@ Each page includes usage examples, interaction guidance, and a generated API ref| Data display | [Avatar](/ui/primitives/data-display/avatar), [Chip](/ui/primitives/data-display/chip), [Tag](/ui/primitives/data-display/tag), [Status](/ui/primitives/data-display/status) || Forms | [Button](/ui/primitives/input/button), [ButtonGroup](/ui/primitives/input/button-group), [Field](/ui/primitives/input/field), [Input](/ui/primitives/input/input), [InputGroup](/ui/primitives/input/input-group), [Textarea](/ui/primitives/input/textarea), [Checkbox](/ui/primitives/input/checkbox), [Radio](/ui/primitives/input/radio), [RadioGroup](/ui/primitives/input/radio-group), [Select](/ui/primitives/input/select), [Slider](/ui/primitives/input/slider), [Switch](/ui/primitives/input/switch) || Navigation | [ListItem](/ui/primitives/navigation/list-item), [Tabs](/ui/primitives/navigation/tabs) |-| Surfaces | [AlertDialog](/ui/primitives/surfaces/alert-dialog), [Menu](/ui/primitives/surfaces/menu), [Popover](/ui/primitives/surfaces/popover) |+| Surfaces | [AlertDialog](/ui/primitives/surfaces/alert-dialog), [Menu](/ui/primitives/surfaces/menu), [Popover](/ui/primitives/surfaces/popover), [Tooltip](/ui/primitives/surfaces/tooltip) || Feedback | [Toast](/ui/primitives/feedback/toast) || Typography | [Text](/ui/primitives/typography/text) |diff --git a/packages/twenty-docs/ui/primitives/surfaces/tooltip.mdx b/packages/twenty-docs/ui/primitives/surfaces/tooltip.mdxnew file mode 100644index 00000000000..683768354bc--- /dev/null+++ b/packages/twenty-docs/ui/primitives/surfaces/tooltip.mdx@@ -0,0 +1,125 @@+---+title: Tooltip+description: Show supplementary information when a trigger is hovered or focused.+---++import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';++import TooltipReference from '/snippets/ui/generated/surfaces/tooltip.mdx';++Use `Tooltip` for a short explanation of a control or truncated text. Keep essential information visible, give controls an accessible name, and use [Popover](/ui/primitives/surfaces/popover) when the content contains links, buttons, or other controls.++<StoryEmbed storyId="ui-surfaces-tooltip--default" title="Tooltip example" />++## Single trigger++```tsx+import { Button } from 'twenty-ui/primitives/input';+import { Tooltip } from 'twenty-ui/primitives/surfaces';++export const ExportHelp = () => (+ <Tooltip content="Download the visible records as a CSV file" side="top">+ <span>+ <Button>Export records</Button>+ </span>+ </Tooltip>+);+```++The convenience component accepts one trigger element as `children`. Native elements receive the trigger attributes, event handlers, and ref directly. Custom trigger components must forward all of them. A wrapper element also works with a component that does not forward every trigger prop.++Hover opens the tooltip after `delay` milliseconds, which defaults to `600`. Keyboard focus opens it immediately. `closeDelay` defaults to `0`; hovering over the popup keeps it open unless `disableHoverablePopup` is set. Escape dismisses it.++## Controlled state++Use `open` and `onOpenChange` together when the application owns visibility. Use `defaultOpen` only to set the initial visibility of an uncontrolled tooltip.++```tsx+import { useState } from 'react';+import { Button } from 'twenty-ui/primitives/input';+import { Tooltip } from 'twenty-ui/primitives/surfaces';++export const ControlledExportHelp = () => {+ const [open, setOpen] = useState(false);++ return (+ <Tooltip+ content="Download the visible records as a CSV file"+ open={open}+ onOpenChange={setOpen}+ delay={300}+ >+ <span>+ <Button>Export records</Button>+ </span>+ </Tooltip>+ );+};+```++## Rich content and composition++`Tooltip.Content` provides a title, optional description, and optional leading icon. Use it as `content` or inside `Tooltip.Popup`.++```tsx+import { IconInfoCircle } from 'twenty-ui/icon';+import { Button } from 'twenty-ui/primitives/input';+import { Tooltip } from 'twenty-ui/primitives/surfaces';++export const ExportDetails = () => (+ <Tooltip.Root>+ <Tooltip.Trigger render={<span />}>+ <Button>Export records</Button>+ </Tooltip.Trigger>+ <Tooltip.Popup side="right" align="start" arrow>+ <Tooltip.Content+ startIcon={<IconInfoCircle />}+ description="Only the records matching your current filters are included."+ >+ Export visible records+ </Tooltip.Content>+ </Tooltip.Popup>+ </Tooltip.Root>+);+```++| Part | Purpose |+| ---------- | ------------------------------------------------------------- |+| `Root` | Coordinates visibility and trigger interactions. |+| `Trigger` | Renders the element that opens the tooltip on hover or focus. |+| `Popup` | Renders positioned content in a portal. |+| `Content` | Styles primary text, a description, and an icon. |+| `Provider` | Coordinates opening delays across a group of tooltips. |++`Tooltip.createHandle()` connects detached triggers to a shared `Root` through their `handle` prop. Keep each popup's content supplementary even when several triggers share it.++## Disabled controls++Native disabled buttons cannot receive keyboard focus. Wrap one in a focusable trigger so users can discover why the action is unavailable.++```tsx+import { Button } from 'twenty-ui/primitives/input';+import { Tooltip } from 'twenty-ui/primitives/surfaces';++export const UnavailableExport = () => (+ <Tooltip content="Select at least one record to export">+ <span tabIndex={0} aria-label="Export records unavailable">+ <Button disabled>Export records</Button>+ </span>+ </Tooltip>+);+```++Setting `disabled` on `Tooltip` suppresses the tooltip itself. It does not disable the control.++## Placement and overflowing text++The popup defaults to `side="top"`, `align="center"`, `sideOffset={10}`, and a maximum width of `300` pixels. Placement adjusts to available space. Use `arrow` for an arrow and `container` to override the theme's portal destination; see [theming](/ui/theming).++Use `OverflowingTextWithTooltip` when a text label should show its full value only when truncated. Its existing `text`, `tooltipContent`, and `tooltipPlace` props remain available.++## Props++The reference is generated from the public component types. Native popup attributes and event handlers are also accepted.++<TooltipReference />diff --git a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsxindex f454f4000ff..65a32da305e 100644--- a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx@@ -44,6 +44,7 @@ import {tabsReactTest,} from '@/__stories__/twenty-ui-gallery/utils/sandboxFailureTests';import { FrontComponentRenderer } from '@/host/components/FrontComponentRenderer';+import { createTooltipSandboxFailureTest } from '@/__stories__/twenty-ui-gallery/utils/createTooltipSandboxFailureTest';const meta: Meta<typeof FrontComponentRenderer> = {title: 'FrontComponent/Twenty UI Gallery',@@ -252,6 +253,18 @@ export const PopoverPreact: Story = createGalleryStory({play: popoverTest,});+export const TooltipReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-tooltip',+ runtime: 'react',+ play: createTooltipSandboxFailureTest('react'),+});++export const TooltipPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-tooltip',+ runtime: 'preact',+ play: createTooltipSandboxFailureTest('preact'),+});+export const MenuReact: Story = createGalleryStory({frontComponentBundleName: 'twenty-ui-menu',runtime: 'react',diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.mdindex a52977b7f8b..e99a6a051ac 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md@@ -24,6 +24,7 @@ error and can allow additional known errors without requiring them to occur.| `twenty-ui-toast` | Toast || `twenty-ui-alert-dialog` | AlertDialog || `twenty-ui-switch` | Switch (interaction coverage in addition to the original input gallery) |+| `twenty-ui-tooltip` | Tooltip (convenience and compound APIs) |The focused fixtures import public twenty-ui entry points and use`TwentyUiGalleryCard` for the light theme, mount marker, and `twenty-ui/style.css`.@@ -34,8 +35,8 @@ shared card also exercises the SDK's CSS injection and the renderer's style brid## Known sandbox limitationsThese are compatibility regression stories, not assertions that the components-work fully in the sandbox. The failing scenarios require specific errors and-reject unrelated errors, following the existing gallery convention. Known+work fully in the sandbox. Scenarios that raise errors require specific errors and+reject unrelated ones, following the existing gallery convention. Knownprecursor errors are optional because the host can coalesce worker errors intoa single state update. A fix must change the corresponding story to assertsuccessful behavior; do not keep or broaden an obsolete error expectation.@@ -48,6 +49,18 @@ No stories are skipped or marked as expected-to-fail by the runner.| Popover, AlertDialog | Opening fails while reading unavailable viewport width data. || Menu, Select | Opening fails on viewport data and/or missing `nativeEvent.pointerType`. || Switch | Activation attempts to construct an unavailable `PointerEvent`. |+| Tooltip | `TooltipReact` opens on hover but remains open after Escape because the SDK does not forward handlers added by `React.cloneElement`. `TooltipPreact` throws on hover because the sandbox lacks `Element.closest`. |++The tooltip stories assert these known failures and must be updated to assert+successful interactions when compatibility is fixed. The surfaces gallery checks+that the migrated tooltip mounts in both runtimes. Full tooltip interaction+coverage remains in twenty-ui's own stories.++SDK event handling and sandbox DOM fixes are deferred from the tooltip migration.+Further gaps found while investigating include forwarded events without+`nativeEvent` and a `Node.contains` ancestor traversal bug that can hang pointer+leave handling. After fixing those gaps, cover Escape dismissal, pointer leave,+and the compound tooltip's title and description in both renderer runtimes.Once those gaps are fixed, extend the stories to verify selection, disableditems, keyboard navigation, and overlay content, dismissal, and focus restoration.diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/constants/SANDBOX_ERROR_PATTERNS.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/constants/SANDBOX_ERROR_PATTERNS.tsindex e65a8569331..981b9f7632a 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/constants/SANDBOX_ERROR_PATTERNS.ts+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/constants/SANDBOX_ERROR_PATTERNS.ts@@ -8,6 +8,7 @@ export const SANDBOX_ERROR_PATTERNS = {POINTER_TYPE:"Uncaught TypeError: Cannot read properties of undefined (reading 'pointerType')",ELEMENT_MATCHES: /^(?:Uncaught TypeError: )?\w+\.matches is not a function$/,+ ELEMENT_CLOSEST: /^(?:Uncaught TypeError: )?\w+\.closest is not a function$/,POINTER_EVENT_CONSTRUCTOR:/^Uncaught TypeError: .+\.PointerEvent is not a constructor$/,};diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-surfaces-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-surfaces-gallery.front-component.tsxindex e1158a61b1e..35be3a495fe 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-surfaces-gallery.front-component.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-surfaces-gallery.front-component.tsx@@ -1,6 +1,6 @@import { defineFrontComponent } from 'twenty-sdk/define';+import { Button } from 'twenty-ui/primitives/input';import {- AppTooltip,Card,CardContent,CardFooter,@@ -11,6 +11,7 @@ import {ModalFooter,ModalHeader,OverflowingTextWithTooltip,+ Tooltip,} from 'twenty-ui/primitives/surfaces';import { ThemeProvider } from 'twenty-ui/theme-constants';@@ -21,16 +22,13 @@ import {const SURFACES_ENTRIES: GalleryEntry[] = [{- name: 'AppTooltip',+ name: 'Tooltip',node: (- <>- <span id="gallery-tooltip-anchor">Tooltip anchor</span>- <AppTooltip- anchorSelect="#gallery-tooltip-anchor"- title="Tooltip content"- isOpen={true}- />- </>+ <Tooltip content="Tooltip content">+ <span>+ <Button>Tooltip anchor</Button>+ </span>+ </Tooltip>),},{@@ -86,7 +84,7 @@ const SURFACES_ENTRIES: GalleryEntry[] = [];const SurfacesGallery = () => (- <ThemeProvider colorScheme="light">+ <ThemeProvider colorScheme="light" applyToRoot={false}><ComponentGallerytitle="twenty-ui/primitives/surfaces"entries={SURFACES_ENTRIES}diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-tooltip.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-tooltip.front-component.tsxnew file mode 100644index 00000000000..426f3df96e3--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-tooltip.front-component.tsx@@ -0,0 +1,53 @@+import { useEffect, useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { Button } from 'twenty-ui/primitives/input';+import { Tooltip } from 'twenty-ui/primitives/surfaces';+import { ThemeProvider } from 'twenty-ui/theme-constants';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const TooltipExample = () => {+ const [open, setOpen] = useState(false);+ const [ready, setReady] = useState(false);++ useEffect(() => {+ setReady(true);+ }, []);++ return (+ <ThemeProvider colorScheme="light" applyToRoot={false}>+ <TwentyUiGalleryCard title="Tooltip">+ <Tooltip+ content="Download visible records as a CSV file"+ open={open}+ onOpenChange={setOpen}+ delay={0}+ >+ <span>+ <Button>Export records</Button>+ </span>+ </Tooltip>+ <Tooltip.Root>+ <Tooltip.Trigger render={<span />} delay={0}>+ <Button>Export details</Button>+ </Tooltip.Trigger>+ <Tooltip.Popup arrow>+ <Tooltip.Content description="Your current filters are applied.">+ Export visible records+ </Tooltip.Content>+ </Tooltip.Popup>+ </Tooltip.Root>+ <p role="status" aria-busy={!ready}>+ Export help: {open ? 'open' : 'closed'}+ </p>+ </TwentyUiGalleryCard>+ </ThemeProvider>+ );+};++export default defineFrontComponent({+ universalIdentifier: '535b0395-1e6c-435d-b2ae-94203be51c42',+ name: 'twenty-ui-tooltip',+ description: 'Tooltip hover, composed content and dismissal in the sandbox',+ component: TooltipExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createTooltipSandboxFailureTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createTooltipSandboxFailureTest.tsnew file mode 100644index 00000000000..80569e5f71e--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createTooltipSandboxFailureTest.ts@@ -0,0 +1,56 @@+import { expect, userEvent, waitFor, within } from 'storybook/test';++import { errorHandler } from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';+import { expectFrontComponentMounted } from '@/__stories__/shared/test-utils/matchers/expectFrontComponentMounted';+import { INTERACTION_TIMEOUT } from '@/__stories__/shared/test-utils/timeouts';+import { SANDBOX_ERROR_PATTERNS } from '@/__stories__/twenty-ui-gallery/constants/SANDBOX_ERROR_PATTERNS';+import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';+import { expectSandboxErrors } from '@/__stories__/twenty-ui-gallery/utils/expectSandboxErrors';++export const createTooltipSandboxFailureTest =+ (runtime: 'react' | 'preact'): TwentyUiGalleryPlayFunction =>+ async ({ canvasElement }) => {+ const user = userEvent.setup();+ const canvas = within(canvasElement);+ const page = within(canvasElement.ownerDocument.body);+ await expectFrontComponentMounted(canvas);+ await waitFor(() => {+ expect(canvas.getByRole('status')).toHaveAttribute('aria-busy', 'false');+ });++ const exportButton = canvas.getByRole('button', { name: 'Export records' });+ await user.hover(exportButton);++ if (runtime === 'preact') {+ await expectSandboxErrors({+ requiredErrors: [SANDBOX_ERROR_PATTERNS.ELEMENT_CLOSEST],+ });+ return;+ }++ await waitFor(() => {+ expect(errorHandler).not.toHaveBeenCalled();+ expect(canvas.getByRole('status')).toHaveTextContent('Export help: open');+ expect(+ page.getByText('Download visible records as a CSV file'),+ ).toBeVisible();+ });++ await user.tab();+ expect(exportButton).toHaveFocus();+ await user.keyboard('{Escape}');+ await expect(+ waitFor(+ () =>+ expect(canvas.getByRole('status')).toHaveTextContent(+ 'Export help: closed',+ ),+ { timeout: INTERACTION_TIMEOUT },+ ),+ ).rejects.toThrow();+ expect(errorHandler).not.toHaveBeenCalled();+ expect(canvas.getByRole('status')).toHaveTextContent('Export help: open');+ expect(+ page.getByText('Download visible records as a CSV file'),+ ).toBeVisible();+ };diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventCallRecorderAvatar.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventCallRecorderAvatar.tsxindex 17a13352e5a..9eeb4d32d22 100644--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventCallRecorderAvatar.tsx+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventCallRecorderAvatar.tsx@@ -1,14 +1,10 @@import { AppChip } from '@/applications/components/AppChip';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { useId } from 'react';-import { createPortal } from 'react-dom';import { assertUnreachable } from 'twenty-shared/utils';-import {- AppTooltip,- TooltipDelay,- TooltipPosition,-} from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { CallRecordingStatus } from '~/generated/graphql';const IN_PROGRESS_CALL_RECORDING_STATUSES: CallRecordingStatus[] = [@@ -62,7 +58,12 @@ export const CalendarEventCallRecorderAvatar = ({const tooltipAnchorId = `call-recorder-${instanceId.replace(/[^a-zA-Z0-9-_]/g, '-')}`;return (- <>+ <Tooltip+ content={getCallRecordingStatusLabel(status)}+ delay={TooltipDelay.shortDelay}+ side="top"+ positionMethod="fixed"+ ><StyledContainer id={tooltipAnchorId} isDisabled={hasNoRecording}><AppChipapplicationId={applicationId}@@ -73,16 +74,6 @@ export const CalendarEventCallRecorderAvatar = ({chipOnly/></StyledContainer>- {createPortal(- <AppTooltip- anchorSelect={`#${tooltipAnchorId}`}- title={getCallRecordingStatusLabel(status)}- delay={TooltipDelay.shortDelay}- place={TooltipPosition.Top}- positionStrategy="fixed"- />,- document.body,- )}- </>+ </Tooltip>);};diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageSender.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageSender.tsxindex 7773c732e67..ba9f00fffc7 100644--- a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageSender.tsx+++ b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageSender.tsx@@ -2,8 +2,9 @@ import { styled } from '@linaria/react';import { ParticipantChip } from '@/activities/components/ParticipantChip';import { type EmailThreadMessageParticipant } from '@/activities/emails/types/EmailThreadMessageParticipant';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { AppTooltip, TooltipPosition } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';import { dateLocaleState } from '~/localization/states/dateLocaleState';import {@@ -40,16 +41,15 @@ export const EmailThreadMessageSender = ({const tooltipId = `date-tooltip-${sentAt.replace(/[^a-zA-Z0-9]/g, '-')}`;sentAtContent = (- <>+ <Tooltip+ delay={TooltipDelay.mediumDelay}+ content={formatToHumanReadableDate(sentAt)}+ side="top"+ ><StyledThreadMessageSentAt id={tooltipId}>{beautifyPastDateRelativeToNow(sentAt, localeCatalog)}</StyledThreadMessageSentAt>- <AppTooltip- anchorSelect={`#${tooltipId}`}- title={formatToHumanReadableDate(sentAt)}- place={TooltipPosition.Top}- />- </>+ </Tooltip>);}diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadNotShared.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadNotShared.tsxindex a06ce7db4de..e75c4c70ce4 100644--- a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadNotShared.tsx+++ b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadNotShared.tsx@@ -1,8 +1,9 @@+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { useContext } from 'react';import { IconLock } from 'twenty-ui/icon';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { MessageChannelVisibility } from '~/generated/graphql';@@ -40,21 +41,17 @@ export const EmailThreadNotShared = ({const isCompact = visibility === MessageChannelVisibility.SUBJECT;return (- <>+ <Tooltip+ content={t`Only the subject is shared`}+ delay={TooltipDelay.mediumDelay}+ side="bottom"+ positionMethod="fixed"+ disabled={!(visibility === MessageChannelVisibility.SUBJECT)}+ ><StyledContainer id={containerId} isCompact={isCompact}><IconLock size={theme.icon.size.sm} />{t`Not shared`}</StyledContainer>- {visibility === MessageChannelVisibility.SUBJECT && (- <AppTooltip- anchorSelect={`#${containerId}`}- title={t`Only the subject is shared`}- delay={TooltipDelay.mediumDelay}- noArrow- place="bottom"- positionStrategy="fixed"- />- )}- </>+ </Tooltip>);};diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/rows/components/EventRowDate.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/rows/components/EventRowDate.tsxindex 0b88a744f3d..dba6c09f7b4 100644--- a/packages/twenty-front/src/modules/activities/timeline-activities/rows/components/EventRowDate.tsx+++ b/packages/twenty-front/src/modules/activities/timeline-activities/rows/components/EventRowDate.tsx@@ -3,8 +3,9 @@ import { isNonEmptyString } from '@sniptt/guards';import { useId } from 'react';import { useDateTimeFormat } from '@/localization/hooks/useDateTimeFormat';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';import { dateLocaleState } from '~/localization/states/dateLocaleState';import { beautifyPastDateRelativeToNow } from '~/utils/date-utils';@@ -47,17 +48,14 @@ export const EventRowDate = ({ happensAt }: EventRowDateProps) => {});return (- <>+ <Tooltip+ content={exactHappensAt}+ delay={TooltipDelay.mediumDelay}+ side="left"+ ><StyledEventRowDate id={dateElementId} tabIndex={0}>{relativeHappensAt}</StyledEventRowDate>- <AppTooltip- anchorSelect={`#${dateElementId}`}- title={exactHappensAt}- delay={TooltipDelay.mediumDelay}- noArrow- place="left"- />- </>+ </Tooltip>);};diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/EventRelationFieldDiffValues.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/EventRelationFieldDiffValues.tsxindex 1c0f412533c..d14c4b3e36d 100644--- a/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/EventRelationFieldDiffValues.tsx+++ b/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/EventRelationFieldDiffValues.tsx@@ -1,18 +1,15 @@import { styled } from '@linaria/react';-import { useId, useMemo } from 'react';+import { useMemo } from 'react';import { isRelationFieldChangeValue } from '@/activities/timeline-activities/utils/relationFieldChangeValue';import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';import { getObjectRecordIdentifier } from '@/object-metadata/utils/getObjectRecordIdentifier';import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { Trans, useLingui } from '@lingui/react/macro';import { isDefined } from 'twenty-shared/utils';-import {- AppTooltip,- TooltipDelay,- TooltipPosition,-} from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';type EventRelationFieldDiffValuesProps = {@@ -130,38 +127,26 @@ const RelationFieldDiffValue = ({afterDisplayName: string | null;}) => {const { t } = useLingui();- const instanceId = useId();-- // react-tooltip anchors via a CSS selector, so the id must be selector-safe- const tooltipAnchorId = `relation-field-diff-${instanceId.replace(- /[^a-zA-Z0-9-_]/g,- '-',- )}`;-const emptyLabel = t`Empty`;const tooltipContent = `${beforeDisplayName ?? emptyLabel} → ${afterDisplayName ?? emptyLabel}`;return (- <>+ <Tooltip+ content={tooltipContent}+ delay={TooltipDelay.shortDelay}+ side="bottom"+ positionMethod="fixed"+ >{afterDisplayName !== null ? (- <StyledRelationValue id={tooltipAnchorId}>- {afterDisplayName}- </StyledRelationValue>+ <StyledRelationValue>{afterDisplayName}</StyledRelationValue>) : (- <StyledEmptyValue id={tooltipAnchorId}>+ <StyledEmptyValue><Trans>Empty</Trans></StyledEmptyValue>)}- <AppTooltip- anchorSelect={`#${tooltipAnchorId}`}- title={tooltipContent}- delay={TooltipDelay.shortDelay}- place={TooltipPosition.Bottom}- positionStrategy="fixed"- />- </>+ </Tooltip>);};diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/__tests__/EventRelationFieldDiffValues.test.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/__tests__/EventRelationFieldDiffValues.test.tsxindex 512b619dc1b..4851114af2b 100644--- a/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/__tests__/EventRelationFieldDiffValues.test.tsx+++ b/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/__tests__/EventRelationFieldDiffValues.test.tsx@@ -1,6 +1,7 @@import { i18n } from '@lingui/core';import { I18nProvider } from '@lingui/react';-import { fireEvent, render, screen } from '@testing-library/react';+import { render, screen } from '@testing-library/react';+import userEvent from '@testing-library/user-event';import { type ReactNode } from 'react';import { FieldMetadataType } from 'twenty-shared/types';@@ -142,7 +143,7 @@ describe('EventRelationFieldDiffValues', () => {/>,);- fireEvent.mouseEnter(screen.getByText('Empty'));+ await userEvent.hover(screen.getByText('Empty'));expect(await screen.findByText('Tim A → Empty')).toBeInTheDocument();});@@ -155,7 +156,7 @@ describe('EventRelationFieldDiffValues', () => {/>,);- fireEvent.mouseEnter(screen.getByText('Tim Apple'));+ await userEvent.hover(screen.getByText('Tim Apple'));expect(await screen.findByText('Empty → Tim Apple')).toBeInTheDocument();});@@ -168,7 +169,7 @@ describe('EventRelationFieldDiffValues', () => {/>,);- fireEvent.mouseEnter(screen.getByText('Tim Apple'));+ await userEvent.hover(screen.getByText('Tim Apple'));expect(await screen.findByText('Tim A → Tim Apple')).toBeInTheDocument();});diff --git a/packages/twenty-front/src/modules/ai/components/AiChatQuestionCard.tsx b/packages/twenty-front/src/modules/ai/components/AiChatQuestionCard.tsxindex 2a038e896c5..1b2ba2953c0 100644--- a/packages/twenty-front/src/modules/ai/components/AiChatQuestionCard.tsx+++ b/packages/twenty-front/src/modules/ai/components/AiChatQuestionCard.tsx@@ -3,7 +3,7 @@ import { useLingui } from '@lingui/react/macro';import { type KeyboardEvent, useContext, useMemo, useState } from 'react';import { type AskQuestionAnswer, type AskQuestionItem } from 'twenty-shared/ai';import { isDefined } from 'twenty-shared/utils';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import {IconArrowUp,IconChevronLeft,@@ -31,6 +31,7 @@ import { AiModelTierDropdown } from '@/ai/components/AiModelTierDropdown';import { useSubmitQuestionAnswer } from '@/ai/hooks/useSubmitQuestionAnswer';import { type AgentChatPendingQuestion } from '@/ai/types/AgentChatPendingQuestion';import { aiModelsState } from '@/client-config/states/aiModelsState';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';const NUMBER_ICONS: IconComponent[] = [@@ -454,7 +455,11 @@ export const AiChatQuestionCard = ({)}</StyledOptionLeft>{isDefined(option.description) && (- <>+ <Tooltip+ content={option.description}+ delay={TooltipDelay.shortDelay}+ side="left"+ ><spanid={tooltipId}onClick={(event) => event.stopPropagation()}@@ -465,13 +470,7 @@ export const AiChatQuestionCard = ({accent="tertiary"/></span>- <AppTooltip- anchorSelect={`#${tooltipId}`}- title={option.description}- delay={TooltipDelay.shortDelay}- place="left"- />- </>+ </Tooltip>)}</StyledOptionRow>);diff --git a/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx b/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsxindex 865298a39d0..c22ec2da801 100644--- a/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx+++ b/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx@@ -4,10 +4,7 @@ import { useState } from 'react';import { type DynamicToolUIPart, getToolName, type ToolUIPart } from 'ai';import { isDefined } from 'twenty-shared/utils';import { IconChevronRight, IconCpu } from 'twenty-ui/icon';-import {- OverflowingTextWithTooltip,- TooltipDelay,-} from 'twenty-ui/primitives/surfaces';+import { OverflowingTextWithTooltip } from 'twenty-ui/primitives/surfaces';import { JsonTree } from 'twenty-ui/primitives/json-visualizer';import { AnimatedExpandableContainer } from 'twenty-ui/primitives/layout';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -25,6 +22,7 @@ import { isThinkingStepPartActive } from '@/ai/utils/isThinkingStepPartActive';import { type ThinkingStepPart } from '@/ai/utils/thinkingStepPart';import { TabList } from '@/ui/layout/tab-list/components/TabList';import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuButton.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuButton.tsxindex da810eac722..298037da3e3 100644--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuButton.tsx+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuButton.tsx@@ -1,15 +1,12 @@import { NavigationButton } from '@/ui/input/components/NavigationButton';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';-import { type MouseEvent, useId } from 'react';+import { type MouseEvent } from 'react';import { Link } from 'react-router-dom';import { type Nullable } from 'twenty-shared/types';import { isDefined, isNonEmptyArray } from 'twenty-shared/utils';import { type IconComponent } from 'twenty-ui/icon';-import {- AppTooltip,- TooltipDelay,- TooltipPosition,-} from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { IconButton } from 'twenty-ui/components';export type CommandMenuButtonProps = {@@ -36,7 +33,6 @@ export const CommandMenuButton = ({isPrimaryAction = false,shouldHideLabel = false,}: CommandMenuButtonProps) => {- const tooltipId = useId();const { hotKeys } = command;const hasHotKeys = isNonEmptyArray(hotKeys);const tooltipTitle = hasHotKeys@@ -52,50 +48,42 @@ export const CommandMenuButton = ({isPrimaryAction || command.isPrimaryCTA === true ? 'blue' : 'default';return (- <div data-tooltip-id={tooltipId}>- {resolvedShortLabel !== undefined ? (- <NavigationButton- id={tooltipId}- startIcon={isDefined(command.Icon) ? <command.Icon /> : undefined}- size="sm"- to={to}- onClick={onClick}- disabled={disabled}- aria-label={command.label}- variant={buttonAccent === 'blue' ? 'solid' : 'outline'}- color={buttonAccent === 'blue' ? 'accent' : 'neutral'}- >- {resolvedShortLabel}- </NavigationButton>- ) : (- <IconButton- id={tooltipId}- size="sm"- variant={buttonAccent === 'blue' ? 'solid' : 'outline'}- color={buttonAccent === 'blue' ? 'accent' : 'neutral'}- render={isDefined(to) ? <Link to={to} /> : undefined}- href={to}- onClick={onClick}- disabled={disabled}- aria-label={command.label}- >- <command.Icon />- </IconButton>- )}- {(hasHotKeys || !isDefined(resolvedShortLabel)) && (- <AppTooltip- anchorSelect={- disabled- ? `[data-tooltip-id='${tooltipId}']`- : `[id='${tooltipId}']`- }- title={tooltipTitle}- delay={TooltipDelay.longDelay}- place={TooltipPosition.Bottom}- offset={5}- noArrow- />- )}- </div>+ <Tooltip+ content={tooltipTitle}+ delay={TooltipDelay.longDelay}+ side="bottom"+ sideOffset={5}+ disabled={!hasHotKeys && isDefined(resolvedShortLabel)}+ >+ <div>+ {resolvedShortLabel !== undefined ? (+ <NavigationButton+ startIcon={isDefined(command.Icon) ? <command.Icon /> : undefined}+ size="sm"+ to={to}+ onClick={onClick}+ disabled={disabled}+ aria-label={command.label}+ variant={buttonAccent === 'blue' ? 'solid' : 'outline'}+ color={buttonAccent === 'blue' ? 'accent' : 'neutral'}+ >+ {resolvedShortLabel}+ </NavigationButton>+ ) : (+ <IconButton+ size="sm"+ variant={buttonAccent === 'blue' ? 'solid' : 'outline'}+ color={buttonAccent === 'blue' ? 'accent' : 'neutral'}+ render={isDefined(to) ? <Link to={to} /> : undefined}+ href={to}+ onClick={onClick}+ disabled={disabled}+ aria-label={command.label}+ >+ <command.Icon />+ </IconButton>+ )}+ </div>+ </Tooltip>);};diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/components/NavigationMenuItemEditable.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/components/NavigationMenuItemEditable.tsxindex 882bdda7ddd..e0385ea87cc 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/components/NavigationMenuItemEditable.tsx+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/components/NavigationMenuItemEditable.tsx@@ -168,45 +168,44 @@ export const NavigationMenuItemEditable = ({row);return (- <StyledRow- id={anchorId}- onContextMenu={(event) => {- if (- !canOrganize ||- !(event.target instanceof Node) ||- !event.currentTarget.contains(event.target)- ) {- return;- }- event.preventDefault();- event.stopPropagation();- open('actions');- }}+ <NavigationMenuItemTypeTooltip+ type={item.type}+ hidden={+ !isLayoutCustomizationModeEnabled ||+ isDropdownOpen ||+ isColorPickerOpen ||+ selectedNavigationMenuItemIdInEditMode === item.id+ }>- {shouldOpenLinkEditor && (- <NavigationMenuItemLinkEditorOpenEffect- dropdownId={dropdownId}- onOpen={openEditMode}- />- )}- {content}- {canOrganize && isExpanded && (- <NavigationMenuItemRowActions- rightOptions={rightOptions}- onOpenActions={() => open('actions')}- />- )}- {isLayoutCustomizationModeEnabled && (- <NavigationMenuItemTypeTooltip- type={item.type}- anchorId={anchorId}- hidden={- isDropdownOpen ||- isColorPickerOpen ||- selectedNavigationMenuItemIdInEditMode === item.id+ <StyledRow+ id={anchorId}+ onContextMenu={(event) => {+ if (+ !canOrganize ||+ !(event.target instanceof Node) ||+ !event.currentTarget.contains(event.target)+ ) {+ return;}- />- )}- </StyledRow>+ event.preventDefault();+ event.stopPropagation();+ open('actions');+ }}+ >+ {shouldOpenLinkEditor && (+ <NavigationMenuItemLinkEditorOpenEffect+ dropdownId={dropdownId}+ onOpen={openEditMode}+ />+ )}+ {content}+ {canOrganize && isExpanded && (+ <NavigationMenuItemRowActions+ rightOptions={rightOptions}+ onOpenActions={() => open('actions')}+ />+ )}+ </StyledRow>+ </NavigationMenuItemTypeTooltip>);};diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/components/NavigationMenuItemTypeTooltip.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/components/NavigationMenuItemTypeTooltip.tsxindex 0015487e5cf..8d54c199168 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/components/NavigationMenuItemTypeTooltip.tsx+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/components/NavigationMenuItemTypeTooltip.tsx@@ -1,3 +1,5 @@+import { type ReactElement } from 'react';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useLingui } from '@lingui/react/macro';import { NavigationMenuItemType } from 'twenty-shared/types';import {@@ -9,22 +11,18 @@ import {IconTable,type IconComponent,} from 'twenty-ui/icon';-import {- AppTooltip,- TooltipDelay,- TooltipPosition,-} from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { useTheme } from 'twenty-ui/theme-constants';type NavigationMenuItemTypeTooltipProps = {type: NavigationMenuItemType;- anchorId: string;+ children: ReactElement;hidden: boolean;};export const NavigationMenuItemTypeTooltip = ({type,- anchorId,+ children,hidden,}: NavigationMenuItemTypeTooltipProps) => {const { t } = useLingui();@@ -42,19 +40,39 @@ export const NavigationMenuItemTypeTooltip = ({PAGE_LAYOUT: { label: t`Page`, Icon: IconPerspective },};+ const { label, Icon } = labelsByType[type];+return (- <AppTooltip+ <Tooltipdelay={TooltipDelay.mediumDelay}- anchorSelect={`#${anchorId}`}- title={labelsByType[type].label}- description={- type === NavigationMenuItemType.FOLDER ? t`Click to edit` : undefined+ content={+ <Tooltip.Content+ description={+ type === NavigationMenuItemType.FOLDER+ ? t`Click to edit`+ : undefined+ }+ startIcon={<Icon size={theme.icon.size.sm} />}+ >+ {label}+ </Tooltip.Content>}- Icon={labelsByType[type].Icon}- offset={theme.spacingMultiplicator}- hidden={hidden}- place={TooltipPosition.Top}- positionStrategy="fixed"- />+ sideOffset={theme.spacingMultiplicator}+ disabled={hidden}+ onOpenChange={(...openChangeArguments) => {+ const [open, eventDetails] = openChangeArguments;+ const isDescendantFocus =+ eventDetails.reason === 'trigger-focus' &&+ eventDetails.event.target !== eventDetails.trigger;++ if (open && isDescendantFocus) {+ eventDetails.cancel();+ }+ }}+ side="top"+ positionMethod="fixed"+ >+ {children}+ </Tooltip>);};diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/components/__stories__/NavigationMenuItemEditable.stories.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/components/__stories__/NavigationMenuItemEditable.stories.tsxindex 0c6d9426824..2763b776a4c 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/components/__stories__/NavigationMenuItemEditable.stories.tsx+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/components/__stories__/NavigationMenuItemEditable.stories.tsx@@ -215,30 +215,31 @@ export const EditFolderInPlace: Story = {export const TooltipsStayOutOfActionMenus: Story = {play: async ({ canvasElement }) => {+ const user = userEvent.setup();const canvas = within(canvasElement);const body = within(canvasElement.ownerDocument.body);const docs = await canvas.findByText('Docs');const status = await canvas.findByText('Status');- await userEvent.hover(docs);+ await user.hover(docs);await expect(await body.findByRole('tooltip')).toHaveTextContent('Link');- await userEvent.hover(status);+ await user.hover(status);await expect(await body.findByRole('tooltip')).toHaveTextContent('Link');await expect(body.getAllByRole('tooltip')).toHaveLength(1);for (const name of ['Docs', 'Status']) {- await userEvent.tab();- await userEvent.tab();+ await user.tab();+ await user.tab();await expect(canvas.getByText(name)).toHaveFocus();const actions = (await canvas.findAllByRole('button', { name: 'Menu item actions' }))[name === 'Docs' ? 0 : 1];- await userEvent.hover(actions);+ await user.hover(actions);await expect(body.queryByRole('tooltip')).not.toBeInTheDocument();- await userEvent.click(actions);+ await user.click(actions);await expect(await body.findByText('Remove from sidebar')).toBeVisible();await expect(body.queryByRole('tooltip')).not.toBeInTheDocument();- await userEvent.keyboard('{Escape}');+ await user.keyboard('{Escape}');await expect(body.queryByRole('tooltip')).not.toBeInTheDocument();}},diff --git a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerModeSwitcher.tsx b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerModeSwitcher.tsxindex dad36ba880a..d2191c08048 100644--- a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerModeSwitcher.tsx+++ b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerModeSwitcher.tsx@@ -2,12 +2,8 @@ import { NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE } from '@/ui/navigation/navigatimport { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { motion, useReducedMotion } from 'framer-motion';-import { useContext, useId } from 'react';-import {- AppTooltip,- TooltipDelay,- TooltipPosition,-} from 'twenty-ui/primitives/surfaces';+import { useContext } from 'react';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { isLayoutCustomizationModeEnabledState } from '@/layout-customization/states/isLayoutCustomizationModeEnabledState';@@ -15,6 +11,7 @@ import { useActiveNavigationDrawerMode } from '@/navigation/hooks/useActiveNavigimport { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';import { useNavigationDrawerModes } from '@/navigation/hooks/useNavigationDrawerModes';import { useSwitchNavigationDrawerMode } from '@/navigation/hooks/useSwitchNavigationDrawerMode';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { NAVIGATION_DRAWER_TABS } from '@/ui/navigation/states/navigationDrawerTabs';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';@@ -117,7 +114,6 @@ const StyledModeLabel = motion.create(StyledModeLabelBase);export const MainNavigationDrawerModeSwitcher = () => {const { t } = useLingui();const { theme } = useContext(ThemeContext);- const tooltipId = useId();const isLayoutCustomizationModeEnabled = useAtomStateValue(isLayoutCustomizationModeEnabledState,@@ -136,23 +132,34 @@ export const MainNavigationDrawerModeSwitcher = () => {const shouldShowTooltips = !isExpanded && !isMobile;return (- <>- <StyledSwitcher- isExpanded={isExpanded}- role="group"- aria-label={t`Navigation modes`}- >- {modes.map(({ Icon, label, mode }) => {- const isActive = mode === activeNavigationDrawerMode;- const isDisabled =- mode !== NAVIGATION_DRAWER_TABS.NAVIGATION_MENU &&- isLayoutCustomizationModeEnabled;+ <StyledSwitcher+ isExpanded={isExpanded}+ role="group"+ aria-label={t`Navigation modes`}+ >+ {modes.map(({ Icon, label, mode }) => {+ const isActive = mode === activeNavigationDrawerMode;+ const isDisabled =+ mode !== NAVIGATION_DRAWER_TABS.NAVIGATION_MENU &&+ isLayoutCustomizationModeEnabled;- return (+ return (+ <Tooltip+ key={mode}+ content={+ isDisabled+ ? mode === NAVIGATION_DRAWER_TABS.SETTINGS+ ? t`Finish editing the layout to open Settings`+ : t`Finish editing the layout to open AI`+ : label+ }+ disabled={!shouldShowTooltips && !isDisabled}+ delay={TooltipDelay.noDelay}+ side={isExpanded ? 'bottom' : 'right'}+ positionMethod="fixed"+ ><StyledMode- key={mode}type="button"- data-tooltip-id={`${tooltipId}-${mode}`}isActive={isActive}isExpanded={isExpanded}aria-label={label}@@ -182,36 +189,9 @@ export const MainNavigationDrawerModeSwitcher = () => {{label}</StyledModeLabel></StyledMode>- );- })}- </StyledSwitcher>- {modes.map(({ label, mode }) => {- const isDisabled =- mode !== NAVIGATION_DRAWER_TABS.NAVIGATION_MENU &&- isLayoutCustomizationModeEnabled;-- if (!shouldShowTooltips && !isDisabled) {- return null;- }-- return (- <AppTooltip- key={mode}- anchorSelect={`[data-tooltip-id='${tooltipId}-${mode}']`}- title={- isDisabled- ? mode === NAVIGATION_DRAWER_TABS.SETTINGS- ? t`Finish editing the layout to open Settings`- : t`Finish editing the layout to open AI`- : label- }- delay={TooltipDelay.noDelay}- place={isExpanded ? TooltipPosition.Bottom : TooltipPosition.Right}- positionStrategy="fixed"- noArrow- />+ </Tooltip>);})}- </>+ </StyledSwitcher>);};diff --git a/packages/twenty-front/src/modules/navigation/components/__tests__/MainNavigationDrawerModeSwitcher.test.tsx b/packages/twenty-front/src/modules/navigation/components/__tests__/MainNavigationDrawerModeSwitcher.test.tsxindex d4f409ea33f..e825acff851 100644--- a/packages/twenty-front/src/modules/navigation/components/__tests__/MainNavigationDrawerModeSwitcher.test.tsx+++ b/packages/twenty-front/src/modules/navigation/components/__tests__/MainNavigationDrawerModeSwitcher.test.tsx@@ -22,11 +22,6 @@ jest.mock('@/ui/utilities/responsive/hooks/useIsMobile', () => ({useIsMobile: () => false,}));-jest.mock('twenty-ui/primitives/surfaces', () => ({- ...jest.requireActual('twenty-ui/primitives/surfaces'),- AppTooltip: () => null,-}));-const mockSwitchNavigationDrawerMode = jest.fn();const renderModeSwitcher = (isLayoutCustomizationModeEnabled = false) => {diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCustomView.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCustomView.tsxindex e0c98905dd1..285e153c2e7 100644--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCustomView.tsx+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCustomView.tsx@@ -11,6 +11,7 @@ import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/Geneimport { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly';@@ -34,7 +35,7 @@ import {IconShare,IconTrash,} from 'twenty-ui/icon';-import { AppTooltip } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { MenuItem } from 'twenty-ui/primitives/navigation';import { ViewCalendarLayout } from '~/generated-metadata/graphql';@@ -239,76 +240,74 @@ export const ObjectOptionsDropdownCustomView = ({/></SelectableListItem>{customViewData?.type !== ViewType.CALENDAR && (- <div id="group-by-menu-item">- <SelectableListItem- itemId="Group"- onEnter={() =>- isDefined(recordIndexGroupFieldMetadataItem)- ? onContentChange('recordGroups')- : onContentChange('recordGroupFields')- }- >- <MenuItem- focused={selectedItemId === 'Group'}- onClick={() =>+ <Tooltip+ content={t`Not available on Default View`}+ side="bottom"+ maxWidth={'100%'}+ delay={TooltipDelay.mediumDelay}+ disabled={!isDefaultView}+ >+ <div id="group-by-menu-item">+ <SelectableListItem+ itemId="Group"+ onEnter={() =>isDefined(recordIndexGroupFieldMetadataItem)? onContentChange('recordGroups'): onContentChange('recordGroupFields')}- LeftIcon={IconLayoutList}- text={t`Group`}- contextualText={- isDefaultView- ? t`Not available on Default View`- : recordIndexGroupFieldMetadataItem?.label- }- contextualTextPosition="right"- hasSubMenu- disabled={isDefaultView}- />- </SelectableListItem>- </div>- )}- {isDefaultView && (- <AppTooltip- anchorSelect={`#group-by-menu-item`}- title={t`Not available on Default View`}- noArrow- place="bottom"- maxWidth="100%"- />+ >+ <MenuItem+ focused={selectedItemId === 'Group'}+ onClick={() =>+ isDefined(recordIndexGroupFieldMetadataItem)+ ? onContentChange('recordGroups')+ : onContentChange('recordGroupFields')+ }+ LeftIcon={IconLayoutList}+ text={t`Group`}+ contextualText={+ isDefaultView+ ? t`Not available on Default View`+ : recordIndexGroupFieldMetadataItem?.label+ }+ contextualTextPosition="right"+ hasSubMenu+ disabled={isDefaultView}+ />+ </SelectableListItem>+ </div>+ </Tooltip>)}</DropdownMenuItemsContainer><DropdownMenuSeparator /><DropdownMenuItemsContainer scrollable={false}>- <div id="delete-view-menu-item">- <SelectableListItem- itemId="Delete view"- onEnter={() => handleDelete()}- >- <MenuItem- focused={selectedItemId === 'Delete view'}- onClick={() => handleDelete()}- LeftIcon={IconTrash}- text={t`Delete view`}- disabled={isDefaultView || isLastView}- accent="danger"- />- </SelectableListItem>- </div>- {(isDefaultView || isLastView) && (- <AppTooltip- anchorSelect={`#delete-view-menu-item`}- title={- isDefaultView- ? t`Not available on Default View`- : t`Cannot delete the only view`- }- noArrow- place="bottom"- maxWidth="100%"- />- )}+ <Tooltip+ delay={TooltipDelay.mediumDelay}+ content={+ isDefaultView+ ? t`Not available on Default View`+ : t`Cannot delete the only view`+ }+ side="bottom"+ maxWidth={'100%'}+ disabled={!(isDefaultView || isLastView)}+ >+ <div id="delete-view-menu-item">+ <SelectableListItem+ itemId="Delete view"+ onEnter={() => handleDelete()}+ >+ <MenuItem+ focused={selectedItemId === 'Delete view'}+ onClick={() => handleDelete()}+ LeftIcon={IconTrash}+ text={t`Delete view`}+ disabled={isDefaultView || isLastView}+ accent="danger"+ />+ </SelectableListItem>+ </div>+ </Tooltip></DropdownMenuItemsContainer></SelectableList></DropdownContent>diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownVisibilityContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownVisibilityContent.tsxindex b416c68e9b2..48b3cc2f98d 100644--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownVisibilityContent.tsx+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownVisibilityContent.tsx@@ -9,12 +9,12 @@ import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/Geneimport { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useCanPersistViewChanges } from '@/views/hooks/useCanPersistViewChanges';import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly';import { useUpdateCurrentView } from '@/views/hooks/useUpdateCurrentView';import { useLingui } from '@lingui/react/macro';-import { createPortal } from 'react-dom';import { createPath, useLocation } from 'react-router-dom';import {IconChevronLeft,@@ -22,7 +22,7 @@ import {IconCircleDashed,IconCopy,} from 'twenty-ui/icon';-import { AppTooltip } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { MenuItem, MenuItemSelect } from 'twenty-ui/primitives/navigation';import {ViewVisibility,@@ -94,7 +94,12 @@ export const ObjectOptionsDropdownVisibilityContent = () => {handleVisibilityChange(ViewVisibility.WORKSPACE)}>- <>+ <Tooltip+ content={t`Workspace views require manage views permission`}+ positionMethod="fixed"+ delay={TooltipDelay.mediumDelay}+ disabled={!!hasViewsPermission}+ ><div id="workspace-visibility-option"><MenuItemSelectLeftIcon={IconCircle}@@ -108,16 +113,7 @@ export const ObjectOptionsDropdownVisibilityContent = () => {disabled={!hasViewsPermission || !canPersistChanges}/></div>- {!hasViewsPermission &&- createPortal(- <AppTooltip- anchorSelect="#workspace-visibility-option"- title={t`Workspace views require manage views permission`}- positionStrategy="fixed"- />,- document.body,- )}- </>+ </Tooltip></SelectableListItem><SelectableListItemitemId={ViewVisibility.UNLISTED}diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/components/FieldDescriptionTooltip.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/components/FieldDescriptionTooltip.tsxindex 826440438f5..5811b2f8380 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/components/FieldDescriptionTooltip.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/components/FieldDescriptionTooltip.tsx@@ -1,7 +1,9 @@import { FieldDescriptionTooltipContext } from '@/object-record/record-field/ui/contexts/FieldDescriptionTooltipContext';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { styled } from '@linaria/react';import { isNonEmptyString } from '@sniptt/guards';import { type ReactNode, useContext, useId } from 'react';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { isDefined } from 'twenty-shared/utils';const StyledLabel = styled.span`@@ -23,32 +25,29 @@ export const FieldDescriptionTooltip = ({description,fallback,}: FieldDescriptionTooltipProps) => {- const context = useContext(FieldDescriptionTooltipContext);+ const tooltipHandle = useContext(FieldDescriptionTooltipContext);const descriptionId = useId();if (- !isDefined(context) ||+ !isDefined(tooltipHandle) ||!isNonEmptyString(label) ||!isNonEmptyString(description)) {return fallback ?? <StyledLabel>{label}</StyledLabel>;}- const handleEnter = () => {- context.setTooltipContent({ title: label, description });- };-return (<>- <StyledLabel- data-tooltip-id={context.tooltipId}+ <Tooltip.Trigger+ handle={tooltipHandle}+ delay={TooltipDelay.longDelay}+ payload={{ title: label, description }}+ render={<StyledLabel />}aria-describedby={descriptionId}tabIndex={0}- onMouseEnter={handleEnter}- onFocus={handleEnter}>{label}- </StyledLabel>+ </Tooltip.Trigger><span id={descriptionId} hidden>{description}</span>diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/components/FieldDescriptionTooltipProvider.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/components/FieldDescriptionTooltipProvider.tsxindex 939c1556e4b..160b6c53a1c 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/components/FieldDescriptionTooltipProvider.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/components/FieldDescriptionTooltipProvider.tsx@@ -1,10 +1,8 @@import { FieldDescriptionTooltipContext } from '@/object-record/record-field/ui/contexts/FieldDescriptionTooltipContext';-import { type ReactNode, useId, useMemo, useState } from 'react';-import {- AppTooltip,- type AppTooltipProps,- TooltipDelay,-} from 'twenty-ui/primitives/surfaces';+import { type FieldDescriptionTooltipContent } from '@/object-record/record-field/ui/types/FieldDescriptionTooltipContent';+import { type ReactNode, useRef, useState } from 'react';+import { isDefined } from 'twenty-shared/utils';+import { Tooltip } from 'twenty-ui/primitives/surfaces';type FieldDescriptionTooltipProviderProps = {children: ReactNode;@@ -13,26 +11,49 @@ type FieldDescriptionTooltipProviderProps = {export const FieldDescriptionTooltipProvider = ({children,}: FieldDescriptionTooltipProviderProps) => {- const tooltipId = useId();- const [tooltipContent, setTooltipContent] = useState<- Pick<AppTooltipProps, 'title' | 'description'>- >({});- const contextValue = useMemo(- () => ({ tooltipId, setTooltipContent }),- [tooltipId],+ const activeTriggerRef = useRef<Element>(null);+ const [tooltipHandle] = useState(() =>+ Tooltip.createHandle<FieldDescriptionTooltipContent>(),);return (- <FieldDescriptionTooltipContext.Provider value={contextValue}>- {children}- <AppTooltip- anchorSelect={`[data-tooltip-id='${tooltipId}']`}- title={tooltipContent.title}- description={tooltipContent.description}- delay={TooltipDelay.longDelay}- place="bottom"- positionStrategy="fixed"- />+ <FieldDescriptionTooltipContext.Provider value={tooltipHandle}>+ <Tooltip.Root+ handle={tooltipHandle}+ onOpenChange={(...openChangeArguments) => {+ const [open, eventDetails] = openChangeArguments;+ if (open) {+ activeTriggerRef.current = eventDetails.trigger ?? null;++ return;+ }++ const activeTrigger = activeTriggerRef.current;+ const shouldKeepTooltipOpen =+ eventDetails.reason === 'trigger-hover' &&+ isDefined(activeTrigger) &&+ activeTrigger.ownerDocument.activeElement === activeTrigger;++ if (shouldKeepTooltipOpen) {+ eventDetails.cancel();++ return;+ }++ activeTriggerRef.current = null;+ }}+ >+ {({ payload }) => (+ <>+ {children}+ <Tooltip.Popup side="bottom" positionMethod="fixed">+ <Tooltip.Content description={payload?.description}>+ {payload?.title}+ </Tooltip.Content>+ </Tooltip.Popup>+ </>+ )}+ </Tooltip.Root></FieldDescriptionTooltipContext.Provider>);};diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/components/__stories__/FieldDescriptionTooltip.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/components/__stories__/FieldDescriptionTooltip.stories.tsxindex a2432e69343..b86f2096014 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/components/__stories__/FieldDescriptionTooltip.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/components/__stories__/FieldDescriptionTooltip.stories.tsx@@ -43,40 +43,45 @@ export const Hover: Story = {await userEvent.unhover(firstLabel);await userEvent.hover(secondLabel);- await waitFor(() =>- expect(tooltip).toHaveTextContent(- 'The team member responsible for this company',- ),+ await waitFor(+ () =>+ expect(body.getByRole('tooltip')).toHaveTextContent(+ 'The team member responsible for this company',+ ),+ { timeout: 5000 },);expect(body.getAllByRole('tooltip')).toHaveLength(1);- expect(tooltip).not.toHaveTextContent('The company website URL');+ expect(body.getByRole('tooltip')).not.toHaveTextContent(+ 'The company website URL',+ );},};export const KeyboardFocus: Story = {play: async ({ canvasElement }) => {+ const user = userEvent.setup();const canvas = within(canvasElement);const body = within(canvasElement.ownerDocument.body);const firstLabel = canvas.getByText('Domain Name');const secondLabel = canvas.getByText('Account Owner');- await userEvent.tab();+ await user.tab();expect(firstLabel).toHaveFocus();expect(firstLabel).toHaveAccessibleDescription('The company website URL');- await userEvent.hover(firstLabel);- await userEvent.unhover(firstLabel);+ await user.hover(firstLabel);+ await user.unhover(firstLabel);const tooltip = await body.findByRole('tooltip', undefined, {timeout: 5000,});await waitFor(() => expect(tooltip).toBeVisible());- await userEvent.hover(firstLabel);- await userEvent.unhover(firstLabel);+ await user.hover(firstLabel);+ await user.unhover(firstLabel);await new Promise((resolve) => setTimeout(resolve, 100));expect(tooltip).toBeVisible();expect(firstLabel).toHaveFocus();- await userEvent.tab();+ await user.tab();expect(secondLabel).toHaveFocus();await waitFor(() =>expect(tooltip).toHaveTextContent(@@ -84,7 +89,7 @@ export const KeyboardFocus: Story = {),);- await userEvent.tab();+ await user.tab();await waitFor(() => expect(body.queryByRole('tooltip')).toBeNull());},};diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/components/__tests__/FieldDescriptionTooltip.test.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/components/__tests__/FieldDescriptionTooltip.test.tsxnew file mode 100644index 00000000000..553587138ea--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/components/__tests__/FieldDescriptionTooltip.test.tsx@@ -0,0 +1,31 @@+import { render, screen } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import { Tooltip } from 'twenty-ui/primitives/surfaces';++import { FieldDescriptionTooltip } from '@/object-record/record-field/ui/components/FieldDescriptionTooltip';+import { FieldDescriptionTooltipProvider } from '@/object-record/record-field/ui/components/FieldDescriptionTooltipProvider';++describe('FieldDescriptionTooltip', () => {+ it('uses its shared provider through a disabled tooltip', async () => {+ const user = userEvent.setup();++ render(+ <FieldDescriptionTooltipProvider>+ <Tooltip content="Inline field" disabled>+ <div>+ <FieldDescriptionTooltip+ label="Company"+ description="Legal company name"+ />+ </div>+ </Tooltip>+ </FieldDescriptionTooltipProvider>,+ );++ await user.tab();++ expect(await screen.findByRole('tooltip')).toHaveTextContent(+ 'Legal company name',+ );+ });+});diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/contexts/FieldDescriptionTooltipContext.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/contexts/FieldDescriptionTooltipContext.tsindex 2f884eef67e..e1e2c0a14fe 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/contexts/FieldDescriptionTooltipContext.ts+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/contexts/FieldDescriptionTooltipContext.ts@@ -1,13 +1,11 @@+import { type FieldDescriptionTooltipContent } from '@/object-record/record-field/ui/types/FieldDescriptionTooltipContent';import { createContext } from 'react';-import { type AppTooltipProps } from 'twenty-ui/primitives/surfaces';+import { type Tooltip } from 'twenty-ui/primitives/surfaces';-type FieldDescriptionTooltipContextValue = {- tooltipId: string;- setTooltipContent: (- content: Pick<AppTooltipProps, 'title' | 'description'>,- ) => void;-};+type FieldDescriptionTooltipHandle = ReturnType<+ typeof Tooltip.createHandle<FieldDescriptionTooltipContent>+>;export const FieldDescriptionTooltipContext = createContext<- FieldDescriptionTooltipContextValue | undefined+ FieldDescriptionTooltipHandle | undefined>(undefined);diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/types/FieldDescriptionTooltipContent.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/types/FieldDescriptionTooltipContent.tsnew file mode 100644index 00000000000..5d7370e133b--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/types/FieldDescriptionTooltipContent.ts@@ -0,0 +1,4 @@+export type FieldDescriptionTooltipContent = {+ title: string;+ description: string;+};diff --git a/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupAggregateDropdownButton.tsx b/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupAggregateDropdownButton.tsxindex 2a38c5bf719..4c1ae508b3a 100644--- a/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupAggregateDropdownButton.tsx+++ b/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupAggregateDropdownButton.tsx@@ -1,11 +1,12 @@import { StyledHeaderDropdownButton } from '@/ui/layout/dropdown/components/StyledHeaderDropdownButton';import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { styled } from '@linaria/react';import { type Nullable } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { Tag } from 'twenty-ui/primitives/data-display';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';const StyledTagContainer = styled.div`width: 100%;@@ -33,25 +34,21 @@ export const RecordGroupAggregateDropdownButton = ({return (<StyledHeaderContainer>- <StyledHeaderDropdownButton id={dropdownId} isUnfolded={isDropdownOpen}>- <>+ <Tooltip+ content={tooltip ?? ''}+ side="right"+ positionMethod="fixed"+ delay={TooltipDelay.mediumDelay}+ disabled={isDropdownOpen}+ >+ <StyledHeaderDropdownButton id={dropdownId} isUnfolded={isDropdownOpen}><StyledTagContainer><Tag color="transparent" weight="regular">{isDefined(value) ? value.toString() : '-'}</Tag></StyledTagContainer>- {!isDropdownOpen && (- <AppTooltip- anchorSelect={`#${dropdownId}`}- title={tooltip ?? ''}- noArrow- place="right"- positionStrategy="fixed"- delay={TooltipDelay.mediumDelay}- />- )}- </>- </StyledHeaderDropdownButton>+ </StyledHeaderDropdownButton>+ </Tooltip></StyledHeaderContainer>);};diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsx b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsxindex a91b642b48b..9cb1109d78f 100644--- a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsx+++ b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsx@@ -6,14 +6,13 @@ import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';import { useFieldFocus } from '@/object-record/record-field/ui/hooks/useFieldFocus';import { RecordInlineCellValue } from '@/object-record/record-inline-cell/components/RecordInlineCellValue';-import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata';import { isFieldText } from '@/object-record/record-field/ui/types/guards/isFieldText';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import {- AppTooltip,+ Tooltip,OverflowingTextWithTooltip,- TooltipDelay,} from 'twenty-ui/primitives/surfaces';import { FieldMetadataType } from '~/generated-metadata/graphql';import { useRecordInlineCellContext } from './RecordInlineCellContext';@@ -76,7 +75,7 @@ export const RecordInlineCellContainer = () => {useRecordInlineCellContext();const { theme } = useContext(ThemeContext);- const { recordId, fieldDefinition, onMouseEnter, onMouseLeave, anchorId } =+ const { fieldDefinition, onMouseEnter, onMouseLeave, anchorId } =useContext(FieldContext);if (isFieldText(fieldDefinition)) {@@ -99,11 +98,6 @@ export const RecordInlineCellContainer = () => {onMouseLeave?.();};- const labelId = `label-${getRecordFieldInputInstanceId({- recordId,- fieldName: fieldDefinition?.metadata?.fieldName,- })}`;-return (<StyledInlineCellBaseContainerreadonly={readonly ?? false}@@ -111,39 +105,35 @@ export const RecordInlineCellContainer = () => {onMouseLeave={handleContainerMouseLeave}>{(IconLabel || label) && (- <StyledLabelAndIconContainer id={!showLabel ? labelId : undefined}>- {IconLabel && (- <StyledIconContainer>- <IconLabel stroke={theme.icon.stroke.sm} />- </StyledIconContainer>- )}- {showLabel && (- <StyledLabelContainer width={labelWidth}>- <FieldDescriptionTooltip- label={label}- description={fieldDefinition?.metadata?.description}- fallback={- <OverflowingTextWithTooltip- text={label}- displayedMaxRows={1}- />- }- />- </StyledLabelContainer>- )}- {/* TODO: Displaying Tooltips on the board is causing performance issues https://react-tooltip.com/docs/examples/render */}- {!showLabel && (- <AppTooltip- anchorSelect={`#${labelId}`}- title={label}- interactive- noArrow- place="bottom"- positionStrategy="fixed"- delay={TooltipDelay.shortDelay}- />- )}- </StyledLabelAndIconContainer>+ <Tooltip+ content={label}+ disabled={showLabel}+ side="bottom"+ positionMethod="fixed"+ delay={TooltipDelay.shortDelay}+ >+ <StyledLabelAndIconContainer>+ {IconLabel && (+ <StyledIconContainer>+ <IconLabel stroke={theme.icon.stroke.sm} />+ </StyledIconContainer>+ )}+ {showLabel && (+ <StyledLabelContainer width={labelWidth}>+ <FieldDescriptionTooltip+ label={label}+ description={fieldDefinition?.metadata?.description}+ fallback={+ <OverflowingTextWithTooltip+ text={label}+ displayedMaxRows={1}+ />+ }+ />+ </StyledLabelContainer>+ )}+ </StyledLabelAndIconContainer>+ </Tooltip>)}<StyledValueContainer readonly={readonly ?? false} id={anchorId}><RecordInlineCellValue />diff --git a/packages/twenty-front/src/modules/object-record/record-list/components/RecordList.tsx b/packages/twenty-front/src/modules/object-record/record-list/components/RecordList.tsxindex 9b15cd5c6ee..67bc1c30009 100644--- a/packages/twenty-front/src/modules/object-record/record-list/components/RecordList.tsx+++ b/packages/twenty-front/src/modules/object-record/record-list/components/RecordList.tsx@@ -35,13 +35,18 @@ export const RecordList = () => {return (<StyledContainer ref={setContainerElement}><RecordListResponsiveFieldsEffect containerElement={containerElement} />- <ScrollWrapper- componentInstanceId={`scroll-wrapper-record-list-${recordListId}`}- defaultEnableXScroll={false}- >- {hasRecordGroups ? <RecordListRecordGroupsBody /> : <RecordListBody />}- </ScrollWrapper>- <RecordListFieldTooltip />+ <RecordListFieldTooltip>+ <ScrollWrapper+ componentInstanceId={`scroll-wrapper-record-list-${recordListId}`}+ defaultEnableXScroll={false}+ >+ {hasRecordGroups ? (+ <RecordListRecordGroupsBody />+ ) : (+ <RecordListBody />+ )}+ </ScrollWrapper>+ </RecordListFieldTooltip></StyledContainer>);};diff --git a/packages/twenty-front/src/modules/object-record/record-list/components/RecordListFieldTooltip.tsx b/packages/twenty-front/src/modules/object-record/record-list/components/RecordListFieldTooltip.tsxindex b70a3030f9a..0bea62ccd0d 100644--- a/packages/twenty-front/src/modules/object-record/record-list/components/RecordListFieldTooltip.tsx+++ b/packages/twenty-front/src/modules/object-record/record-list/components/RecordListFieldTooltip.tsx@@ -1,49 +1,43 @@-import { visibleRecordFieldsComponentSelector } from '@/object-record/record-field/states/visibleRecordFieldsComponentSelector';import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';-import { RECORD_LIST_ROW_FIELD_ANCHOR_CLASS_NAME } from '@/object-record/record-list/constants/RecordListRowFieldAnchorClassName';-import { recordListHoveredFieldMetadataItemIdComponentState } from '@/object-record/record-list/states/recordListHoveredFieldMetadataItemIdComponentState';-import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';-import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';+import { type ReactNode } from 'react';import { isDefined } from 'twenty-shared/utils';import { useIcons } from 'twenty-ui/icon';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';-export const RecordListFieldTooltip = () => {- const { getIcon } = useIcons();+type RecordListFieldTooltipProps = {+ children: ReactNode;+};+export const RecordListFieldTooltip = ({+ children,+}: RecordListFieldTooltipProps) => {+ const { getIcon } = useIcons();const { fieldDefinitionByFieldMetadataItemId } =useRecordIndexContextOrThrow();- const recordListHoveredFieldMetadataItemId = useAtomComponentStateValue(- recordListHoveredFieldMetadataItemIdComponentState,- );-- const visibleRecordFields = useAtomComponentSelectorValue(- visibleRecordFieldsComponentSelector,- );-- const visibleRecordFieldIds = visibleRecordFields- .map((recordField) => recordField.fieldMetadataItemId)- .join('-');-- const hoveredFieldDefinition = isDefined(recordListHoveredFieldMetadataItemId)- ? fieldDefinitionByFieldMetadataItemId[recordListHoveredFieldMetadataItemId]- : undefined;-- const FieldIcon = isDefined(hoveredFieldDefinition)- ? getIcon(hoveredFieldDefinition.iconName)- : null;-return (- <AppTooltip- key={visibleRecordFieldIds}- anchorSelect={`.${RECORD_LIST_ROW_FIELD_ANCHOR_CLASS_NAME}`}- title={hoveredFieldDefinition?.label}- Icon={FieldIcon ?? undefined}- noArrow- place="bottom"- positionStrategy="fixed"- delay={TooltipDelay.shortDelay}- />+ <Tooltip.Root<string>>+ {({ payload }) => {+ const fieldDefinition = isDefined(payload)+ ? fieldDefinitionByFieldMetadataItemId[payload]+ : undefined;+ const FieldIcon = isDefined(fieldDefinition)+ ? getIcon(fieldDefinition.iconName)+ : undefined;++ return (+ <>+ {children}+ <Tooltip.Popup side="bottom" positionMethod="fixed">+ <Tooltip.Content+ startIcon={isDefined(FieldIcon) ? <FieldIcon /> : undefined}+ >+ {fieldDefinition?.label}+ </Tooltip.Content>+ </Tooltip.Popup>+ </>+ );+ }}+ </Tooltip.Root>);};diff --git a/packages/twenty-front/src/modules/object-record/record-list/components/RecordListRow.tsx b/packages/twenty-front/src/modules/object-record/record-list/components/RecordListRow.tsxindex 0c22ea9ee6c..d169333a8d8 100644--- a/packages/twenty-front/src/modules/object-record/record-list/components/RecordListRow.tsx+++ b/packages/twenty-front/src/modules/object-record/record-list/components/RecordListRow.tsx@@ -20,7 +20,6 @@ import { plural, t } from '@lingui/core/macro';import { isNonEmptyString } from '@sniptt/guards';import { isDefined } from 'twenty-shared/utils';import { Chip, LinkChip } from 'twenty-ui/primitives/data-display';-import { TooltipPosition } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';const StyledRowContainer = styled.div`@@ -192,7 +191,7 @@ export const RecordListRow = ({ recordId }: RecordListRowProps) => {onClick={openRecord}triggerEvent="CLICK"tooltipLabel={overflowChipTooltipLabel}- tooltipPlace={TooltipPosition.Top}+ tooltipPlace={'top'}alwaysShowTooltipvariant="soft">@@ -201,7 +200,7 @@ export const RecordListRow = ({ recordId }: RecordListRowProps) => {) : (<ChiptooltipLabel={overflowChipTooltipLabel}- tooltipPlace={TooltipPosition.Top}+ tooltipPlace={'top'}alwaysShowTooltipvariant="soft">diff --git a/packages/twenty-front/src/modules/object-record/record-list/components/RecordListRowField.tsx b/packages/twenty-front/src/modules/object-record/record-list/components/RecordListRowField.tsxindex ee36c207708..168d81e776e 100644--- a/packages/twenty-front/src/modules/object-record/record-list/components/RecordListRowField.tsx+++ b/packages/twenty-front/src/modules/object-record/record-list/components/RecordListRowField.tsx@@ -3,13 +3,12 @@ import { FieldDisplay } from '@/object-record/record-field/ui/components/FieldDiimport { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext';import { type FieldMetadata } from '@/object-record/record-field/ui/types/FieldMetadata';-import { RECORD_LIST_ROW_FIELD_ANCHOR_CLASS_NAME } from '@/object-record/record-list/constants/RecordListRowFieldAnchorClassName';import { RECORD_LIST_ROW_INPUT_ID_PREFIX } from '@/object-record/record-list/constants/RecordListRowInputIdPrefix';-import { recordListHoveredFieldMetadataItemIdComponentState } from '@/object-record/record-list/states/recordListHoveredFieldMetadataItemIdComponentState';import { type ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition';import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';-import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { styled } from '@linaria/react';+import { Tooltip } from 'twenty-ui/primitives/surfaces';// Shrinkable rather than fixed: a long record label can eat into the fields'// share of the row, and a field that refuses to give any of it back is clipped@@ -38,17 +37,11 @@ export const RecordListRowField = ({fieldDefinition,maxWidth,}: RecordListRowFieldProps) => {- const setRecordListHoveredFieldMetadataItemId = useSetAtomComponentState(- recordListHoveredFieldMetadataItemIdComponentState,- );-return (- <StyledFieldContainer- className={RECORD_LIST_ROW_FIELD_ANCHOR_CLASS_NAME}- style={{ maxWidth }}- onMouseEnter={() =>- setRecordListHoveredFieldMetadataItemId(recordField.fieldMetadataItemId)- }+ <Tooltip.Trigger+ payload={recordField.fieldMetadataItemId}+ delay={TooltipDelay.shortDelay}+ render={<StyledFieldContainer style={{ maxWidth }} />}><FieldContext.Providervalue={{@@ -74,6 +67,6 @@ export const RecordListRowField = ({<FieldDisplay /></RecordFieldComponentInstanceContext.Provider></FieldContext.Provider>- </StyledFieldContainer>+ </Tooltip.Trigger>);};diff --git a/packages/twenty-front/src/modules/object-record/record-list/constants/RecordListRowFieldAnchorClassName.ts b/packages/twenty-front/src/modules/object-record/record-list/constants/RecordListRowFieldAnchorClassName.tsdeleted file mode 100644index 1cc950c7441..00000000000--- a/packages/twenty-front/src/modules/object-record/record-list/constants/RecordListRowFieldAnchorClassName.ts+++ /dev/null@@ -1,2 +0,0 @@-export const RECORD_LIST_ROW_FIELD_ANCHOR_CLASS_NAME =- 'record-list-row-field-anchor';diff --git a/packages/twenty-front/src/modules/object-record/record-list/states/recordListHoveredFieldMetadataItemIdComponentState.ts b/packages/twenty-front/src/modules/object-record/record-list/states/recordListHoveredFieldMetadataItemIdComponentState.tsdeleted file mode 100644index 05d33bb8c1d..00000000000--- a/packages/twenty-front/src/modules/object-record/record-list/states/recordListHoveredFieldMetadataItemIdComponentState.ts+++ /dev/null@@ -1,9 +0,0 @@-import { RecordListComponentInstanceContext } from '@/object-record/record-list/states/contexts/RecordListComponentInstanceContext';-import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState';--export const recordListHoveredFieldMetadataItemIdComponentState =- createAtomComponentState<string | null>({- key: 'recordListHoveredFieldMetadataItemIdComponentState',- defaultValue: null,- componentInstanceContext: RecordListComponentInstanceContext,- });diff --git a/packages/twenty-front/src/modules/object-record/record-show/components/RecordIdentifierBarCreatedAt.tsx b/packages/twenty-front/src/modules/object-record/record-show/components/RecordIdentifierBarCreatedAt.tsxindex edeeeccf26d..79c038d4b0d 100644--- a/packages/twenty-front/src/modules/object-record/record-show/components/RecordIdentifierBarCreatedAt.tsx+++ b/packages/twenty-front/src/modules/object-record/record-show/components/RecordIdentifierBarCreatedAt.tsx@@ -1,12 +1,13 @@import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector';import { StyledHeaderIdentifierLabel } from '@/ui/layout/page/components/StyledHeaderIdentifierLabel';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { styled } from '@linaria/react';import { Trans } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';import { useId } from 'react';-import { AppTooltip } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { dateLocaleState } from '~/localization/states/dateLocaleState';import {beautifyExactDateTime,@@ -42,17 +43,14 @@ export const RecordIdentifierBarCreatedAt = ({);return (- <>+ <Tooltip+ delay={TooltipDelay.mediumDelay}+ content={beautifyExactDateTime(recordCreatedAt)}+ side="left"+ ><StyledCreatedAt id={createdAtElementId}><Trans>Created {beautifiedCreatedAt}</Trans></StyledCreatedAt>- <AppTooltip- anchorSelect={`#${createdAtElementId}`}- title={beautifyExactDateTime(recordCreatedAt)}- interactive- noArrow- place="left"- />- </>+ </Tooltip>);};diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutRecordIdentifierBar.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutRecordIdentifierBar.tsxindex 63adcea293d..382311fb92f 100644--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutRecordIdentifierBar.tsx+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutRecordIdentifierBar.tsx@@ -5,13 +5,13 @@ import { PAGE_LAYOUT_RECORD_IDENTIFIER_BAR_HEIGHT } from '@/page-layout/constantimport { useOpenPageLayoutTabSettings } from '@/page-layout/hooks/useOpenPageLayoutTabSettings';import { type PageLayoutTab } from '@/page-layout/types/PageLayoutTab';import { type TargetRecordIdentifier } from '@/ui/layout/contexts/TargetRecordIdentifier';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { type ReactNode } from 'react';import { isDefined } from 'twenty-shared/utils';import { IconPinned } from 'twenty-ui/icon';import { IconButton } from 'twenty-ui/components';-import { TooltipDelay } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';const SIDE_TRACK = `min(${PAGE_LAYOUT_LEFT_PANEL_CONTAINER_WIDTH}px, calc(100% / 3))`;diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/PageLayoutWidgetForbiddenDisplay.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/PageLayoutWidgetForbiddenDisplay.tsxindex e33bff10a43..ef3fcaa0dd3 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/components/PageLayoutWidgetForbiddenDisplay.tsx+++ b/packages/twenty-front/src/modules/page-layout/widgets/components/PageLayoutWidgetForbiddenDisplay.tsx@@ -1,8 +1,9 @@import { ForbiddenFieldDisplay } from '@/object-record/record-field/ui/meta-types/display/components/ForbiddenFieldDisplay';import { type WidgetAccessDenialInfo } from '@/page-layout/widgets/types/WidgetAccessDenialInfo';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { plural, t } from '@lingui/core/macro';import { isDefined } from 'twenty-shared/utils';-import { AppTooltip } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';type PageLayoutWidgetForbiddenDisplayProps = {widgetId: string;@@ -37,15 +38,14 @@ export const PageLayoutWidgetForbiddenDisplay = ({};return (- <>+ <Tooltip+ delay={TooltipDelay.mediumDelay}+ content={getTooltipContent()}+ side="top"+ ><div id={tooltipId}><ForbiddenFieldDisplay /></div>- <AppTooltip- anchorSelect={`#${tooltipId}`}- title={getTooltipContent()}- place="top"- />- </>+ </Tooltip>);};diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/PageLayoutWidgetInvalidConfigDisplay.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/PageLayoutWidgetInvalidConfigDisplay.tsxindex 48457206ee9..30c7df5c035 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/components/PageLayoutWidgetInvalidConfigDisplay.tsx+++ b/packages/twenty-front/src/modules/page-layout/widgets/components/PageLayoutWidgetInvalidConfigDisplay.tsx@@ -1,9 +1,10 @@import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { type FallbackProps } from 'react-error-boundary';import { Status } from 'twenty-ui/primitives/data-display';-import { AppTooltip } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';type PageLayoutWidgetInvalidConfigDisplayProps = FallbackProps;@@ -25,14 +26,15 @@ export const PageLayoutWidgetInvalidConfigDisplay = ({return (<StyledInvalidConfigContainer>- <div id={tooltipId}>- <Status color="red">{text}</Status>- </div>- <AppTooltip- anchorSelect={`#${tooltipId}`}- title={tooltipContent}- place="top"- />+ <Tooltip+ delay={TooltipDelay.mediumDelay}+ content={tooltipContent}+ side="top"+ >+ <div id={tooltipId}>+ <Status color="red">{text}</Status>+ </div>+ </Tooltip></StyledInvalidConfigContainer>);};diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/PageLayoutWidgetStatusDisplay.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/PageLayoutWidgetStatusDisplay.tsxindex 673c51ceb18..8e7a79a6c8b 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/components/PageLayoutWidgetStatusDisplay.tsx+++ b/packages/twenty-front/src/modules/page-layout/widgets/components/PageLayoutWidgetStatusDisplay.tsx@@ -1,6 +1,7 @@+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { styled } from '@linaria/react';import { Status } from 'twenty-ui/primitives/data-display';-import { AppTooltip } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { type ThemeColor } from 'twenty-ui/theme';const StyledContainer = styled.div`@@ -24,14 +25,15 @@ export const PageLayoutWidgetStatusDisplay = ({}: PageLayoutWidgetStatusDisplayProps) => {return (<StyledContainer>- <div id={tooltipId}>- <Status color={color}>{text}</Status>- </div>- <AppTooltip- anchorSelect={`#${tooltipId}`}- title={tooltipContent}- place="top"- />+ <Tooltip+ delay={TooltipDelay.mediumDelay}+ content={tooltipContent}+ side="top"+ >+ <div id={tooltipId}>+ <Status color={color}>{text}</Status>+ </div>+ </Tooltip></StyledContainer>);};diff --git a/packages/twenty-front/src/modules/settings/ai/components/SettingsAiModelsTable.tsx b/packages/twenty-front/src/modules/settings/ai/components/SettingsAiModelsTable.tsxindex d4c68a38d76..1c8506a0e33 100644--- a/packages/twenty-front/src/modules/settings/ai/components/SettingsAiModelsTable.tsx+++ b/packages/twenty-front/src/modules/settings/ai/components/SettingsAiModelsTable.tsx@@ -1,12 +1,12 @@import { t } from '@lingui/core/macro';-import { useContext, useState } from 'react';+import { useContext, useRef, useState } from 'react';import { css } from '@linaria/core';import { styled } from '@linaria/react';import { Trans } from '@lingui/react/macro';import { isDefined } from 'twenty-shared/utils';import { IconTrash } from 'twenty-ui/icon';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { Checkbox } from 'twenty-ui/primitives/input';import { IconButton } from 'twenty-ui/components';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';@@ -76,6 +76,7 @@ export const SettingsAiModelsTable = <TModel extends AiModelSummary>({showProviderColumn = true,anchorPrefix,}: SettingsAiModelsTableProps<TModel>) => {+ const hoveredRowRef = useRef<HTMLDivElement>(null);const [hoveredModelId, setHoveredModelId] = useState<string | null>(null);const { theme } = useContext(ThemeContext);@@ -139,7 +140,10 @@ export const SettingsAiModelsTable = <TModel extends AiModelSummary>({gridTemplateColumns={gridColumns}onMouseEnter={anchorPrefix- ? () => setHoveredModelId(model.modelId)+ ? (event) => {+ hoveredRowRef.current = event.currentTarget;+ setHoveredModelId(model.modelId);+ }: undefined}onMouseLeave={@@ -215,18 +219,18 @@ export const SettingsAiModelsTable = <TModel extends AiModelSummary>({</Table>{anchorPrefix && hoveredModel && (- <AppTooltip- anchorSelect={`#${anchorPrefix}-${sanitizeIdForSelector(hoveredModel.modelId)}`}- place="top-end"- noArrow- offset={8}- delay={TooltipDelay.noDelay}- className={hoverCardTooltipClass}- maxWidth="320px"- isOpen={true}- >- <SettingsAiModelHoverCard model={hoveredModel} />- </AppTooltip>+ <Tooltip.Root key={hoveredModel.modelId} open>+ <Tooltip.Popup+ anchor={hoveredRowRef}+ side="top"+ align="end"+ sideOffset={8}+ className={hoverCardTooltipClass}+ maxWidth="320px"+ >+ <SettingsAiModelHoverCard model={hoveredModel} />+ </Tooltip.Popup>+ </Tooltip.Root>)}</>);diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitForm.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitForm.tsxindex ee054d3027d..cf37b31313b 100644--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitForm.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitForm.tsx@@ -3,7 +3,7 @@ import { useLingui } from '@lingui/react/macro';import { INTERNAL_CREDITS_PER_DISPLAY_CREDIT } from 'twenty-shared/constants';import { isDefined } from 'twenty-shared/utils';import { Section } from 'twenty-ui/primitives/layout';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';import { H2Title } from 'twenty-ui/primitives/typography';@@ -27,6 +27,7 @@ import { getUsageLimitRingColor } from '@/settings/billing/utils/getUsageLimitRiimport { Select } from '@/ui/input/components/Select';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { ProgressRing } from '@/ui/feedback/progress-ring/components/ProgressRing';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import {type UsageQuotaDefinitionsQuery,UsageOperationType,@@ -195,36 +196,39 @@ export const SettingsBillingLimitForm = ({fullWidthdisabled={!hasResource}RightIcon={() => (- <StyledRingAnchor id={RING_ANCHOR_ID}>- <ProgressRing- value={consumedPercentage}- barColor={getUsageLimitRingColor({- consumedPercentage,- isExhausted,- })}- />- </StyledRingAnchor>+ <Tooltip+ side="top"+ delay={TooltipDelay.shortDelay}+ positionMethod="fixed"+ content={+ <>+ {hasConsumption ? (+ <StyledTooltipRow>+ {t`Used`}+ <SettingsBillingLimitAmount+ text={consumedText}+ isCreditsMeter={isCreditsMeter}+ />+ {`· ${periodSpanLabel}`}+ </StyledTooltipRow>+ ) : (+ t`Nothing counted against this scope yet`+ )}+ </>+ }+ >+ <StyledRingAnchor id={RING_ANCHOR_ID}>+ <ProgressRing+ value={consumedPercentage}+ barColor={getUsageLimitRingColor({+ consumedPercentage,+ isExhausted,+ })}+ />+ </StyledRingAnchor>+ </Tooltip>)}/>- <AppTooltip- anchorSelect={`#${RING_ANCHOR_ID}`}- place="top"- delay={TooltipDelay.shortDelay}- positionStrategy="fixed"- >- {hasConsumption ? (- <StyledTooltipRow>- {t`Used`}- <SettingsBillingLimitAmount- text={consumedText}- isCreditsMeter={isCreditsMeter}- />- {`· ${periodSpanLabel}`}- </StyledTooltipRow>- ) : (- t`Nothing counted against this scope yet`- )}- </AppTooltip></StyledAmountField><StyledMeterRow><Selectdiff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitsTable.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitsTable.tsxindex fd796467f4c..56840a9e0f7 100644--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitsTable.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitsTable.tsx@@ -4,7 +4,7 @@ import { type ReactNode, useContext, useState } from 'react';import { SettingsPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { SearchInput } from 'twenty-ui/primitives/input';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { SettingsBillingLimitSpenderCell } from '@/settings/billing/components/SettingsBillingLimitSpenderCell';@@ -19,6 +19,7 @@ import { SettingsEmptyPlaceholder } from '@/settings/components/SettingsEmptyPlaimport { SettingsNameCellSecondaryLabel } from '@/settings/components/SettingsNameCellSecondaryLabel';import { SettingsTableListSection } from '@/settings/components/SettingsTableListSection';import { ProgressRingWithLabel } from '@/ui/feedback/progress-ring/components/ProgressRingWithLabel';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { type UsageResourceType } from '~/generated-metadata/graphql';import { useNavigateSettings } from '~/hooks/useNavigateSettings';@@ -96,18 +97,16 @@ const NameCell = ({ item }: { item: UsageLimitRow }) => {<StyledNameContainer><StyledName>{item.name}</StyledName>{!item.isEnforced && (- <>+ <Tooltip+ content={t`Limits on members, API keys and apps require the Organization plan.`}+ side="top"+ delay={TooltipDelay.shortDelay}+ positionMethod="fixed"+ ><SettingsNameCellSecondaryLabel id={deactivatedAnchorId}>{t`Deactivated`}</SettingsNameCellSecondaryLabel>- <AppTooltip- anchorSelect={`#${deactivatedAnchorId}`}- title={t`Limits on members, API keys and apps require the Organization plan.`}- place="top"- delay={TooltipDelay.shortDelay}- positionStrategy="fixed"- />- </>+ </Tooltip>)}</StyledNameContainer></StyledCell>@@ -120,24 +119,11 @@ const UsedCell = ({ item }: { item: UsageLimitRow }) => {const anchorId = `usage-limit-ring-${item.id}`;return (- <StyledUsed id={anchorId}>- {isDefined(item.consumedPercentage) ? (- <ProgressRingWithLabel- value={item.consumedPercentage}- barColor={getUsageLimitRingColor({- consumedPercentage: item.consumedPercentage,- isExhausted: item.isExhausted,- })}- />- ) : (- <StyledEmptyValue>—</StyledEmptyValue>- )}- <AppTooltip- anchorSelect={`#${anchorId}`}- place="top"- delay={TooltipDelay.shortDelay}- positionStrategy="fixed"- >+ <Tooltip+ side="top"+ delay={TooltipDelay.shortDelay}+ positionMethod="fixed"+ content={<StyledTooltipRows>{isDefined(item.consumedText) && (<StyledTooltipRow>@@ -156,8 +142,22 @@ const UsedCell = ({ item }: { item: UsageLimitRow }) => {/></StyledTooltipRow></StyledTooltipRows>- </AppTooltip>- </StyledUsed>+ }+ >+ <StyledUsed id={anchorId}>+ {isDefined(item.consumedPercentage) ? (+ <ProgressRingWithLabel+ value={item.consumedPercentage}+ barColor={getUsageLimitRingColor({+ consumedPercentage: item.consumedPercentage,+ isExhausted: item.isExhausted,+ })}+ />+ ) : (+ <StyledEmptyValue>—</StyledEmptyValue>+ )}+ </StyledUsed>+ </Tooltip>);};diff --git a/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingLabelValueItem.tsx b/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingLabelValueItem.tsxindex 5d55c8440c9..f2347a3fc81 100644--- a/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingLabelValueItem.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingLabelValueItem.tsx@@ -1,7 +1,8 @@+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { styled } from '@linaria/react';import { type ReactNode } from 'react';import { IconInfoCircle } from 'twenty-ui/icon';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';type SettingsBillingLabelValueItemProps = {@@ -56,17 +57,15 @@ export const SettingsBillingLabelValueItem = ({<StyledLabelWrapper><StyledLabelSpan>{label}</StyledLabelSpan>{tooltipText && tooltipId && (- <>+ <Tooltip+ content={tooltipText}+ arrow+ side="top"+ delay={TooltipDelay.shortDelay}+ positionMethod="fixed"+ ><StyledInfoIcon id={tooltipId} size={12} />- <AppTooltip- anchorSelect={`#${tooltipId}`}- title={tooltipText}- noArrow={false}- place="top"- delay={TooltipDelay.shortDelay}- positionStrategy="fixed"- />- </>+ </Tooltip>)}</StyledLabelWrapper><StyledValueSpan isPrimaryColor={isValueInPrimaryColor}>diff --git a/packages/twenty-front/src/modules/settings/components/SettingsNameCellSecondaryLabel.tsx b/packages/twenty-front/src/modules/settings/components/SettingsNameCellSecondaryLabel.tsxindex c70810e8be2..1ba13ec7047 100644--- a/packages/twenty-front/src/modules/settings/components/SettingsNameCellSecondaryLabel.tsx+++ b/packages/twenty-front/src/modules/settings/components/SettingsNameCellSecondaryLabel.tsx@@ -1,5 +1,4 @@import { styled } from '@linaria/react';-import { type ReactNode } from 'react';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -19,18 +18,5 @@ const StyledSettingsNameCellSecondaryLabel = styled.span`}`;-type SettingsNameCellSecondaryLabelProps = {- children: ReactNode;- title?: string;- id?: string;-};--export const SettingsNameCellSecondaryLabel = ({- children,- title,- id,-}: SettingsNameCellSecondaryLabelProps) => (- <StyledSettingsNameCellSecondaryLabel title={title} id={id}>- {children}- </StyledSettingsNameCellSecondaryLabel>-);+export const SettingsNameCellSecondaryLabel =+ StyledSettingsNameCellSecondaryLabel;diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm.tsxindex d43e1768bb7..c524d65b0a3 100644--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm.tsx@@ -13,11 +13,12 @@ import { IDENTIFIER_MAX_CHAR_LENGTH } from 'twenty-shared/metadata';import { getErrorMessageFromError } from '@/settings/data-model/fields/forms/utils/errorMessages';import { IconPicker } from '@/ui/input/components/IconPicker';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useLingui } from '@lingui/react/macro';import { FieldMetadataType } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { IconInfoCircle, IconRefresh } from 'twenty-ui/icon';-import { AppTooltip, Card, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip, Card } from 'twenty-ui/primitives/surfaces';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { computeMetadataNameFromLabel } from '~/pages/settings/data-model/utils/computeMetadataNameFromLabel';@@ -192,40 +193,37 @@ export const SettingsDataModelFieldIconLabelForm = ({control={control}defaultValue={fieldMetadataItem?.name}render={({ field: { onChange, value } }) => (- <>- <SettingsTextInput- instanceId={nameTextInputId}- label={t`API Name`}- placeholder={t`employees`}- value={value}- onChange={onChange}- readOnly={readonly}- disabled={!isNameEditEnabled}- fullWidth- maxLength={IDENTIFIER_MAX_CHAR_LENGTH}- RightIcon={() =>- apiNameTooltipText && (- <>+ <SettingsTextInput+ instanceId={nameTextInputId}+ label={t`API Name`}+ placeholder={t`employees`}+ value={value}+ onChange={onChange}+ readOnly={readonly}+ disabled={!isNameEditEnabled}+ fullWidth+ maxLength={IDENTIFIER_MAX_CHAR_LENGTH}+ RightIcon={() =>+ apiNameTooltipText && (+ <>+ <Tooltip+ content={apiNameTooltipText}+ sideOffset={5}+ side="bottom"+ positionMethod="fixed"+ delay={TooltipDelay.shortDelay}+ ><IconInfoCircleid="info-circle-id-name"size={theme.icon.size.md}color={theme.font.color.tertiary}style={{ outline: 'none' }}/>- <AppTooltip- anchorSelect="#info-circle-id-name"- title={apiNameTooltipText}- offset={5}- noArrow- place="bottom"- positionStrategy="fixed"- delay={TooltipDelay.shortDelay}- />- </>- )- }- />- </>+ </Tooltip>+ </>+ )+ }+ />)}/></StyledInputsContainer>diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsxindex 6d1c3c1e60a..fb6fc6a388b 100644--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsx@@ -16,6 +16,7 @@ import { TableRow } from '@/ui/layout/table/components/TableRow';import { useContext, useMemo } from 'react';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState';import { FieldMetadataType, SettingsPath } from 'twenty-shared/types';@@ -28,7 +29,7 @@ import {} from 'twenty-ui/icon';import { LightIconButton } from 'twenty-ui/primitives/input';import { UndecoratedLink } from 'twenty-ui/primitives/navigation';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { RelationType } from '~/generated-metadata/graphql';import { useNavigateSettings } from '~/hooks/useNavigateSettings';@@ -195,16 +196,14 @@ export const SettingsObjectFieldItemTableRow = ({</SettingsNameCellSecondaryLabel>)}{fieldMetadataItem.isActive && isMostlyEmpty && (- <>+ <Tooltip+ content={t`Appears filled in fewer than 5% of ${objectMetadataItem.labelPlural}. Fields that stay empty can be deactivated.`}+ delay={TooltipDelay.shortDelay}+ ><SettingsNameCellSecondaryLabel id={mostlyEmptyLabelId}>{t`Mostly empty`}</SettingsNameCellSecondaryLabel>- <AppTooltip- anchorSelect={`#${mostlyEmptyLabelId}`}- title={t`Appears filled in fewer than 5% of ${objectMetadataItem.labelPlural}. Fields that stay empty can be deactivated.`}- delay={TooltipDelay.shortDelay}- />- </>+ </Tooltip>)}</StyledNameContainer></TableCell>diff --git a/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx b/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsxindex 5e5f5049acc..a17351c9dac 100644--- a/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx@@ -8,6 +8,7 @@ import { type SettingsDataModelObjectAboutFormValues } from '@/settings/data-modimport { IconPicker } from '@/ui/input/components/IconPicker';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { TextArea } from '@/ui/input/components/TextArea';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { plural } from 'pluralize';@@ -17,7 +18,7 @@ import { SettingsPath } from 'twenty-shared/types';import { capitalize, isDefined } from 'twenty-shared/utils';import { InlineBanner } from 'twenty-ui/primitives/feedback';import { IconInfoCircle, IconLink, IconRefresh } from 'twenty-ui/icon';-import { AppTooltip, Card, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip, Card } from 'twenty-ui/primitives/surfaces';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { type StringKeyOf } from 'type-fest';import { useNavigateSettings } from '~/hooks/useNavigateSettings';@@ -336,21 +337,20 @@ export const SettingsDataModelObjectAboutForm = ({RightIcon={() =>tooltip && (<>- <IconInfoCircle- id={infoCircleElementId + fieldName}- size={theme.icon.size.md}- color={theme.font.color.tertiary}- style={{ outline: 'none' }}- />- <AppTooltip- anchorSelect={`#${infoCircleElementId}${fieldName}`}- title={tooltip}- offset={5}- noArrow- place="bottom"- positionStrategy="fixed"+ <Tooltip+ content={tooltip}+ sideOffset={5}+ side="bottom"+ positionMethod="fixed"delay={TooltipDelay.shortDelay}- />+ >+ <IconInfoCircle+ id={infoCircleElementId + fieldName}+ size={theme.icon.size.md}+ color={theme.font.color.tertiary}+ style={{ outline: 'none' }}+ />+ </Tooltip></>)}diff --git a/packages/twenty-front/src/modules/settings/mcp-and-apis/components/SettingsMcpSetupCard.tsx b/packages/twenty-front/src/modules/settings/mcp-and-apis/components/SettingsMcpSetupCard.tsxindex ac7a58c3c18..b26a9e9308e 100644--- a/packages/twenty-front/src/modules/settings/mcp-and-apis/components/SettingsMcpSetupCard.tsx+++ b/packages/twenty-front/src/modules/settings/mcp-and-apis/components/SettingsMcpSetupCard.tsx@@ -2,14 +2,10 @@ import { styled } from '@linaria/react';import { isDefined } from 'twenty-shared/utils';import { type McpSetupCard } from '@/settings/mcp-and-apis/types/McpSetup';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { Pill } from 'twenty-ui/primitives/data-display';import { IconExternalLink } from 'twenty-ui/icon';-import {- AppTooltip,- Card,- CardContent,- TooltipDelay,-} from 'twenty-ui/primitives/surfaces';+import { Tooltip, Card, CardContent } from 'twenty-ui/primitives/surfaces';import { themeCssVariables, useTheme } from 'twenty-ui/theme-constants';const StyledCardContent = styled(CardContent)`@@ -107,7 +103,15 @@ const SettingsMcpSetupCardAction = ({if (card.isDisabled === true) {return (- <>+ <Tooltip+ content={card.disabledTooltip}+ delay={TooltipDelay.shortDelay}+ side="bottom"+ positionMethod="fixed"+ disabled={+ !(isDefined(card.disabledTooltip) && isDefined(card.tooltipId))+ }+ ><StyledInstallActionas="span"aria-disabled="true"@@ -116,17 +120,7 @@ const SettingsMcpSetupCardAction = ({<IconExternalLink size={theme.icon.size.sm} />{card.ctaLabel}</StyledInstallAction>- {isDefined(card.disabledTooltip) && isDefined(card.tooltipId) && (- <AppTooltip- anchorSelect={`[data-tooltip-id='${card.tooltipId}']`}- title={card.disabledTooltip}- delay={TooltipDelay.shortDelay}- noArrow- place="bottom"- positionStrategy="fixed"- />- )}- </>+ </Tooltip>);}diff --git a/packages/twenty-front/src/modules/settings/profile/components/EmailField.tsx b/packages/twenty-front/src/modules/settings/profile/components/EmailField.tsxindex be663982704..a4c6dffd70b 100644--- a/packages/twenty-front/src/modules/settings/profile/components/EmailField.tsx+++ b/packages/twenty-front/src/modules/settings/profile/components/EmailField.tsx@@ -6,9 +6,10 @@ import { currentUserState } from '@/auth/states/currentUserState';import { useCanEditProfileField } from '@/settings/profile/hooks/useCanEditProfileField';import { useUpdateEmail } from '@/settings/profile/hooks/useUpdateEmail';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { IconCheck, IconPencil, IconX } from 'twenty-ui/icon';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { Button, ButtonGroup } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -40,9 +41,6 @@ const StyledActionButtonContainer = styled.div`justify-content: center;`;-const EMAIL_EDIT_DISABLED_TOOLTIP_ANCHOR_ID =- 'profile-email-edit-disabled-tooltip-anchor';-export const EmailField = () => {const { t } = useLingui();const currentUser = useAtomStateValue(currentUserState);@@ -126,31 +124,24 @@ export const EmailField = () => {</ButtonGroup>) : (<StyledActionWrapper key="view">- <StyledActionButtonContainer- id={- shouldShowWorkspaceLimitTooltip- ? EMAIL_EDIT_DISABLED_TOOLTIP_ANCHOR_ID- : undefined- }+ <Tooltip+ content={t`You can't change your email because you belong to 2 or more workspaces.`}+ delay={TooltipDelay.noDelay}+ side="top"+ disabled={!shouldShowWorkspaceLimitTooltip}>- <Button- startIcon={<IconPencil />}- aria-label={t`Edit`}- size="md"- onClick={handleStartEditing}- disabled={!canEdit}- type="button"- variant="outline"- />- </StyledActionButtonContainer>- {shouldShowWorkspaceLimitTooltip && (- <AppTooltip- anchorSelect={`#${EMAIL_EDIT_DISABLED_TOOLTIP_ANCHOR_ID}`}- title={t`You can't change your email because you belong to 2 or more workspaces.`}- delay={TooltipDelay.noDelay}- place="top"- />- )}+ <StyledActionButtonContainer>+ <Button+ startIcon={<IconPencil />}+ aria-label={t`Edit`}+ variant="outline"+ size="md"+ onClick={handleStartEditing}+ disabled={!canEdit}+ type="button"+ />+ </StyledActionButtonContainer>+ </Tooltip></StyledActionWrapper>)}</StyledFieldRow>diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/RoleAssignmentSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/RoleAssignmentSection.tsxindex 6e3c0402b3f..c812bbb6662 100644--- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/RoleAssignmentSection.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/RoleAssignmentSection.tsx@@ -5,7 +5,7 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';import { styled } from '@linaria/react';import { IconPlus } from 'twenty-ui/icon';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { Button } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -15,6 +15,7 @@ import {type RoleWithPartialMembers,} from '@/settings/roles/types/RoleWithPartialMembers';import { ROLE_TARGET_CONFIG } from '@/settings/roles/role-assignment/constants/RoleTargetConfig';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';const StyledAssignToMemberContainer = styled.div`display: flex;@@ -66,8 +67,14 @@ export const RoleAssignmentSection = ({dropdownId={config.dropdownId}dropdownOffset={{ x: 0, y: 4 }}clickableComponent={- <>- <div id={config.tooltip?.anchorId}>+ <Tooltip+ content={config.tooltip?.content()}+ delay={TooltipDelay.noDelay}+ disabled={+ !config.tooltip?.shouldShow(allWorkspaceMembersHaveThisRole)+ }+ >+ <div><ButtonstartIcon={<IconPlus />}size="sm"@@ -77,17 +84,7 @@ export const RoleAssignmentSection = ({{config.buttonTitle()}</Button></div>- {config.tooltip && (- <AppTooltip- anchorSelect={`#${config.tooltip.anchorId}`}- title={config.tooltip.content()}- delay={TooltipDelay.noDelay}- hidden={- !config.tooltip.shouldShow(allWorkspaceMembersHaveThisRole)- }- />- )}- </>+ </Tooltip>}dropdownComponents={roleTargetType === 'member' ? (diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelOverrideCell.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelOverrideCell.tsxindex cd2bb924aac..a222a632508 100644--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelOverrideCell.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelOverrideCell.tsx@@ -4,11 +4,12 @@ import { PermissionIcon } from '@/settings/roles/role-permissions/objects-permisimport { SETTINGS_ROLE_OBJECT_LEVEL_PERMISSION_TO_ROLE_OBJECT_PERMISSION_MAPPING } from '@/settings/roles/role-permissions/objects-permissions/constants/SettingsRoleObjectLevelPermissionToRoleObjectPermissionMapping';import { type SettingsRoleObjectPermissionKey } from '@/settings/roles/role-permissions/objects-permissions/constants/SettingsRoleObjectPermissionIconConfig';import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { isDefined } from 'twenty-shared/utils';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';const StyledContainer = styled.div`display: flex;@@ -65,25 +66,22 @@ export const SettingsRolePermissionsObjectLevelOverrideCell = ({const containerId = `object-level-permission-override-${roleId}-${objectPermissionKey}-${objectMetadataItem.id}`;return (- <>+ <Tooltip+ content={+ permissionValue === false+ ? t`${roleLabel} can't ${humanReadableAction} ${objectLabel} records`+ : t`${roleLabel} can ${humanReadableAction} ${objectLabel} records`+ }+ delay={TooltipDelay.shortDelay}+ side="bottom"+ positionMethod="fixed"+ ><StyledContainer id={containerId}><PermissionIconpermission={objectPermissionKey}state={permissionValue === false ? 'revoked' : 'granted'}/></StyledContainer>- <AppTooltip- anchorSelect={`#${containerId}`}- title={- permissionValue === false- ? t`${roleLabel} can't ${humanReadableAction} ${objectLabel} records`- : t`${roleLabel} can ${humanReadableAction} ${objectLabel} records`- }- delay={TooltipDelay.shortDelay}- noArrow- place="bottom"- positionStrategy="fixed"- />- </>+ </Tooltip>);};diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput.tsxindex a2189a5cb13..d8e5754d1f3 100644--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput.tsx@@ -6,7 +6,7 @@ import { useContext, useMemo } from 'react';import { FieldMetadataType, CoreObjectNameSingular } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { IconEraser } from 'twenty-ui/icon';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { type JsonValue } from 'type-fest';import { useFieldMetadataItemById } from '@/object-metadata/hooks/useFieldMetadataItemById';@@ -24,6 +24,7 @@ import { FormMultiSelectFieldInput } from '@/object-record/record-field/ui/form-import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState';import { type CompositeFieldType } from '@/settings/data-model/types/CompositeFieldType';import { createRecordLevelPermissionVariablePicker } from '@/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionVariablePicker';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';@@ -208,30 +209,27 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput =: 'Me';return (- <>- <StyledContainer>+ <StyledContainer>+ <Tooltip+ content={fullLabel}+ delay={TooltipDelay.shortDelay}+ side="bottom"+ positionMethod="fixed"+ ><StyledReadOnlyInput id={tooltipId}><StyledMeText>{t`Me`}</StyledMeText>{isDefined(workspaceMemberFieldLabel) && (<StyledFieldLabel>{` / ${workspaceMemberFieldLabel}`}</StyledFieldLabel>)}</StyledReadOnlyInput>- <StyledIconContainer- onClick={handleResetToStaticValue}- aria-label={t`Reset to static value`}- >- <IconEraser size={theme.icon.size.sm} />- </StyledIconContainer>- </StyledContainer>- <AppTooltip- anchorSelect={`#${tooltipId}`}- title={fullLabel}- delay={TooltipDelay.shortDelay}- noArrow- place="bottom"- positionStrategy="fixed"- />- </>+ </Tooltip>+ <StyledIconContainer+ onClick={handleResetToStaticValue}+ aria-label={t`Reset to static value`}+ >+ <IconEraser size={theme.icon.size.sm} />+ </StyledIconContainer>+ </StyledContainer>);}diff --git a/packages/twenty-front/src/modules/side-panel/components/SidePanelToggleButton.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelToggleButton.tsxindex fa5b52c8a5e..cbc87942abd 100644--- a/packages/twenty-front/src/modules/side-panel/components/SidePanelToggleButton.tsx+++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelToggleButton.tsx@@ -6,17 +6,14 @@ import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNaviimport { isLayoutCustomizationModeEnabledState } from '@/layout-customization/states/isLayoutCustomizationModeEnabledState';import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices';import { PAGE_HEADER_SIDE_PANEL_BUTTON_CLICK_OUTSIDE_ID } from '@/ui/layout/page-header/constants/PageHeaderSidePanelButtonClickOutsideId';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { SidePanelPages } from 'twenty-shared/types';import { IconDotsVertical } from 'twenty-ui/icon';import { IconButton } from 'twenty-ui/components';-import {- AppTooltip,- TooltipDelay,- TooltipPosition,-} from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { getOsControlSymbol, useIsMobile } from 'twenty-ui/utilities';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -32,10 +29,6 @@ const StyledButtonWrapper = styled.div<{ alignToTop: boolean }>`z-index: ${RootStackingContextZIndices.SidePanelButton};`;-const StyledTooltipWrapper = styled.div`- font-size: ${themeCssVariables.font.size.md};-`;-export const SidePanelToggleButton = () => {const { openSidePanelMenu } = useSidePanelMenu();const isSidePanelOpened = useAtomStateValue(isSidePanelOpenedState);@@ -77,32 +70,28 @@ export const SidePanelToggleButton = () => {return (<StyledButtonWrapper alignToTop={alignWithSidePanelTopBar}>- <div- id="toggle-side-panel-button"- data-click-outside-id={PAGE_HEADER_SIDE_PANEL_BUTTON_CLICK_OUTSIDE_ID}+ <Tooltip+ content={tooltipContent}+ delay={TooltipDelay.longDelay}+ side="bottom"+ sideOffset={5}>- <IconButton- data-testid="page-header-side-panel-button"- size="sm"- variant="outline"- color="neutral"- aria-label={ariaLabel}- onClick={openSidePanelMenu}+ <div+ id="toggle-side-panel-button"+ data-click-outside-id={PAGE_HEADER_SIDE_PANEL_BUTTON_CLICK_OUTSIDE_ID}>- <IconDotsVertical />- </IconButton>- </div>-- <StyledTooltipWrapper>- <AppTooltip- anchorSelect="#toggle-side-panel-button"- title={tooltipContent}- delay={TooltipDelay.longDelay}- place={TooltipPosition.Bottom}- offset={5}- noArrow- />- </StyledTooltipWrapper>+ <IconButton+ data-testid="page-header-side-panel-button"+ size="sm"+ variant="outline"+ color="neutral"+ aria-label={ariaLabel}+ onClick={openSidePanelMenu}+ >+ <IconDotsVertical />+ </IconButton>+ </div>+ </Tooltip></StyledButtonWrapper>);};diff --git a/packages/twenty-front/src/modules/side-panel/components/__tests__/SidePanelToggleButton.test.tsx b/packages/twenty-front/src/modules/side-panel/components/__tests__/SidePanelToggleButton.test.tsxindex 06d6b549b19..0491b90eee7 100644--- a/packages/twenty-front/src/modules/side-panel/components/__tests__/SidePanelToggleButton.test.tsx+++ b/packages/twenty-front/src/modules/side-panel/components/__tests__/SidePanelToggleButton.test.tsx@@ -3,6 +3,7 @@ import { I18nProvider } from '@lingui/react';import { fireEvent, render, screen } from '@testing-library/react';import { createStore, Provider as JotaiProvider } from 'jotai';import { MemoryRouter } from 'react-router-dom';+import userEvent from '@testing-library/user-event';import { isLayoutCustomizationModeEnabledState } from '@/layout-customization/states/isLayoutCustomizationModeEnabledState';import { SidePanelToggleButton } from '@/side-panel/components/SidePanelToggleButton';@@ -17,7 +18,6 @@ import { PAGE_HEADER_SIDE_PANEL_BUTTON_CLICK_OUTSIDE_ID } from '@/ui/layout/pageimport { SidePanelPages } from 'twenty-shared/types';import { IconDotsVertical } from 'twenty-ui/icon';-const mockAppTooltip = jest.fn();let mockIsMobile = false;jest.mock('twenty-ui/utilities', () => ({@@ -25,15 +25,6 @@ jest.mock('twenty-ui/utilities', () => ({getOsControlSymbol: () => '⌘',}));-jest.mock('twenty-ui/primitives/surfaces', () => ({- ...jest.requireActual('twenty-ui/primitives/surfaces'),- AppTooltip: (props: { title: string }) => {- mockAppTooltip(props);-- return null;- },-}));-const renderSidePanelToggleButton = ({isSidePanelOpened = false,sidePanelNavigationStack = [],@@ -78,7 +69,6 @@ const renderSidePanelToggleButton = ({describe('SidePanelToggleButton', () => {beforeEach(() => {- mockAppTooltip.mockClear();mockIsMobile = false;});@@ -219,14 +209,15 @@ describe('SidePanelToggleButton', () => {expect(screen.getByTestId('page-header-side-panel-button')).toBeVisible();});- it('shows the command menu keyboard shortcut in the tooltip', () => {+ it('shows the command menu keyboard shortcut in the tooltip', async () => {+ const user = userEvent.setup();renderSidePanelToggleButton();- expect(mockAppTooltip).toHaveBeenCalledWith(- expect.objectContaining({- title: 'Command menu | ⌘K',- }),- );+ await user.hover(screen.getByTestId('page-header-side-panel-button'));++ expect(+ await screen.findByRole('tooltip', {}, { timeout: 1500 }),+ ).toHaveTextContent('Command menu | ⌘K');});it('marks the command menu button as a click-outside exclusion', () => {diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/RegularTabSettingsContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/RegularTabSettingsContent.tsxindex 34ff633f5e1..71d5f837fb3 100644--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/RegularTabSettingsContent.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/RegularTabSettingsContent.tsx@@ -7,9 +7,10 @@ import { getTabSettingsPlacementItems } from '@/side-panel/pages/page-layout/utiimport { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useLingui } from '@lingui/react/macro';import { IconCopyPlus, IconRefreshDot, IconTrash } from 'twenty-ui/icon';-import { AppTooltip } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';const RESET_TAB_TO_DEFAULT_MODAL_ID = 'reset-regular-tab-to-default-modal';const RESET_TAB_TO_DEFAULT_MENU_ITEM_ID =@@ -90,28 +91,28 @@ export const RegularTabSettingsContent = ({onClick={onDuplicate}/></SelectableListItem>- <div id={RESET_TAB_TO_DEFAULT_MENU_ITEM_ID}>- <SelectableListItem- itemId={TAB_SETTINGS_SELECTABLE_ITEM_IDS.RESET_TO_DEFAULT}- onEnter={handleResetToDefault}- >- <CommandMenuItem- id={TAB_SETTINGS_SELECTABLE_ITEM_IDS.RESET_TO_DEFAULT}- Icon={IconRefreshDot}- label={t`Reset to default`}- onClick={handleResetToDefault}- disabled={isResetToDefaultDisabled}- />- </SelectableListItem>- </div>- {isResetToDefaultDisabled && (- <AppTooltip- anchorSelect={`#${RESET_TAB_TO_DEFAULT_MENU_ITEM_ID}`}- title={t`No default configuration available for this tab`}- noArrow- place="bottom"- />- )}+ <Tooltip+ delay={TooltipDelay.mediumDelay}+ content={t`No default configuration available for this tab`}+ side="bottom"+ disabled={!isResetToDefaultDisabled}+ >+ <div id={RESET_TAB_TO_DEFAULT_MENU_ITEM_ID}>+ <SelectableListItem+ itemId={TAB_SETTINGS_SELECTABLE_ITEM_IDS.RESET_TO_DEFAULT}+ onEnter={handleResetToDefault}+ >+ <CommandMenuItem+ id={TAB_SETTINGS_SELECTABLE_ITEM_IDS.RESET_TO_DEFAULT}+ Icon={IconRefreshDot}+ label={t`Reset to default`}+ onClick={handleResetToDefault}+ disabled={isResetToDefaultDisabled}+ />+ </SelectableListItem>+ </div>+ </Tooltip>+{canDelete && (<SelectableListItemitemId={TAB_SETTINGS_SELECTABLE_ITEM_IDS.DELETE}diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SingleWidgetTabSettingsContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SingleWidgetTabSettingsContent.tsxindex 90680bb6347..047bd1c6fee 100644--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SingleWidgetTabSettingsContent.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SingleWidgetTabSettingsContent.tsx@@ -12,9 +12,10 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContentimport { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useLingui } from '@lingui/react/macro';import { IconEyeX, IconRefreshDot, IconTrash } from 'twenty-ui/icon';-import { AppTooltip } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';const RESET_TAB_TO_DEFAULT_MODAL_ID ='reset-single-widget-tab-to-default-modal';@@ -117,28 +118,28 @@ export const SingleWidgetTabSettingsContent = ({contextualTextPosition="right"/></SelectableListItem>- <div id={RESET_TAB_TO_DEFAULT_MENU_ITEM_ID}>- <SelectableListItem- itemId={TAB_SETTINGS_SELECTABLE_ITEM_IDS.RESET_TO_DEFAULT}- onEnter={handleResetToDefault}- >- <CommandMenuItem- id={TAB_SETTINGS_SELECTABLE_ITEM_IDS.RESET_TO_DEFAULT}- Icon={IconRefreshDot}- label={t`Reset to default`}- onClick={handleResetToDefault}- disabled={isResetToDefaultDisabled}- />- </SelectableListItem>- </div>- {isResetToDefaultDisabled && (- <AppTooltip- anchorSelect={`#${RESET_TAB_TO_DEFAULT_MENU_ITEM_ID}`}- title={t`No default configuration available for this tab`}- noArrow- place="bottom"- />- )}+ <Tooltip+ delay={TooltipDelay.mediumDelay}+ content={t`No default configuration available for this tab`}+ side="bottom"+ disabled={!isResetToDefaultDisabled}+ >+ <div id={RESET_TAB_TO_DEFAULT_MENU_ITEM_ID}>+ <SelectableListItem+ itemId={TAB_SETTINGS_SELECTABLE_ITEM_IDS.RESET_TO_DEFAULT}+ onEnter={handleResetToDefault}+ >+ <CommandMenuItem+ id={TAB_SETTINGS_SELECTABLE_ITEM_IDS.RESET_TO_DEFAULT}+ Icon={IconRefreshDot}+ label={t`Reset to default`}+ onClick={handleResetToDefault}+ disabled={isResetToDefaultDisabled}+ />+ </SelectableListItem>+ </div>+ </Tooltip>+{canDelete && (<SelectableListItemitemId={TAB_SETTINGS_SELECTABLE_ITEM_IDS.DELETE}diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/WidgetSettingsManageSection.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/WidgetSettingsManageSection.tsxindex d4e0835cd71..e2acedd2825 100644--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/WidgetSettingsManageSection.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/WidgetSettingsManageSection.tsx@@ -14,6 +14,7 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContentimport { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useLingui } from '@lingui/react/macro';@@ -25,7 +26,7 @@ import {IconSwitchHorizontal,IconTrash,} from 'twenty-ui/icon';-import { AppTooltip } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';const RESET_WIDGET_TO_DEFAULT_MODAL_ID = 'reset-widget-to-default-modal';const RESET_WIDGET_TO_DEFAULT_MENU_ITEM_ID =@@ -109,28 +110,28 @@ export const WidgetSettingsManageSection = ({contextualTextPosition="right"/></SelectableListItem>- <div id={RESET_WIDGET_TO_DEFAULT_MENU_ITEM_ID}>- <SelectableListItem- itemId={WIDGET_SETTINGS_SELECTABLE_ITEM_IDS.RESET_TO_DEFAULT}- onEnter={handleResetToDefault}- >- <CommandMenuItem- id={WIDGET_SETTINGS_SELECTABLE_ITEM_IDS.RESET_TO_DEFAULT}- Icon={IconRefreshDot}- label={t`Reset to default`}- onClick={handleResetToDefault}- disabled={isResetToDefaultDisabled}- />- </SelectableListItem>- </div>- {isResetToDefaultDisabled && (- <AppTooltip- anchorSelect={`#${RESET_WIDGET_TO_DEFAULT_MENU_ITEM_ID}`}- title={t`No default configuration available for this widget`}- noArrow- place="bottom"- />- )}+ <Tooltip+ delay={TooltipDelay.mediumDelay}+ content={t`No default configuration available for this widget`}+ side="bottom"+ disabled={!isResetToDefaultDisabled}+ >+ <div id={RESET_WIDGET_TO_DEFAULT_MENU_ITEM_ID}>+ <SelectableListItem+ itemId={WIDGET_SETTINGS_SELECTABLE_ITEM_IDS.RESET_TO_DEFAULT}+ onEnter={handleResetToDefault}+ >+ <CommandMenuItem+ id={WIDGET_SETTINGS_SELECTABLE_ITEM_IDS.RESET_TO_DEFAULT}+ Icon={IconRefreshDot}+ label={t`Reset to default`}+ onClick={handleResetToDefault}+ disabled={isResetToDefaultDisabled}+ />+ </SelectableListItem>+ </div>+ </Tooltip>+<SelectableListItemitemId={WIDGET_SETTINGS_SELECTABLE_ITEM_IDS.REPLACE_WIDGET}onEnter={openReplaceWidgetPicker}diff --git a/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsxindex 1041d61582e..11d248608a0 100644--- a/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx@@ -8,27 +8,24 @@ import { SidePanelSearchRecordPreviewCard } from '@/side-panel/pages/search/compimport { SIDE_PANEL_SEARCH_RECORD_PREVIEW_WIDTH } from '@/side-panel/pages/search/constants/SidePanelSearchRecordPreviewWidth';import { useSidePanelSearchRecordPreviewItem } from '@/side-panel/pages/search/hooks/useSidePanelSearchRecordPreviewItem';import { useSidePanelSearchRecords } from '@/side-panel/pages/search/hooks/useSidePanelSearchRecords';-import { getSidePanelSearchResultAnchorId } from '@/side-panel/pages/search/utils/getSidePanelSearchResultAnchorId';import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';import { css } from '@linaria/core';import { useLingui } from '@lingui/react/macro';-import { useMemo } from 'react';+import { useMemo, useRef } from 'react';import { useNavigate } from 'react-router-dom';import { AppPath, CoreObjectNameSingular } from 'twenty-shared/types';import { getAppPath, isDefined } from 'twenty-shared/utils';import { Avatar } from 'twenty-ui/primitives/data-display';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';import { getAbsoluteImageUrl } from '~/utils/image/getAbsoluteImageUrl';// The card brings its own surface, so the tooltip only contributes the shadow.-// Tooltips render at 0.9 opacity, which would make the card translucent.const previewTooltipClass = css`background: transparent !important;border-radius: ${themeCssVariables.border.radius.md} !important;box-shadow: ${themeCssVariables.boxShadow.strong} !important;- opacity: 1 !important;padding: 0 !important;`;@@ -46,6 +43,8 @@ export const SidePanelSearchRecordsPage = () => {[searchResultItems],);+ const previewAnchorRef = useRef<HTMLDivElement>(null);+const previewedItem = useSidePanelSearchRecordPreviewItem(searchResultItems);const shouldDisplayPreview = !isMobile && isDefined(previewedItem);@@ -91,7 +90,13 @@ export const SidePanelSearchRecordsPage = () => {itemId={item.id}onEnter={handleClick}>- <div id={getSidePanelSearchResultAnchorId(item.id)}>+ <div+ ref={+ previewedItem?.id === item.id+ ? previewAnchorRef+ : undefined+ }+ ><CommandMenuItemid={item.id}label={item.label}@@ -115,24 +120,23 @@ export const SidePanelSearchRecordsPage = () => {</SidePanelList>{shouldDisplayPreview && (- <AppTooltip- anchorSelect={`#${getSidePanelSearchResultAnchorId(previewedItem.id)}`}- place="left-start"- offset={16}- noArrow- interactive- isOpen- delay={TooltipDelay.noDelay}- className={previewTooltipClass}- maxWidth={`${SIDE_PANEL_SEARCH_RECORD_PREVIEW_WIDTH}px`}- >- <SidePanelSearchRecordPreviewCard- key={previewedItem.recordId}- objectNameSingular={previewedItem.objectNameSingular}- recordId={previewedItem.recordId}- label={previewedItem.label}- />- </AppTooltip>+ <Tooltip.Root key={previewedItem.id} open>+ <Tooltip.Popup+ anchor={previewAnchorRef}+ side="left"+ align="start"+ sideOffset={16}+ className={previewTooltipClass}+ maxWidth={`${SIDE_PANEL_SEARCH_RECORD_PREVIEW_WIDTH}px`}+ >+ <SidePanelSearchRecordPreviewCard+ key={previewedItem.recordId}+ objectNameSingular={previewedItem.objectNameSingular}+ recordId={previewedItem.recordId}+ label={previewedItem.label}+ />+ </Tooltip.Popup>+ </Tooltip.Root>)}</>);diff --git a/packages/twenty-front/src/modules/side-panel/pages/search/utils/getSidePanelSearchResultAnchorId.ts b/packages/twenty-front/src/modules/side-panel/pages/search/utils/getSidePanelSearchResultAnchorId.tsdeleted file mode 100644index a4a68173ea5..00000000000--- a/packages/twenty-front/src/modules/side-panel/pages/search/utils/getSidePanelSearchResultAnchorId.ts+++ /dev/null@@ -1,2 +0,0 @@-export const getSidePanelSearchResultAnchorId = (itemId: string) =>- `side-panel-search-result-${itemId.replace(/[^a-zA-Z0-9-_]/g, '_')}`;diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/components/columns.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/components/columns.tsxindex b3a6d6ebcc9..a03df22def7 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/components/columns.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/components/columns.tsx@@ -2,7 +2,6 @@ import { t } from '@lingui/core/macro';import { styled } from '@linaria/react';import { themeCssVariables } from 'twenty-ui/theme-constants';import { type Column, useRowSelection } from 'react-data-grid';-import { createPortal } from 'react-dom';import {type ImportedStructuredRow,@@ -12,9 +11,10 @@ import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import camelCase from 'lodash.camelcase';import { isDefined } from 'twenty-shared/utils';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { Checkbox, Switch } from 'twenty-ui/primitives/input';import { type ImportedStructuredRowMetadata } from '@/spreadsheet-import/steps/components/ValidationStep/types';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';const StyledHeaderContainer = styled.div`align-items: center;@@ -124,20 +124,17 @@ export const generateColumns = (resizable: true,renderHeaderCell: () => (<StyledHeaderContainer>- <StyledHeaderLabel id={formatSafeId(column.key)}>- {column.label}- </StyledHeaderLabel>- <>- {column.description &&- createPortal(- <AppTooltip- anchorSelect={`#${formatSafeId(column.key)}`}- place="top"- title={column.description}- />,- document.body,- )}- </>+ <Tooltip+ side="top"+ content={column.description}+ delay={TooltipDelay.mediumDelay}+ disabled={!column.description}+ >+ <StyledHeaderLabel id={formatSafeId(column.key)}>+ {column.label}+ </StyledHeaderLabel>+ </Tooltip>+ <></></StyledHeaderContainer>),editable: column.fieldType.type !== 'checkbox',@@ -223,18 +220,13 @@ export const generateColumns = (if (isDefined(row.__errors?.[columnKey])) {return (- <>+ <Tooltip+ content={row.__errors?.[columnKey]?.message}+ side="top"+ delay={TooltipDelay.shortDelay}+ >{component}- {createPortal(- <AppTooltip- anchorSelect={`#${formatSafeId(`${columnKey}-${row.__index}`)}`}- place="top"- title={row.__errors?.[columnKey]?.message}- delay={TooltipDelay.shortDelay}- />,- document.body,- )}- </>+ </Tooltip>);}diff --git a/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx b/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsxindex 86e51e64160..29b8d2c7338 100644--- a/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx+++ b/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx@@ -1,11 +1,6 @@-import { useContext, useId, useState } from 'react';-import { createPortal } from 'react-dom';+import { useContext } from 'react';import { styled } from '@linaria/react';-import {- AppTooltip,- TooltipDelay,- TooltipPosition,-} from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { ThemeContext } from 'twenty-ui/theme-constants';import { isDefined, formatToShortNumber } from 'twenty-shared/utils';@@ -16,6 +11,7 @@ import {type FieldCurrencyValue,} from '@/object-record/record-field/ui/types/FieldMetadata';import { SETTINGS_FIELD_CURRENCY_CODES } from '@/settings/data-model/constants/SettingsFieldCurrencyCodes';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { EllipsisDisplay } from 'twenty-ui/primitives/data-display';import { DEFAULT_DECIMAL_VALUE } from '~/utils/format/formatNumber';import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';@@ -35,8 +31,6 @@ export const CurrencyDisplay = ({fieldDefinition,}: CurrencyDisplayProps) => {const { theme } = useContext(ThemeContext);- const instanceId = useId();- const [shouldRenderTooltip, setShouldRenderTooltip] = useState(false);const currencyCode = currencyValue?.currencyCode;const currencyMetadata = isDefined(currencyCode)@@ -53,7 +47,6 @@ export const CurrencyDisplay = ({const decimalsToUse = decimals ?? DEFAULT_DECIMAL_VALUE;const { formatNumber } = useNumberFormat();- const tooltipAnchorId = `currency-icon-${instanceId.replace(/[^a-zA-Z0-9-_]/g, '-')}`;const currencyTooltipContent = isDefined(currencyCode)? `${currencyCode}${currencyMetadata?.label ? ` - ${currencyMetadata.label}` : ''}`: undefined;@@ -63,41 +56,30 @@ export const CurrencyDisplay = ({isDefined(currencyTooltipContent);return (- <>- <EllipsisDisplay>- {shouldShowCurrencyTooltip && (- <>- <StyledCurrencyIconContainer- id={tooltipAnchorId}- onMouseEnter={() => setShouldRenderTooltip(true)}- onMouseLeave={() => setShouldRenderTooltip(false)}- >+ <EllipsisDisplay>+ {shouldShowCurrencyTooltip && (+ <>+ <Tooltip+ content={currencyTooltipContent}+ delay={TooltipDelay.shortDelay}+ side="top"+ positionMethod="fixed"+ >+ <StyledCurrencyIconContainer><CurrencyIconcolor={theme.font.color.primary}size={theme.icon.size.md}stroke={theme.icon.stroke.sm}/>- </StyledCurrencyIconContainer>{' '}- </>- )}- {amountToDisplay !== null- ? !isDefined(format) || format === 'short'- ? formatToShortNumber(amountToDisplay)- : formatNumber(amountToDisplay, { decimals: decimalsToUse })- : null}- </EllipsisDisplay>- {shouldRenderTooltip &&- shouldShowCurrencyTooltip &&- createPortal(- <AppTooltip- anchorSelect={`#${tooltipAnchorId}`}- title={currencyTooltipContent}- delay={TooltipDelay.shortDelay}- place={TooltipPosition.Top}- positionStrategy="fixed"- />,- document.body,- )}- </>+ </StyledCurrencyIconContainer>+ </Tooltip>{' '}+ </>+ )}+ {amountToDisplay !== null+ ? !isDefined(format) || format === 'short'+ ? formatToShortNumber(amountToDisplay)+ : formatNumber(amountToDisplay, { decimals: decimalsToUse })+ : null}+ </EllipsisDisplay>);};diff --git a/packages/twenty-front/src/modules/ui/layout/tooltip/constants/TooltipDelay.ts b/packages/twenty-front/src/modules/ui/layout/tooltip/constants/TooltipDelay.tsnew file mode 100644index 00000000000..16759ee0eb6--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/tooltip/constants/TooltipDelay.ts@@ -0,0 +1,6 @@+export enum TooltipDelay {+ noDelay = 0,+ shortDelay = 300,+ mediumDelay = 500,+ longDelay = 1000,+}diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton.tsxindex 44126e82028..87454504d0d 100644--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton.tsx+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton.tsx@@ -1,15 +1,11 @@import { useIsSettingsDrawer } from '@/navigation/hooks/useIsSettingsDrawer';import { useNavigationDrawerTogglePresentation } from '@/navigation/hooks/useNavigationDrawerTogglePresentation';import { useToggleNavigationDrawer } from '@/navigation/hooks/useToggleNavigationDrawer';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';import { styled } from '@linaria/react';-import { useId } from 'react';import { LightIconButton } from 'twenty-ui/primitives/input';-import {- AppTooltip,- TooltipDelay,- TooltipPosition,-} from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';const StyledCollapseButton = styled.div`@@ -34,7 +30,6 @@ export const NavigationDrawerCollapseButton = ({const isMobile = useIsMobile();const isSettingsDrawer = useIsSettingsDrawer();const { toggleNavigationDrawer } = useToggleNavigationDrawer();- const tooltipId = useId();const { label, Icon } = useNavigationDrawerTogglePresentation(direction === 'left',);@@ -45,22 +40,21 @@ export const NavigationDrawerCollapseButton = ({}return (- <StyledCollapseButton className={className} data-tooltip-id={tooltipId}>- <LightIconButton- Icon={Icon}- accent="secondary"- size="small"- onClick={toggleNavigationDrawer}- aria-label={label}- />- <AppTooltip- anchorSelect={`[data-tooltip-id='${tooltipId}'] > button`}- title={label}- delay={TooltipDelay.longDelay}- place={TooltipPosition.Bottom}- offset={5}- noArrow- />- </StyledCollapseButton>+ <Tooltip+ content={label}+ delay={TooltipDelay.longDelay}+ side="bottom"+ sideOffset={5}+ >+ <StyledCollapseButton className={className}>+ <LightIconButton+ Icon={Icon}+ accent="secondary"+ size="small"+ onClick={toggleNavigationDrawer}+ aria-label={label}+ />+ </StyledCollapseButton>+ </Tooltip>);};diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsxindex 32048c25fbd..16097b807d1 100644--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx@@ -1,3 +1,4 @@+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { NavigationDrawerItemEditingContext } from '@/ui/navigation/navigation-drawer/contexts/NavigationDrawerItemEditingContext';import { NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE } from '@/ui/navigation/navigation-drawer/constants/NavigationDrawerCollapsedButtonSize';import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';@@ -16,10 +17,8 @@ import { isDefined } from 'twenty-shared/utils';import { Pill } from 'twenty-ui/primitives/data-display';import { type IconComponent, type TablerIconsProps } from 'twenty-ui/icon';import {- AppTooltip,+ Tooltip,OverflowingTextWithTooltip,- TooltipDelay,- TooltipPosition,} from 'twenty-ui/primitives/surfaces';import { Label } from 'twenty-ui/primitives/typography';import {@@ -325,156 +324,154 @@ export const NavigationDrawerItem = ({return (<StyledNavigationDrawerItemContainer>- <StyledItem- id={navigationItemId}- className={`navigation-drawer-item ${className || ''}`}- onClick={(event) => {- if (- !(event.target instanceof Node) ||- !event.currentTarget.contains(event.target)- ) {- return;+ <Tooltip+ content={label}+ side="right"+ delay={TooltipDelay.noDelay}+ positionMethod="fixed"+ disabled={isExpanded || isMobile}+ >+ <StyledItem+ id={navigationItemId}+ className={`navigation-drawer-item ${className || ''}`}+ onClick={(event) => {+ if (+ !(event.target instanceof Node) ||+ !event.currentTarget.contains(event.target)+ ) {+ return;+ }+ handleMouseDownNavigationClickClick(event);+ }}+ onMouseDown={(event) => {+ if (+ !(event.target instanceof Node) ||+ !event.currentTarget.contains(event.target)+ ) {+ return;+ }+ handleMouseDown(event);+ }}+ active={active}+ aria-current={isDefined(to) && active ? 'page' : undefined}+ isSoon={isSoon}+ variant={variant}+ disabled={variant === 'placeholder'}+ indentationLevel={indentationLevel}+ isNavigationDrawerExpanded={isExpanded}+ isDragging={isDragging}+ hasRightOptions={isDefined(rightOptions)}+ isSelectedInEditMode={+ isSelectedInEditMode || editingContent?.isSelected}- handleMouseDownNavigationClickClick(event);- }}- onMouseDown={(event) => {- if (- !(event.target instanceof Node) ||- !event.currentTarget.contains(event.target)- ) {- return;+ as={elementType}+ role={+ !isDefined(editingContent) && !to && isDefined(rightOptions)+ ? 'button'+ : undefined}- handleMouseDown(event);- }}- active={active}- aria-current={isDefined(to) && active ? 'page' : undefined}- isSoon={isSoon}- variant={variant}- disabled={variant === 'placeholder'}- indentationLevel={indentationLevel}- isNavigationDrawerExpanded={isExpanded}- isDragging={isDragging}- hasRightOptions={isDefined(rightOptions)}- isSelectedInEditMode={- isSelectedInEditMode || editingContent?.isSelected- }- as={elementType}- role={- !isDefined(editingContent) && !to && isDefined(rightOptions)- ? 'button'- : undefined- }- to={isInternalLink ? to : undefined}- href={isExternalLink ? to : undefined}- target={isExternalLink ? '_blank' : undefined}- rel={isExternalLink ? 'noopener noreferrer' : undefined}- draggable={isInternalLink ? false : undefined}- >- <StyledItemElementsContainer>- {showBreadcrumb && (- <NavigationDrawerAnimatedCollapseWrapper>- <NavigationDrawerItemBreadcrumb state={subItemState} />- </NavigationDrawerAnimatedCollapseWrapper>- )}-- {editingContent ? (- <StyledIcon>{editingContent.icon}</StyledIcon>- ) : (- isDefined(Icon) && (- <StyledIcon>- <Icon- size={theme.icon.size.md}- stroke={theme.icon.stroke.md}- color={- showBreadcrumb && !isExpanded- ? theme.font.color.light- : 'currentColor'+ to={isInternalLink ? to : undefined}+ href={isExternalLink ? to : undefined}+ target={isExternalLink ? '_blank' : undefined}+ rel={isExternalLink ? 'noopener noreferrer' : undefined}+ draggable={isInternalLink ? false : undefined}+ >+ <StyledItemElementsContainer>+ {showBreadcrumb && (+ <NavigationDrawerAnimatedCollapseWrapper>+ <NavigationDrawerItemBreadcrumb state={subItemState} />+ </NavigationDrawerAnimatedCollapseWrapper>+ )}++ {editingContent ? (+ <StyledIcon>{editingContent.icon}</StyledIcon>+ ) : (+ isDefined(Icon) && (+ <StyledIcon>+ <Icon+ size={theme.icon.size.md}+ stroke={theme.icon.stroke.md}+ color={+ showBreadcrumb && !isExpanded+ ? theme.font.color.light+ : 'currentColor'+ }+ />+ </StyledIcon>+ )+ )}++ <StyledLabelParent>+ {editingContent?.label ?? (+ <OverflowingTextWithTooltip+ text={+ <>+ <StyledItemLabel>{label}</StyledItemLabel>+ {secondaryLabel && (+ <StyledItemSecondaryLabel>+ {' · '}+ {secondaryLabel}+ </StyledItemSecondaryLabel>+ )}+ </>+ }+ tooltipContent={+ secondaryLabel ? `${label} · ${secondaryLabel}` : label}/>- </StyledIcon>- )- )}-- <StyledLabelParent>- {editingContent?.label ?? (- <OverflowingTextWithTooltip- text={- <>- <StyledItemLabel>{label}</StyledItemLabel>- {secondaryLabel && (- <StyledItemSecondaryLabel>- {' · '}- {secondaryLabel}- </StyledItemSecondaryLabel>- )}- </>- }- tooltipContent={- secondaryLabel ? `${label} · ${secondaryLabel}` : label- }- />+ )}+ </StyledLabelParent>++ {showStyledSpacer && <StyledSpacer />}++ {isSoon && (+ <NavigationDrawerAnimatedCollapseWrapper>+ <Pill label={t`Soon`} />+ </NavigationDrawerAnimatedCollapseWrapper>+ )}++ {isNew && (+ <NavigationDrawerAnimatedCollapseWrapper>+ <Pill label={t`New`} />+ </NavigationDrawerAnimatedCollapseWrapper>+ )}++ {isDefined(keyboardKeys) && (+ <NavigationDrawerAnimatedCollapseWrapper>+ <StyledKeyBoardShortcut className="keyboard-shortcuts">+ <Label>{keyboardKeys}</Label>+ </StyledKeyBoardShortcut>+ </NavigationDrawerAnimatedCollapseWrapper>)}- </StyledLabelParent>-- {showStyledSpacer && <StyledSpacer />}-- {isSoon && (- <NavigationDrawerAnimatedCollapseWrapper>- <Pill label={t`Soon`} />- </NavigationDrawerAnimatedCollapseWrapper>- )}-- {isNew && (- <NavigationDrawerAnimatedCollapseWrapper>- <Pill label={t`New`} />- </NavigationDrawerAnimatedCollapseWrapper>- )}-- {isDefined(keyboardKeys) && (- <NavigationDrawerAnimatedCollapseWrapper>- <StyledKeyBoardShortcut className="keyboard-shortcuts">- <Label>{keyboardKeys}</Label>- </StyledKeyBoardShortcut>- </NavigationDrawerAnimatedCollapseWrapper>- )}-- {isDefined(rightOptions) && (- <NavigationDrawerAnimatedCollapseWrapper>- {/* When StyledItem renders as a Link, we need both handlers to++ {isDefined(rightOptions) && (+ <NavigationDrawerAnimatedCollapseWrapper>+ {/* When StyledItem renders as a Link, we need both handlers toprevent navigation when interacting with rightOptions:- onMouseDown: stops useMouseDownNavigation from calling navigate()- onClickCapture: prevents the native <a> follow since the child'sstopPropagation blocks Link's own preventDefault */}- <StyledRightOptionsContainer- onMouseDown={(e) => e.stopPropagation()}- onClickCapture={(e) => e.preventDefault()}- >- <StyledRightOptionsVisbility- data-visible={- isMobile ||- isRightOptionsDropdownOpen ||- alwaysShowRightOptions- ? 'true'- : undefined- }+ <StyledRightOptionsContainer+ onMouseDown={(e) => e.stopPropagation()}+ onClickCapture={(e) => e.preventDefault()}>- {rightOptions}- </StyledRightOptionsVisbility>- </StyledRightOptionsContainer>- </NavigationDrawerAnimatedCollapseWrapper>- )}- </StyledItemElementsContainer>- </StyledItem>-- {!isExpanded && !isMobile && (- <AppTooltip- anchorSelect={`#${navigationItemId}`}- title={label}- place={TooltipPosition.Right}- delay={TooltipDelay.noDelay}- positionStrategy="fixed"- />- )}+ <StyledRightOptionsVisbility+ data-visible={+ isMobile ||+ isRightOptionsDropdownOpen ||+ alwaysShowRightOptions+ ? 'true'+ : undefined+ }+ >+ {rightOptions}+ </StyledRightOptionsVisbility>+ </StyledRightOptionsContainer>+ </NavigationDrawerAnimatedCollapseWrapper>+ )}+ </StyledItemElementsContainer>+ </StyledItem>+ </Tooltip></StyledNavigationDrawerItemContainer>);};diff --git a/packages/twenty-front/src/modules/ui/suggestion/components/SuggestionMenu.tsx b/packages/twenty-front/src/modules/ui/suggestion/components/SuggestionMenu.tsxindex e2866f6a81d..1e6b4ad4704 100644--- a/packages/twenty-front/src/modules/ui/suggestion/components/SuggestionMenu.tsx+++ b/packages/twenty-front/src/modules/ui/suggestion/components/SuggestionMenu.tsx@@ -23,7 +23,7 @@ import { OverlayContainer } from '@/ui/layout/overlay/components/OverlayContaineimport type { SuggestionMenuProps } from '@/ui/suggestion/types/SuggestionMenuProps';import { getSuggestionMenuItemAnchorId } from '@/ui/suggestion/utils/getSuggestionMenuItemAnchorId';import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';// The preview card brings its own surface, so the tooltip only contributes@@ -32,7 +32,6 @@ const previewTooltipClass = css`background: transparent !important;border-radius: ${themeCssVariables.border.radius.md} !important;box-shadow: ${themeCssVariables.boxShadow.strong} !important;- opacity: 1 !important;padding: 0 !important;`;@@ -237,19 +236,18 @@ const SuggestionMenuInner = <TItem,>(</DropdownContent></OverlayContainer>{shouldDisplayPreview && (- <AppTooltip- anchorSelect={`#${getSuggestionMenuItemAnchorId(getItemKey(selectedItem))}`}- place="right-start"- offset={16}- noArrow- interactive- isOpen- delay={TooltipDelay.noDelay}- className={previewTooltipClass}- maxWidth={`${selectedItemPreview.width}px`}- >- {selectedItemPreview.render(selectedItem)}- </AppTooltip>+ <Tooltip.Root key={getItemKey(selectedItem)} open>+ <Tooltip.Popup+ anchor={activeItemRef}+ side="right"+ align="start"+ sideOffset={16}+ className={previewTooltipClass}+ maxWidth={`${selectedItemPreview.width}px`}+ >+ {selectedItemPreview.render(selectedItem)}+ </Tooltip.Popup>+ </Tooltip.Root>)}</motion.div>);diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdown.tsx b/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdown.tsxindex f1c3f20b2ac..175a3e6ad9f 100644--- a/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdown.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdown.tsx@@ -1,5 +1,6 @@import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { WorkflowVariablesDropdownStepItems } from '@/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems';import { WorkflowVariablesDropdownSteps } from '@/workflow/workflow-variables/components/WorkflowVariablesDropdownSteps';import { SEARCH_VARIABLES_DROPDOWN_ID } from '@/workflow/workflow-variables/constants/SearchVariablesDropdownId';@@ -13,11 +14,7 @@ import { styled } from '@linaria/react';import { useContext, useState } from 'react';import { isDefined } from 'twenty-shared/utils';import { IconVariablePlus } from 'twenty-ui/icon';-import {- AppTooltip,- TooltipDelay,- TooltipPosition,-} from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';const StyledDropdownVariableButtonContainer = styled.div<{@@ -98,7 +95,12 @@ export const WorkflowVariablesDropdown = ({if (disabled === true || noAvailableVariables) {return (- <>+ <Tooltip+ content={t`No variables are available yet. Variables come from the workflow trigger and previous steps.`}+ side="top"+ delay={TooltipDelay.mediumDelay}+ sideOffset={5}+ ><StyledDropdownVariableButtonContainerdisabled={true}data-variable-picker-disabled-anchor={dropdownId}@@ -108,15 +110,7 @@ export const WorkflowVariablesDropdown = ({color={theme.font.color.light}/></StyledDropdownVariableButtonContainer>- <AppTooltip- anchorSelect={`[data-variable-picker-disabled-anchor="${dropdownId}"]`}- title={t`No variables are available yet. Variables come from the workflow trigger and previous steps.`}- place={TooltipPosition.Top}- delay={TooltipDelay.mediumDelay}- offset={5}- noArrow- />- </>+ </Tooltip>);}diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone.tsxindex 5f4324853f6..f607265e332 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone.tsx@@ -1,6 +1,7 @@import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useMutation, useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';import { Trans, useLingui } from '@lingui/react/macro';@@ -16,7 +17,7 @@ import {SectionAlignment,SectionFontColor,} from 'twenty-ui/primitives/layout';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import {H1Title,H1TitleFontColor,@@ -207,24 +208,27 @@ export const SettingsAdminApplicationRegistrationDangerZone = ({description={t`Delete or transfer this app registration`}/><StyledDangerButtonGroup>- <Button- id={DELETE_REGISTRATION_BUTTON_ID}- startIcon={<IconTrash />}- disabled={hasActiveInstalls}- onClick={() => openModal(DELETE_REGISTRATION_MODAL_ID)}- variant="outline"- color="danger"- >{t`Delete app`}</Button>- {hasActiveInstalls && (- <AppTooltip- anchorSelect={`#${DELETE_REGISTRATION_BUTTON_ID}`}- title={t`Uninstall this app from all workspaces before deleting it`}- noArrow- place="bottom"- positionStrategy="fixed"- delay={TooltipDelay.shortDelay}- />- )}+ <Tooltip+ content={t`Uninstall this app from all workspaces before deleting it`}+ side="bottom"+ positionMethod="fixed"+ delay={TooltipDelay.shortDelay}+ disabled={!hasActiveInstalls}+ >+ <span tabIndex={hasActiveInstalls ? 0 : undefined}>+ <Button+ id={DELETE_REGISTRATION_BUTTON_ID}+ color="danger"+ variant="outline"+ startIcon={<IconTrash />}+ disabled={hasActiveInstalls}+ onClick={() => openModal(DELETE_REGISTRATION_MODAL_ID)}+ >+ {t`Delete app`}+ </Button>+ </span>+ </Tooltip>+{isUnclaimed? fromAdmin && (<Buttondiff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsxindex 697c61a6e12..edfc6404756 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx@@ -51,7 +51,6 @@ import { Section } from 'twenty-ui/primitives/layout';import {Card,OverflowingTextWithTooltip,- TooltipPosition,} from 'twenty-ui/primitives/surfaces';import { H2Title, Text } from 'twenty-ui/primitives/typography';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -262,7 +261,7 @@ export const SettingsAdminWorkspaceDetail = () => {<OverflowingTextWithTooltiptext={<>{item.label}</>}tooltipContent={item.id}- tooltipPlace={TooltipPosition.Top}+ tooltipPlace={'top'}alwaysShowTooltipisFocusable/>diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelTiersPreview.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelTiersPreview.tsxindex 4b08bda487e..eaf6d6aa5f9 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelTiersPreview.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelTiersPreview.tsx@@ -3,7 +3,7 @@ import { t } from '@lingui/core/macro';import { isDefined } from 'twenty-shared/utils';import { H2Title } from 'twenty-ui/primitives/typography';import { Section } from 'twenty-ui/primitives/layout';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';import { AiModelTierIndicator } from '@/ai/components/AiModelTierIndicator';@@ -15,6 +15,7 @@ import { Table } from '@/ui/layout/table/components/Table';import { TableCell } from '@/ui/layout/table/components/TableCell';import { TableHeader } from '@/ui/layout/table/components/TableHeader';import { TableRow } from '@/ui/layout/table/components/TableRow';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { formatNumber } from '~/utils/format/formatNumber';const GRID_TEMPLATE_COLUMNS = '1fr 1fr 1fr 1fr';@@ -24,15 +25,20 @@ const StyledInheritedValue = styled.span`color: ${themeCssVariables.font.color.light};`;-const INHERITED_BENCHMARK_CLASS_NAME = 'ai-model-tier-inherited-benchmark';--// The reading belongs to the base model, so it is dimmed and explained rather-// than passed off as a measurement at this effort.-const renderBenchmarkValue = (tier: ResolvedAiModelTier, value: string) =>+const renderBenchmarkValue = ({+ tier,+ value,+}: {+ tier: ResolvedAiModelTier;+ value: string;+}) =>(tier.model?.isBenchmarkInherited ?? false) && value !== EMPTY_VALUE ? (- <StyledInheritedValue className={INHERITED_BENCHMARK_CLASS_NAME}>- {value}- </StyledInheritedValue>+ <Tooltip+ content={t`Not measured at this effort yet. Showing the base model's reading.`}+ delay={TooltipDelay.shortDelay}+ >+ <StyledInheritedValue>{value}</StyledInheritedValue>+ </Tooltip>) : (value);@@ -80,56 +86,57 @@ export const SettingsAiModelTiersPreview = () => {<TableHeader align="right">{t`Intelligence`}</TableHeader><TableHeader align="right">{t`Output cost`}</TableHeader></TableRow>- {tiers.map((tier) => (- <TableRow key={tier.tier} gridTemplateColumns={GRID_TEMPLATE_COLUMNS}>- <TableCell color={themeCssVariables.font.color.primary}>- <StyledMode- data-tooltip-id={`ai-model-mode-${tier.tier}`}- tabIndex={0}- >- <AiModelTierIndicator tier={tier.tier} />- {tier.label}- </StyledMode>- <AppTooltip- anchorSelect={`[data-tooltip-id="ai-model-mode-${tier.tier}"]`}- Icon={- isDefined(tier.model)- ? getModelIcon(- tier.model.modelFamily,- tier.model.providerName,- )- : undefined- }- title={getAiModelModeDescription(tier, {- showAutomatic: false,+ {tiers.map((tier) => {+ const ModelIcon = isDefined(tier.model)+ ? getModelIcon(tier.model.modelFamily, tier.model.providerName)+ : undefined;+ return (+ <TableRow+ key={tier.tier}+ gridTemplateColumns={GRID_TEMPLATE_COLUMNS}+ >+ <TableCell color={themeCssVariables.font.color.primary}>+ <Tooltip+ delay={TooltipDelay.shortDelay}+ content={+ <Tooltip.Content+ startIcon={+ isDefined(ModelIcon) ? <ModelIcon /> : undefined+ }+ description={+ !isDefined(tier.model)+ ? t`No model is available for this mode.`+ : tier.isPinned+ ? t`Manually selected for this mode.`+ : t`Automatically selected by Twenty for this mode.`+ }+ >+ {getAiModelModeDescription(tier, {+ showAutomatic: false,+ })}+ </Tooltip.Content>+ }+ >+ <StyledMode tabIndex={0}>+ <AiModelTierIndicator tier={tier.tier} />+ {tier.label}+ </StyledMode>+ </Tooltip>+ </TableCell>+ <TableCell align="right">+ {renderBenchmarkValue({ tier, value: formatSpeed(tier) })}+ </TableCell>+ <TableCell align="right">+ {renderBenchmarkValue({+ tier,+ value: formatIntelligence(tier),})}- description={- !isDefined(tier.model)- ? t`No model is available for this mode.`- : tier.isPinned- ? t`Manually selected for this mode.`- : t`Automatically selected by Twenty for this mode.`- }- delay={TooltipDelay.shortDelay}- />- </TableCell>- <TableCell align="right">- {renderBenchmarkValue(tier, formatSpeed(tier))}- </TableCell>- <TableCell align="right">- {renderBenchmarkValue(tier, formatIntelligence(tier))}- </TableCell>- <TableCell align="right">{formatCost(tier)}</TableCell>- </TableRow>- ))}+ </TableCell>+ <TableCell align="right">{formatCost(tier)}</TableCell>+ </TableRow>+ );+ })}</StyledTable>- {tiers.some((tier) => tier.model?.isBenchmarkInherited ?? false) && (- <AppTooltip- anchorSelect={`.${INHERITED_BENCHMARK_CLASS_NAME}`}- title={t`Not measured at this effort yet. Showing the base model's reading.`}- delay={TooltipDelay.shortDelay}- />- )}</Section>);};diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillFormContent.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillFormContent.tsxindex 045f021beee..a1982bc47c8 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillFormContent.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillFormContent.tsx@@ -5,7 +5,7 @@ import { SettingsPath } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import { IconInfoCircle, IconRefresh, useIcons } from 'twenty-ui/icon';import { Section } from 'twenty-ui/primitives/layout';-import { AppTooltip, Card, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip, Card } from 'twenty-ui/primitives/surfaces';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { H2Title } from 'twenty-ui/primitives/typography';@@ -20,6 +20,7 @@ import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayimport { IconPicker } from '@/ui/input/components/IconPicker';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { TextArea } from '@/ui/input/components/TextArea';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { type FindOneSkillQuery } from '~/generated-metadata/graphql';import { useNavigateSettings } from '~/hooks/useNavigateSettings';import { SettingsSkillDangerZone } from '~/pages/settings/ai/components/SettingsSkillDangerZone';@@ -232,23 +233,20 @@ export const SettingsSkillFormContent = ({fullWidthRightIcon={() =>apiNameTooltipText && (- <>+ <Tooltip+ content={apiNameTooltipText}+ sideOffset={5}+ side="bottom"+ positionMethod="fixed"+ delay={TooltipDelay.shortDelay}+ ><IconInfoCircleid="info-circle-id-skill-name"size={theme.icon.size.md}color={theme.font.color.tertiary}style={{ outline: 'none' }}/>- <AppTooltip- anchorSelect="#info-circle-id-skill-name"- title={apiNameTooltipText}- offset={5}- noArrow- place="bottom"- positionStrategy="fixed"- delay={TooltipDelay.shortDelay}- />- </>+ </Tooltip>)}/>diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsToolParameterTable.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsToolParameterTable.tsxindex 8ba990f3533..fe20913d96b 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsToolParameterTable.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsToolParameterTable.tsx@@ -10,6 +10,7 @@ import { Table } from '@/ui/layout/table/components/Table';import { TableCell } from '@/ui/layout/table/components/TableCell';import { TableHeader } from '@/ui/layout/table/components/TableHeader';import { TableRow } from '@/ui/layout/table/components/TableRow';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import {IconArrowUpRight,IconInfoCircle,@@ -22,9 +23,8 @@ import {IllustrationIconToggle,} from 'twenty-ui/icon';import {- AppTooltip,+ Tooltip,OverflowingTextWithTooltip,- TooltipDelay,} from 'twenty-ui/primitives/surfaces';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';@@ -149,21 +149,20 @@ export const SettingsToolParameterTable = ({<TableCell>{property.description && (<StyledInfoIconContainer>- <IconInfoCircle- id={infoIconId}- size={theme.icon.size.md}- color={theme.font.color.tertiary}- style={{ outline: 'none', cursor: 'pointer' }}- />- <AppTooltip- anchorSelect={`#${infoIconId}`}- title={property.description}- offset={5}- noArrow- place="bottom"- positionStrategy="fixed"+ <Tooltip+ content={property.description}+ sideOffset={5}+ side="bottom"+ positionMethod="fixed"delay={TooltipDelay.shortDelay}- />+ >+ <IconInfoCircle+ id={infoIconId}+ size={theme.icon.size.md}+ color={theme.font.color.tertiary}+ style={{ outline: 'none', cursor: 'pointer' }}+ />+ </Tooltip></StyledInfoIconContainer>)}</TableCell>diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationVariableLabelRow.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationVariableLabelRow.tsxindex 37a5015a952..8388906fcd8 100644--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationVariableLabelRow.tsx+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationVariableLabelRow.tsx@@ -1,10 +1,11 @@+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';import { useContext } from 'react';import { Pill } from 'twenty-ui/primitives/data-display';import { IconInfoCircle } from 'twenty-ui/icon';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';const StyledLabelRow = styled.div`@@ -41,23 +42,20 @@ export const SettingsApplicationVariableLabelRow = ({<StyledLabel>{isNonEmptyString(label) ? label : variableKey}</StyledLabel>{isDeprecated && <Pill label={t`Deprecated`} />}{isNonEmptyString(description) && (- <>+ <Tooltip+ content={description}+ sideOffset={5}+ side="bottom"+ positionMethod="fixed"+ delay={TooltipDelay.shortDelay}+ ><IconInfoCircleid={tooltipId}size={theme.icon.size.sm}color={theme.font.color.tertiary}style={{ outline: 'none', cursor: 'pointer' }}/>- <AppTooltip- anchorSelect={`#${tooltipId}`}- title={description}- offset={5}- noArrow- place="bottom"- positionStrategy="fixed"- delay={TooltipDelay.shortDelay}- />- </>+ </Tooltip>)}</StyledLabelRow>);diff --git a/packages/twenty-front/src/pages/settings/enterprise/components/OrganizationAdornment.tsx b/packages/twenty-front/src/pages/settings/enterprise/components/OrganizationAdornment.tsxindex 018e8b9ee80..513275d3484 100644--- a/packages/twenty-front/src/pages/settings/enterprise/components/OrganizationAdornment.tsx+++ b/packages/twenty-front/src/pages/settings/enterprise/components/OrganizationAdornment.tsx@@ -1,15 +1,15 @@import { t } from '@lingui/core/macro';import { css, cx } from '@linaria/core';import { isNonEmptyString } from '@sniptt/guards';-import { useId } from 'react';import { Link } from 'react-router-dom';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath } from 'twenty-shared/utils';import { IconLock } from 'twenty-ui/icon';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';import { billingState } from '@/client-config/states/billingState';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';const pillClassName = css`@@ -50,19 +50,15 @@ export const OrganizationAdornment = ({}: OrganizationAdornmentProps) => {const billing = useAtomStateValue(billingState);const isBillingEnabled = billing?.isBillingEnabled ?? false;- // useId returns a colon-wrapped value that is not a valid CSS selector- const anchorId = `organization-adornment-${useId().replace(/:/g, '')}`;-const adornment = isBillingEnabled ? (<Link- id={anchorId}className={cx(pillClassName, pillLinkClassName)}to={getSettingsPath(SettingsPath.BillingPlans)}><OrganizationAdornmentContent /></Link>) : (- <span id={anchorId} className={pillClassName}>+ <span className={pillClassName}><OrganizationAdornmentContent /></span>);@@ -72,16 +68,13 @@ export const OrganizationAdornment = ({}return (- <>+ <Tooltip+ content={tooltipContent}+ delay={TooltipDelay.shortDelay}+ side="top"+ maxWidth="260px"+ >{adornment}- <AppTooltip- anchorSelect={`#${anchorId}`}- title={tooltipContent}- delay={TooltipDelay.shortDelay}- place="top"- maxWidth="260px"- interactive- />- </>+ </Tooltip>);};diff --git a/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersInviteTab.tsx b/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersInviteTab.tsxindex 0b376cfa37c..b5649e84c41 100644--- a/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersInviteTab.tsx+++ b/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersInviteTab.tsx@@ -7,6 +7,7 @@ import { Table } from '@/ui/layout/table/components/Table';import { TableCell } from '@/ui/layout/table/components/TableCell';import { TableHeader } from '@/ui/layout/table/components/TableHeader';import { TableRow } from '@/ui/layout/table/components/TableRow';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useDeleteWorkspaceInvitation } from '@/workspace-invitation/hooks/useDeleteWorkspaceInvitation';import { useResendWorkspaceInvitation } from '@/workspace-invitation/hooks/useResendWorkspaceInvitation';@@ -23,7 +24,7 @@ import { IconMail, IconReload, IconTrash } from 'twenty-ui/icon';import { Status } from 'twenty-ui/primitives/data-display';import { IconButton } from 'twenty-ui/components';import { Section } from 'twenty-ui/primitives/layout';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { H2Title } from 'twenty-ui/primitives/typography';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { GetWorkspaceInvitationsDocument } from '~/generated-metadata/graphql';@@ -179,19 +180,18 @@ export const SettingsWorkspaceMembersInviteTab = () => {stroke={theme.icon.stroke.sm}/></StyledIconWrapper>- <StyledTextContainerWithEllipsis- id={`invitation-email-${workspaceInvitation.id}`}- >- {workspaceInvitation.email}- </StyledTextContainerWithEllipsis>- <AppTooltip- anchorSelect={`#invitation-email-${workspaceInvitation.id}`}- title={workspaceInvitation.email}- noArrow- place="top"- positionStrategy="fixed"+ <Tooltip+ content={workspaceInvitation.email}+ side="top"+ positionMethod="fixed"delay={TooltipDelay.shortDelay}- />+ >+ <StyledTextContainerWithEllipsis+ id={`invitation-email-${workspaceInvitation.id}`}+ >+ {workspaceInvitation.email}+ </StyledTextContainerWithEllipsis>+ </Tooltip></TableCell><TableCell minWidth="0" overflow="hidden"><StyledTextContainerWithEllipsis>diff --git a/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersTeamTab.tsx b/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersTeamTab.tsxindex fb63d84d882..1a353c83bba 100644--- a/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersTeamTab.tsx+++ b/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersTeamTab.tsx@@ -1,3 +1,4 @@+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { styled } from '@linaria/react';import { Trans, useLingui } from '@lingui/react/macro';@@ -27,7 +28,7 @@ import {IconHierarchy,IconListDetails,} from 'twenty-ui/icon';-import { AppTooltip, TooltipDelay } from 'twenty-ui/primitives/surfaces';+import { Tooltip } from 'twenty-ui/primitives/surfaces';import { H2Title } from 'twenty-ui/primitives/typography';import { Button, SearchInput } from 'twenty-ui/primitives/input';import { Section } from 'twenty-ui/primitives/layout';@@ -255,21 +256,20 @@ export const SettingsWorkspaceMembersTeamTab = () => {size="sm"/></StyledIconWrapper>- <StyledTextContainerWithEllipsis- id={`hover-text-${workspaceMember.id}`}- >- {workspaceMember.name.firstName +- ' ' +- workspaceMember.name.lastName}- </StyledTextContainerWithEllipsis>- <AppTooltip- anchorSelect={`#hover-text-${workspaceMember.id}`}- title={`${workspaceMember.name.firstName} ${workspaceMember.name.lastName}`}- noArrow- place="top"- positionStrategy="fixed"+ <Tooltip+ content={`${workspaceMember.name.firstName} ${workspaceMember.name.lastName}`}+ side="top"+ positionMethod="fixed"delay={TooltipDelay.shortDelay}- />+ >+ <StyledTextContainerWithEllipsis+ id={`hover-text-${workspaceMember.id}`}+ >+ {workspaceMember.name.firstName ++ ' ' ++ workspaceMember.name.lastName}+ </StyledTextContainerWithEllipsis>+ </Tooltip></TableCell><TableCell><StyledTextContainerWithEllipsis>diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.tsindex bccb70ec5c6..fc7ecd98886 100644--- a/packages/twenty-ui/docs/components.ts+++ b/packages/twenty-ui/docs/components.ts@@ -6,6 +6,8 @@ import { CHIP_PROP_DESCRIPTIONS } from './chipPropDescriptions';import { LIGHT_BUTTON_PROP_DESCRIPTIONS } from './lightButtonPropDescriptions';import { STATUS_PROP_DESCRIPTIONS } from './statusPropDescriptions';import { TAG_PROP_DESCRIPTIONS } from './tagPropDescriptions';+import { TOOLTIP_PART_PROP_DESCRIPTIONS } from './tooltipPartPropDescriptions';+import { TOOLTIP_PROP_DESCRIPTIONS } from './tooltipPropDescriptions';export const DOCUMENTED_COMPONENTS = [{@@ -133,6 +135,16 @@ export const DOCUMENTED_COMPONENTS = [entryPoint: 'twenty-ui/primitives/surfaces',slug: 'surfaces/popover',},+ {+ name: 'Tooltip',+ source: 'primitives/surfaces/Tooltip/Tooltip.tsx',+ entryPoint: 'twenty-ui/primitives/surfaces',+ slug: 'surfaces/tooltip',+ parts: ['Root', 'Trigger', 'Popup', 'Content', 'Provider'],+ propDescriptions: TOOLTIP_PROP_DESCRIPTIONS,+ propDefaults: { sideOffset: '10' },+ partPropDescriptions: TOOLTIP_PART_PROP_DESCRIPTIONS,+ },{name: 'Toast',source: 'primitives/feedback/Toast/Toast.tsx',diff --git a/packages/twenty-ui/docs/tooltipPartPropDescriptions.ts b/packages/twenty-ui/docs/tooltipPartPropDescriptions.tsnew file mode 100644index 00000000000..fabb5432c52--- /dev/null+++ b/packages/twenty-ui/docs/tooltipPartPropDescriptions.ts@@ -0,0 +1,13 @@+import { TOOLTIP_PROP_DESCRIPTIONS } from './tooltipPropDescriptions';++export const TOOLTIP_PART_PROP_DESCRIPTIONS = {+ Popup: {+ ...TOOLTIP_PROP_DESCRIPTIONS,+ children: 'Content displayed inside the popup.',+ },+ Content: {+ children: 'Primary text displayed in the tooltip.',+ description: 'Secondary explanation beneath the primary text.',+ startIcon: 'An icon displayed before the text.',+ },+};diff --git a/packages/twenty-ui/docs/tooltipPropDescriptions.ts b/packages/twenty-ui/docs/tooltipPropDescriptions.tsnew file mode 100644index 00000000000..bf720e9a3b3--- /dev/null+++ b/packages/twenty-ui/docs/tooltipPropDescriptions.ts@@ -0,0 +1,27 @@+export const TOOLTIP_PROP_DESCRIPTIONS = {+ children:+ 'A single trigger element. Custom components must forward their ref, native attributes, and event handlers.',+ content: 'Supplementary content displayed in the tooltip.',+ delay: 'Delay in milliseconds before opening on hover. Defaults to 600.',+ closeDelay:+ 'Delay in milliseconds before closing after hover ends. Defaults to 0.',+ side: 'Preferred side of the trigger. Defaults to top and may change to avoid collisions.',+ align: 'Alignment relative to the trigger. Defaults to center.',+ sideOffset: 'Distance from the trigger in pixels. Defaults to 10.',+ alignOffset: 'Offset along the alignment axis in pixels.',+ arrow: 'Displays an arrow pointing to the trigger. Defaults to false.',+ maxWidth: 'Maximum popup width. Defaults to 300 pixels.',+ positionMethod: 'CSS positioning method for the popup.',+ open: 'Controlled visibility of the tooltip.',+ defaultOpen: 'Initial visibility when the tooltip manages its own state.',+ onOpenChange: 'Called when an interaction requests a visibility change.',+ disabled: 'Prevents the tooltip from opening.',+ disableHoverablePopup:+ 'Prevents hovering over the popup from keeping it open.',+ className: 'Additional CSS class for the popup.',+ style: 'Inline styles for the popup.',+ ref: 'Ref forwarded to the popup element.',+ container: 'Portal destination. Defaults to the current theme container.',+ keepMounted: 'Keeps the popup mounted while closed.',+ anchor: 'An explicit positioning anchor for the popup.',+};diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex 0349b06add5..f9d4c1a4826 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -11,6 +11,13 @@"defaultValue": null,"description": "Required accessible name describing the action."},+ {+ "name": "children",+ "type": "ReactNode",+ "required": true,+ "defaultValue": null,+ "description": "Icon content. Decorative and hidden from assistive technology."+ },{"name": "className","type": "string | ((state: ButtonState) => string | undefined)",@@ -76,9 +83,9 @@},{"name": "tooltipDelay",- "type": "\"0ms\" | \"300ms\" | \"500ms\" | \"1000ms\"",+ "type": "number","required": false,- "defaultValue": "TooltipDelay.longDelay",+ "defaultValue": "1000","description": "Delay before showing the tooltip."},{@@ -90,9 +97,9 @@},{"name": "tooltipPlace",- "type": "\"top\" | \"left\" | \"right\" | \"bottom\"",+ "type": "\"top\" | \"right\" | \"bottom\" | \"left\"","required": false,- "defaultValue": "TooltipPosition.Bottom",+ "defaultValue": "bottom","description": "Preferred placement of the tooltip relative to the button."},{@@ -1519,7 +1526,7 @@},{"name": "side",- "type": "\"top\" | \"bottom\" | \"left\" | \"right\" | \"inline-end\" | \"inline-start\"",+ "type": "\"top\" | \"right\" | \"bottom\" | \"left\" | \"inline-end\" | \"inline-start\"","required": false,"defaultValue": "bottom","description": "Which side of the anchor element to align the popup against.\nMay automatically change to avoid collisions."@@ -3093,7 +3100,7 @@},{"name": "side",- "type": "\"top\" | \"bottom\" | \"left\" | \"right\" | \"inline-end\" | \"inline-start\"",+ "type": "\"top\" | \"right\" | \"bottom\" | \"left\" | \"inline-end\" | \"inline-start\"","required": false,"defaultValue": null,"description": "Side of the anchor the popup is placed on. Defaults to `bottom` for a menu\nand `inline-end` for a submenu."@@ -4036,7 +4043,7 @@},{"name": "side",- "type": "\"top\" | \"bottom\" | \"left\" | \"right\" | \"inline-end\" | \"inline-start\"",+ "type": "\"top\" | \"right\" | \"bottom\" | \"left\" | \"inline-end\" | \"inline-start\"","required": false,"defaultValue": "bottom","description": "Side of the anchor the popup is placed on."@@ -4144,6 +4151,586 @@}]},+ {+ "name": "Tooltip",+ "entryPoint": "twenty-ui/primitives/surfaces",+ "slug": "surfaces/tooltip",+ "props": [+ {+ "name": "actionsRef",+ "type": "RefObject<TooltipRootActions | null>",+ "required": false,+ "defaultValue": null,+ "description": "A ref to imperative actions.\n- `unmount`: Unmounts the tooltip popup.\n- `close`: Closes the tooltip imperatively when called."+ },+ {+ "name": "align",+ "type": "\"center\" | \"start\" | \"end\"",+ "required": false,+ "defaultValue": null,+ "description": "Alignment relative to the trigger. Defaults to center."+ },+ {+ "name": "alignOffset",+ "type": "number | OffsetFunction",+ "required": false,+ "defaultValue": "0",+ "description": "Offset along the alignment axis in pixels."+ },+ {+ "name": "anchor",+ "type": "Element | VirtualElement | RefObject<Element | null> | (() => Element | VirtualElement | null) | null",+ "required": false,+ "defaultValue": null,+ "description": "An explicit positioning anchor for the popup."+ },+ {+ "name": "arrow",+ "type": "boolean",+ "required": false,+ "defaultValue": null,+ "description": "Displays an arrow pointing to the trigger. Defaults to false."+ },+ {+ "name": "children",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>>",+ "required": true,+ "defaultValue": null,+ "description": "A single trigger element. Custom components must forward their ref, native attributes, and event handlers."+ },+ {+ "name": "className",+ "type": "string | ((state: TooltipPopupState) => string | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "Additional CSS class for the popup."+ },+ {+ "name": "closeDelay",+ "type": "number",+ "required": false,+ "defaultValue": "0",+ "description": "Delay in milliseconds before closing after hover ends. Defaults to 0."+ },+ {+ "name": "closeOnClick",+ "type": "boolean",+ "required": false,+ "defaultValue": "true",+ "description": "Whether the tooltip should close when this trigger is clicked."+ },+ {+ "name": "collisionAvoidance",+ "type": "CollisionAvoidance",+ "required": false,+ "defaultValue": null,+ "description": "Determines how to handle collisions when positioning the popup.\n\n`side` controls overflow on the preferred placement axis (`top`/`bottom` or `left`/`right`):\n- `'flip'`: keep the requested side when it fits; otherwise try the opposite side\n (`top` and `bottom`, or `left` and `right`).\n- `'shift'`: never change side; keep the requested side and move the popup within\n the clipping boundary so it stays visible.\n- `'none'`: do not correct side-axis overflow.\n\n`align` controls overflow on the alignment axis (`start`/`center`/`end`):\n- `'flip'`: keep side, but swap `start` and `end` when the requested alignment overflows.\n- `'shift'`: keep side and requested alignment, then nudge the popup along the\n alignment axis to fit.\n- `'none'`: do not correct alignment-axis overflow.\n\n`fallbackAxisSide` controls fallback behavior on the perpendicular axis when the\npreferred axis cannot fit:\n- `'start'`: allow perpendicular fallback and try the logical start side first\n (`top` before `bottom`, or `left` before `right` in LTR).\n- `'end'`: allow perpendicular fallback and try the logical end side first\n (`bottom` before `top`, or `right` before `left` in LTR).\n- `'none'`: do not fallback to the perpendicular axis.\n\nWhen `side` is `'shift'`, explicitly setting `align` only supports `'shift'` or `'none'`.\nIf `align` is omitted, it defaults to `'flip'`."+ },+ {+ "name": "collisionBoundary",+ "type": "Boundary",+ "required": false,+ "defaultValue": "clipping-ancestors",+ "description": "An element or a rectangle that delimits the area that the popup is confined to."+ },+ {+ "name": "collisionPadding",+ "type": "Padding",+ "required": false,+ "defaultValue": "5",+ "description": "Additional space to maintain from the edge of the collision boundary."+ },+ {+ "name": "container",+ "type": "HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null",+ "required": false,+ "defaultValue": null,+ "description": "Portal destination. Defaults to the current theme container."+ },+ {+ "name": "content",+ "type": "ReactNode",+ "required": true,+ "defaultValue": null,+ "description": "Supplementary content displayed in the tooltip."+ },+ {+ "name": "defaultOpen",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Initial visibility when the tooltip manages its own state."+ },+ {+ "name": "defaultTriggerId",+ "type": "string | null",+ "required": false,+ "defaultValue": null,+ "description": "ID of the trigger that the tooltip is associated with.\nThis is useful in conjunction with the `defaultOpen` prop to create an initially open tooltip."+ },+ {+ "name": "delay",+ "type": "number",+ "required": false,+ "defaultValue": "600",+ "description": "Delay in milliseconds before opening on hover. Defaults to 600."+ },+ {+ "name": "disableAnchorTracking",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Whether to disable the popup from tracking any layout shift of its positioning anchor."+ },+ {+ "name": "disabled",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Prevents the tooltip from opening."+ },+ {+ "name": "disableHoverablePopup",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Prevents hovering over the popup from keeping it open."+ },+ {+ "name": "keepMounted",+ "type": "boolean",+ "required": false,+ "defaultValue": null,+ "description": "Keeps the popup mounted while closed."+ },+ {+ "name": "maxWidth",+ "type": "MaxWidth<string | number>",+ "required": false,+ "defaultValue": null,+ "description": "Maximum popup width. Defaults to 300 pixels."+ },+ {+ "name": "onOpenChange",+ "type": "((open: boolean, eventDetails: TooltipRootChangeEventDetails) => void)",+ "required": false,+ "defaultValue": null,+ "description": "Called when an interaction requests a visibility change."+ },+ {+ "name": "onOpenChangeComplete",+ "type": "((open: boolean) => void)",+ "required": false,+ "defaultValue": null,+ "description": "Event handler called after any animations complete when the tooltip is opened or closed."+ },+ {+ "name": "open",+ "type": "boolean",+ "required": false,+ "defaultValue": null,+ "description": "Controlled visibility of the tooltip."+ },+ {+ "name": "positionMethod",+ "type": "\"absolute\" | \"fixed\"",+ "required": false,+ "defaultValue": "absolute",+ "description": "CSS positioning method for the popup."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipPopupState>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ },+ {+ "name": "side",+ "type": "\"top\" | \"right\" | \"bottom\" | \"left\"",+ "required": false,+ "defaultValue": null,+ "description": "Preferred side of the trigger. Defaults to top and may change to avoid collisions."+ },+ {+ "name": "sideOffset",+ "type": "number | OffsetFunction",+ "required": false,+ "defaultValue": "10",+ "description": "Distance from the trigger in pixels. Defaults to 10."+ },+ {+ "name": "sticky",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Whether to maintain the popup in the viewport after\nthe anchor element was scrolled out of view."+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: TooltipPopupState) => CSSProperties | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "Inline styles for the popup."+ },+ {+ "name": "trackCursorAxis",+ "type": "\"none\" | \"both\" | \"x\" | \"y\"",+ "required": false,+ "defaultValue": "none",+ "description": "Determines which axis the tooltip should track the cursor on."+ },+ {+ "name": "triggerId",+ "type": "string | null",+ "required": false,+ "defaultValue": null,+ "description": "ID of the trigger that the tooltip is associated with.\nThis is useful in conjunction with the `open` prop to create a controlled tooltip.\nThere's no need to specify this prop when the tooltip is uncontrolled (that is, when the `open` prop is not set)."+ }+ ],+ "parts": [+ {+ "name": "Root",+ "props": [+ {+ "name": "actionsRef",+ "type": "RefObject<TooltipRootActions | null>",+ "required": false,+ "defaultValue": null,+ "description": "A ref to imperative actions.\n- `unmount`: Unmounts the tooltip popup.\n- `close`: Closes the tooltip imperatively when called."+ },+ {+ "name": "children",+ "type": "ReactNode | PayloadChildRenderFunction<Payload>",+ "required": false,+ "defaultValue": null,+ "description": "The content of the tooltip.\nThis can be a regular React node or a render function that receives the `payload` of the active trigger."+ },+ {+ "name": "defaultOpen",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Whether the tooltip is initially open.\n\nTo render a controlled tooltip, use the `open` prop instead."+ },+ {+ "name": "defaultTriggerId",+ "type": "string | null",+ "required": false,+ "defaultValue": null,+ "description": "ID of the trigger that the tooltip is associated with.\nThis is useful in conjunction with the `defaultOpen` prop to create an initially open tooltip."+ },+ {+ "name": "disabled",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Whether the tooltip is disabled."+ },+ {+ "name": "disableHoverablePopup",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Whether the tooltip contents can be hovered without closing the tooltip."+ },+ {+ "name": "handle",+ "type": "TooltipHandle<Payload>",+ "required": false,+ "defaultValue": null,+ "description": "A handle to associate the tooltip with a trigger.\nIf specified, allows external triggers to control the tooltip's open state.\nCan be created with the Tooltip.createHandle() method."+ },+ {+ "name": "onOpenChange",+ "type": "((open: boolean, eventDetails: TooltipRootChangeEventDetails) => void)",+ "required": false,+ "defaultValue": null,+ "description": "Event handler called when the tooltip is opened or closed."+ },+ {+ "name": "onOpenChangeComplete",+ "type": "((open: boolean) => void)",+ "required": false,+ "defaultValue": null,+ "description": "Event handler called after any animations complete when the tooltip is opened or closed."+ },+ {+ "name": "open",+ "type": "boolean",+ "required": false,+ "defaultValue": null,+ "description": "Whether the tooltip is currently open."+ },+ {+ "name": "trackCursorAxis",+ "type": "\"none\" | \"both\" | \"x\" | \"y\"",+ "required": false,+ "defaultValue": "none",+ "description": "Determines which axis the tooltip should track the cursor on."+ },+ {+ "name": "triggerId",+ "type": "string | null",+ "required": false,+ "defaultValue": null,+ "description": "ID of the trigger that the tooltip is associated with.\nThis is useful in conjunction with the `open` prop to create a controlled tooltip.\nThere's no need to specify this prop when the tooltip is uncontrolled (that is, when the `open` prop is not set)."+ }+ ]+ },+ {+ "name": "Trigger",+ "props": [+ {+ "name": "className",+ "type": "string | ((state: TooltipTriggerState) => string | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "CSS class applied to the element, or a function that\nreturns a class based on the component's state."+ },+ {+ "name": "closeDelay",+ "type": "number",+ "required": false,+ "defaultValue": "0",+ "description": "How long to wait before closing the tooltip. Specified in milliseconds."+ },+ {+ "name": "closeOnClick",+ "type": "boolean",+ "required": false,+ "defaultValue": "true",+ "description": "Whether the tooltip should close when this trigger is clicked."+ },+ {+ "name": "delay",+ "type": "number",+ "required": false,+ "defaultValue": "600",+ "description": "How long to wait before opening the tooltip on hover. Specified in milliseconds."+ },+ {+ "name": "disabled",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "If `true`, the tooltip will not open when interacting with this trigger.\nNote that this doesn't apply the `disabled` attribute to the trigger element.\nIf you want to disable the trigger element itself, you can pass the `disabled` prop to the trigger element via the `render` prop."+ },+ {+ "name": "handle",+ "type": "TooltipHandle<Payload>",+ "required": false,+ "defaultValue": null,+ "description": "A handle to associate the trigger with a tooltip."+ },+ {+ "name": "payload",+ "type": "Payload",+ "required": false,+ "defaultValue": null,+ "description": "A payload to pass to the tooltip when it is opened."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipTriggerState>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: TooltipTriggerState) => CSSProperties | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "Style applied to the element, or a function that\nreturns a style object based on the component's state."+ }+ ]+ },+ {+ "name": "Popup",+ "props": [+ {+ "name": "align",+ "type": "\"center\" | \"start\" | \"end\"",+ "required": false,+ "defaultValue": "center",+ "description": "Alignment relative to the trigger. Defaults to center."+ },+ {+ "name": "alignOffset",+ "type": "number | OffsetFunction",+ "required": false,+ "defaultValue": "0",+ "description": "Offset along the alignment axis in pixels."+ },+ {+ "name": "anchor",+ "type": "Element | VirtualElement | RefObject<Element | null> | (() => Element | VirtualElement | null) | null",+ "required": false,+ "defaultValue": null,+ "description": "An explicit positioning anchor for the popup."+ },+ {+ "name": "arrow",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Displays an arrow pointing to the trigger. Defaults to false."+ },+ {+ "name": "className",+ "type": "string | ((state: TooltipPopupState) => string | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "Additional CSS class for the popup."+ },+ {+ "name": "collisionAvoidance",+ "type": "CollisionAvoidance",+ "required": false,+ "defaultValue": null,+ "description": "Determines how to handle collisions when positioning the popup.\n\n`side` controls overflow on the preferred placement axis (`top`/`bottom` or `left`/`right`):\n- `'flip'`: keep the requested side when it fits; otherwise try the opposite side\n (`top` and `bottom`, or `left` and `right`).\n- `'shift'`: never change side; keep the requested side and move the popup within\n the clipping boundary so it stays visible.\n- `'none'`: do not correct side-axis overflow.\n\n`align` controls overflow on the alignment axis (`start`/`center`/`end`):\n- `'flip'`: keep side, but swap `start` and `end` when the requested alignment overflows.\n- `'shift'`: keep side and requested alignment, then nudge the popup along the\n alignment axis to fit.\n- `'none'`: do not correct alignment-axis overflow.\n\n`fallbackAxisSide` controls fallback behavior on the perpendicular axis when the\npreferred axis cannot fit:\n- `'start'`: allow perpendicular fallback and try the logical start side first\n (`top` before `bottom`, or `left` before `right` in LTR).\n- `'end'`: allow perpendicular fallback and try the logical end side first\n (`bottom` before `top`, or `right` before `left` in LTR).\n- `'none'`: do not fallback to the perpendicular axis.\n\nWhen `side` is `'shift'`, explicitly setting `align` only supports `'shift'` or `'none'`.\nIf `align` is omitted, it defaults to `'flip'`."+ },+ {+ "name": "collisionBoundary",+ "type": "Boundary",+ "required": false,+ "defaultValue": "clipping-ancestors",+ "description": "An element or a rectangle that delimits the area that the popup is confined to."+ },+ {+ "name": "collisionPadding",+ "type": "Padding",+ "required": false,+ "defaultValue": "5",+ "description": "Additional space to maintain from the edge of the collision boundary."+ },+ {+ "name": "container",+ "type": "HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null",+ "required": false,+ "defaultValue": null,+ "description": "Portal destination. Defaults to the current theme container."+ },+ {+ "name": "disableAnchorTracking",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Whether to disable the popup from tracking any layout shift of its positioning anchor."+ },+ {+ "name": "keepMounted",+ "type": "boolean",+ "required": false,+ "defaultValue": null,+ "description": "Keeps the popup mounted while closed."+ },+ {+ "name": "maxWidth",+ "type": "MaxWidth<string | number>",+ "required": false,+ "defaultValue": "300px",+ "description": "Maximum popup width. Defaults to 300 pixels."+ },+ {+ "name": "positionMethod",+ "type": "\"absolute\" | \"fixed\"",+ "required": false,+ "defaultValue": "absolute",+ "description": "CSS positioning method for the popup."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, TooltipPopupState>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ },+ {+ "name": "side",+ "type": "\"top\" | \"right\" | \"bottom\" | \"left\"",+ "required": false,+ "defaultValue": "top",+ "description": "Preferred side of the trigger. Defaults to top and may change to avoid collisions."+ },+ {+ "name": "sideOffset",+ "type": "number | OffsetFunction",+ "required": false,+ "defaultValue": "10",+ "description": "Distance from the trigger in pixels. Defaults to 10."+ },+ {+ "name": "sticky",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Whether to maintain the popup in the viewport after\nthe anchor element was scrolled out of view."+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: TooltipPopupState) => CSSProperties | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "Inline styles for the popup."+ }+ ]+ },+ {+ "name": "Content",+ "props": [+ {+ "name": "description",+ "type": "ReactNode",+ "required": false,+ "defaultValue": null,+ "description": "Secondary explanation beneath the primary text."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ },+ {+ "name": "startIcon",+ "type": "ReactNode",+ "required": false,+ "defaultValue": null,+ "description": "An icon displayed before the text."+ }+ ]+ },+ {+ "name": "Provider",+ "props": [+ {+ "name": "closeDelay",+ "type": "number",+ "required": false,+ "defaultValue": null,+ "description": "How long to wait before closing a tooltip. Specified in milliseconds."+ },+ {+ "name": "delay",+ "type": "number",+ "required": false,+ "defaultValue": null,+ "description": "How long to wait before opening the tooltip on hover. Specified in milliseconds."+ },+ {+ "name": "timeout",+ "type": "number",+ "required": false,+ "defaultValue": "400",+ "description": "Another tooltip will open instantly if the previous tooltip\nis closed within this timeout. Specified in milliseconds."+ }+ ]+ }+ ]+ },{"name": "Toast","entryPoint": "twenty-ui/primitives/feedback",@@ -4501,7 +5088,7 @@},{"name": "tooltipPlace",- "type": "\"top\" | \"left\" | \"right\" | \"bottom\"",+ "type": "\"top\" | \"right\" | \"bottom\" | \"left\"","required": false,"defaultValue": null,"description": "Position of the string-label tooltip."diff --git a/packages/twenty-ui/scripts/generateDocsData.ts b/packages/twenty-ui/scripts/generateDocsData.tsindex 0c48dec6fcc..4b5504e17ab 100644--- a/packages/twenty-ui/scripts/generateDocsData.ts+++ b/packages/twenty-ui/scripts/generateDocsData.ts@@ -1,7 +1,11 @@import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';import { dirname, relative, resolve } from 'node:path';import { fileURLToPath } from 'node:url';-import { type ComponentDoc, type PropItem } from 'react-docgen-typescript';+import {+ type ComponentDoc,+ type ParserOptions,+ type PropItem,+} from 'react-docgen-typescript';import ts from 'typescript';import { DESIGN_TOKENS } from '../design-tokens/designTokens';@@ -67,20 +71,27 @@ const isDeclaredInTwentyUi = (prop: PropItem): boolean =>declaration.fileName.startsWith(sourceRoot),) ?? false;-const parser = new DocumentationParser(program, {+const parserOptions: ParserOptions = {shouldExtractLiteralValuesFromEnum: true,shouldIncludePropTagMap: true,propFilter: (prop) => !isReactNativeAttribute(prop) && !isHiddenProp(prop),+};+const parser = new DocumentationParser(program, parserOptions);+const documentedChildrenParser = new DocumentationParser(program, {+ ...parserOptions,+ skipChildrenPropWithoutDoc: false,});const extractProps = ({symbol,name,propDescriptions = {},+ propDefaults = {},}: {symbol: ts.Symbol;name: string;propDescriptions?: Partial<Record<string, string>>;+ propDefaults?: Partial<Record<string, string>>;}): ComponentDocumentation['props'] => {const declaration = symbol.valueDeclaration;@@ -88,7 +99,9 @@ const extractProps = ({throw new Error(`Could not find the declaration for ${name}`);}- const parsed: ComponentDoc | null = parser.getComponentInfo(+ const componentParser =+ 'children' in propDescriptions ? documentedChildrenParser : parser;+ const parsed: ComponentDoc | null = componentParser.getComponentInfo(symbol,declaration.getSourceFile(),() => name,@@ -118,7 +131,9 @@ const extractProps = ({required: prop.required,}),required: prop.required,- defaultValue: normalizeDocumentationDefaultValue(prop.defaultValue),+ defaultValue:+ propDefaults[prop.name] ??+ normalizeDocumentationDefaultValue(prop.defaultValue),description,};});@@ -148,21 +163,30 @@ const components: ComponentDocumentation[] = DOCUMENTED_COMPONENTS.map(slug: component.slug,};- if (type.getCallSignatures().length > 0) {- return {- ...metadata,- props: extractProps({- symbol,- name: component.name,- propDescriptions:- 'propDescriptions' in component- ? component.propDescriptions- : undefined,- }),- };- }-- const parts = type.getProperties().map((part) => {+ const props =+ type.getCallSignatures().length > 0+ ? extractProps({+ symbol,+ name: component.name,+ propDescriptions:+ 'propDescriptions' in component+ ? component.propDescriptions+ : undefined,+ propDefaults:+ 'propDefaults' in component ? component.propDefaults : undefined,+ })+ : [];++ const partNames: readonly string[] | undefined =+ 'parts' in component ? component.parts : undefined;+ const partPropDescriptions: Partial<+ Record<string, Partial<Record<string, string>>>+ > =+ 'partPropDescriptions' in component ? component.partPropDescriptions : {};+ const componentParts = type+ .getProperties()+ .filter((part) => partNames?.includes(part.name) ?? props.length === 0);+ const parts = componentParts.map((part) => {const declaration = part.valueDeclaration;if (!declaration || !ts.isPropertyAssignment(declaration)) {@@ -184,15 +208,20 @@ const components: ComponentDocumentation[] = DOCUMENTED_COMPONENTS.map(props: extractProps({symbol: partSymbol,name: `${component.name}.${part.name}`,+ propDescriptions: partPropDescriptions[part.name],}),};});- if (parts.length === 0) {+ if (props.length === 0 && parts.length === 0) {throw new Error(`Could not extract parts for ${component.name}`);}- return { ...metadata, props: [], parts };+ return {+ ...metadata,+ props,+ ...(parts.length > 0 ? { parts } : {}),+ };},);diff --git a/packages/twenty-ui/src/components/IconButton/IconButton.tsx b/packages/twenty-ui/src/components/IconButton/IconButton.tsxindex d628d43ba14..d6f8461f675 100644--- a/packages/twenty-ui/src/components/IconButton/IconButton.tsx+++ b/packages/twenty-ui/src/components/IconButton/IconButton.tsx@@ -1,12 +1,7 @@import { isNonEmptyString } from '@sniptt/guards';-import { useId } from 'react';import { Button } from '@ui/primitives/input/Button/Button';-import {- AppTooltip,- TooltipDelay,- TooltipPosition,-} from '@ui/primitives/surfaces/AppTooltip/AppTooltip';+import { Tooltip } from '@ui/primitives/surfaces/Tooltip/Tooltip';import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';import styles from './IconButton.module.scss';@@ -16,14 +11,13 @@ export const IconButton = ({children,className,tooltip,- tooltipPlace = TooltipPosition.Bottom,- tooltipDelay = TooltipDelay.longDelay,+ tooltipPlace = 'bottom',+ tooltipDelay = 1000,tooltipOffset = 5,disabled,loading,...props}: IconButtonProps) => {- const tooltipId = useId();const hasTooltip = isNonEmptyString(tooltip);const isDisabled = disabled || loading;const button = (@@ -31,7 +25,6 @@ export const IconButton = ({{...props}disabled={disabled}loading={loading}- data-tooltip-trigger={hasTooltip || undefined}startIcon={<span className={styles.icon}>{children}</span>}className={mergeClassNames(styles.button, className)}/>@@ -42,22 +35,17 @@ export const IconButton = ({}return (- <>- <span className={styles.tooltipAnchor} data-tooltip-id={tooltipId}>- {button}- </span>- <AppTooltip- anchorSelect={- isDisabled- ? `[data-tooltip-id='${tooltipId}']`- : `[data-tooltip-id='${tooltipId}'] > [data-tooltip-trigger]`- }- title={tooltip}- delay={tooltipDelay}- place={tooltipPlace}- offset={tooltipOffset}- noArrow- />- </>+ <Tooltip+ content={tooltip}+ delay={tooltipDelay}+ side={tooltipPlace}+ sideOffset={tooltipOffset}+ >+ {isDisabled ? (+ <span className={styles.tooltipAnchor}>{button}</span>+ ) : (+ button+ )}+ </Tooltip>);};diff --git a/packages/twenty-ui/src/components/IconButton/__stories__/IconButton.stories.tsx b/packages/twenty-ui/src/components/IconButton/__stories__/IconButton.stories.tsxindex f35ae54b97b..cdd2c8ba2dd 100644--- a/packages/twenty-ui/src/components/IconButton/__stories__/IconButton.stories.tsx+++ b/packages/twenty-ui/src/components/IconButton/__stories__/IconButton.stories.tsx@@ -2,7 +2,6 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, fn, userEvent, within } from 'storybook/test';import { IconPlus, IconSearch } from '@ui/icon';-import { TooltipDelay } from '@ui/primitives/surfaces/AppTooltip/AppTooltip';import { ButtonGroup } from '@ui/primitives/input/ButtonGroup/ButtonGroup';import { type ButtonColor } from '@ui/primitives/input/Button/types/ButtonColor';import { type ButtonVariant } from '@ui/primitives/input/Button/types/ButtonVariant';@@ -88,7 +87,7 @@ export const Link: Story = {export const Tooltip: Story = {...Default,- args: { tooltip: 'Search records', tooltipDelay: TooltipDelay.noDelay },+ args: { tooltip: 'Search records', tooltipDelay: 0 },play: async ({ canvasElement }) => {const button = within(canvasElement).getByRole('button', {name: 'Search',diff --git a/packages/twenty-ui/src/components/IconButton/__tests__/IconButton.test.tsx b/packages/twenty-ui/src/components/IconButton/__tests__/IconButton.test.tsxindex d9eae9c38c7..e53015c1216 100644--- a/packages/twenty-ui/src/components/IconButton/__tests__/IconButton.test.tsx+++ b/packages/twenty-ui/src/components/IconButton/__tests__/IconButton.test.tsx@@ -1,3 +1,7 @@+import { render, screen } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import { describe, expect, it, vi } from 'vitest';+import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';import { IconSearch } from '@ui/icon';@@ -14,3 +18,64 @@ runComponentConformance({refInstanceOf: HTMLButtonElement,ownClassName: styles.button,});++describe('IconButton', () => {+ it('shows a tooltip on keyboard focus without changing button clicks', async () => {+ const user = userEvent.setup();+ const onClick = vi.fn();++ render(+ <IconButton+ aria-label="Search"+ tooltip="Search records"+ onClick={onClick}+ tooltipDelay={0}+ >+ <IconSearch />+ </IconButton>,+ );++ const button = screen.getByRole('button', { name: 'Search' });++ await user.tab();++ expect(button).toHaveFocus();+ expect(await screen.findByRole('tooltip')).toHaveTextContent(+ 'Search records',+ );++ await user.keyboard('{Enter}');++ expect(onClick).toHaveBeenCalledOnce();+ });++ it('shows the disabled explanation on hover and keeps the button disabled', async () => {+ const user = userEvent.setup();+ const onClick = vi.fn();++ render(+ <IconButton+ aria-label="Search"+ tooltip="Search is unavailable"+ disabled+ onClick={onClick}+ tooltipDelay={0}+ >+ <IconSearch />+ </IconButton>,+ );++ const button = screen.getByRole('button', { name: 'Search' });++ await user.hover(button);++ expect(await screen.findByRole('tooltip')).toHaveTextContent(+ 'Search is unavailable',+ );+ expect(button).toBeDisabled();++ await user.click(button);++ expect(onClick).not.toHaveBeenCalled();+ });+});diff --git a/packages/twenty-ui/src/components/IconButton/types/IconButtonProps.ts b/packages/twenty-ui/src/components/IconButton/types/IconButtonProps.tsindex 41a5a7ecb3f..ce15f4c8f8d 100644--- a/packages/twenty-ui/src/components/IconButton/types/IconButtonProps.ts+++ b/packages/twenty-ui/src/components/IconButton/types/IconButtonProps.ts@@ -1,10 +1,7 @@import { type ReactNode } from 'react';import { type ButtonProps } from '@ui/primitives/input/Button/types/ButtonProps';-import {- type TooltipDelay,- type TooltipPosition,-} from '@ui/primitives/surfaces/AppTooltip/AppTooltip';+import { type TooltipSide } from '@ui/primitives/surfaces/Tooltip/types/TooltipSide';export type IconButtonProps = Omit<ButtonProps,@@ -20,7 +17,7 @@ export type IconButtonProps = Omit<children: ReactNode;'aria-label': string;tooltip?: string;- tooltipPlace?: TooltipPosition;- tooltipDelay?: TooltipDelay;+ tooltipPlace?: TooltipSide;+ tooltipDelay?: number;tooltipOffset?: number;};diff --git a/packages/twenty-ui/src/primitives/data-display/Chip/types/ChipProps.ts b/packages/twenty-ui/src/primitives/data-display/Chip/types/ChipProps.tsindex d308a07c8be..2db116fcf98 100644--- a/packages/twenty-ui/src/primitives/data-display/Chip/types/ChipProps.ts+++ b/packages/twenty-ui/src/primitives/data-display/Chip/types/ChipProps.ts@@ -1,7 +1,7 @@import { type useRender } from '@base-ui/react/use-render';import { type ReactNode } from 'react';-import { type TooltipPosition } from '@ui/primitives/surfaces/AppTooltip/AppTooltip';+import { type TooltipSide } from '@ui/primitives/surfaces/Tooltip/types/TooltipSide';import { type ChipSize } from './ChipSize';import { type ChipVariant } from './ChipVariant';@@ -20,7 +20,7 @@ export type ChipProps = Omit<useRender.ComponentProps<'div'>, 'color'> & {endElementDivider?: boolean;maxWidth?: number;tooltipLabel?: string;- tooltipPlace?: TooltipPosition;+ tooltipPlace?: TooltipSide;alwaysShowTooltip?: boolean;isLabelHidden?: boolean;forceEmptyText?: boolean;diff --git a/packages/twenty-ui/src/primitives/feedback/InlineBanner/__stories__/InlineBanner.stories.tsx b/packages/twenty-ui/src/primitives/feedback/InlineBanner/__stories__/InlineBanner.stories.tsxindex 0956186b55f..01b0d32f25f 100644--- a/packages/twenty-ui/src/primitives/feedback/InlineBanner/__stories__/InlineBanner.stories.tsx+++ b/packages/twenty-ui/src/primitives/feedback/InlineBanner/__stories__/InlineBanner.stories.tsx@@ -1,5 +1,5 @@import { type Meta, type StoryObj } from '@storybook/react-vite';-import { expect, fn, userEvent, within } from 'storybook/test';+import { expect, fn, userEvent, waitFor, within } from 'storybook/test';import { InlineBanner } from '@ui/primitives/feedback/InlineBanner/InlineBanner';import { IconExternalLink } from '@ui/icon';@@ -127,9 +127,11 @@ export const TruncatedMessage: Story = {).toHaveTextContent(args.message);await userEvent.keyboard('{Escape}');await expect(message).toHaveFocus();- await expect(- within(canvasElement.ownerDocument.body).queryByRole('tooltip'),- ).not.toBeInTheDocument();+ await waitFor(() =>+ expect(+ within(canvasElement.ownerDocument.body).queryByRole('tooltip'),+ ).not.toBeInTheDocument(),+ );await userEvent.tab();await expect(canvas.getByRole('button', { name: /Reconnect/ }),@@ -139,9 +141,11 @@ export const TruncatedMessage: Story = {await within(canvasElement.ownerDocument.body).findByRole('tooltip'),).toHaveTextContent(args.message);await userEvent.tab();- await expect(- within(canvasElement.ownerDocument.body).queryByRole('tooltip'),- ).not.toBeInTheDocument();+ await waitFor(() =>+ expect(+ within(canvasElement.ownerDocument.body).queryByRole('tooltip'),+ ).not.toBeInTheDocument(),+ );await userEvent.pointer({ keys: '[TouchA]', target: message });await expect(message).toHaveFocus();await expect(diff --git a/packages/twenty-ui/src/primitives/feedback/SidePanelInformationBanner/SidePanelInformationBanner.tsx b/packages/twenty-ui/src/primitives/feedback/SidePanelInformationBanner/SidePanelInformationBanner.tsxindex 791e18c4652..b62415ca4cc 100644--- a/packages/twenty-ui/src/primitives/feedback/SidePanelInformationBanner/SidePanelInformationBanner.tsx+++ b/packages/twenty-ui/src/primitives/feedback/SidePanelInformationBanner/SidePanelInformationBanner.tsx@@ -1,18 +1,12 @@import { clsx } from 'clsx';-import { useId } from 'react';import { isDefined } from '@ui/utilities/utils/isDefined';import { IconAlertTriangle, IconInfoCircle } from '@ui/icon';-import { AppTooltip } from '@ui/primitives/surfaces';+import { Tooltip } from '@ui/primitives/surfaces/Tooltip/Tooltip';import styles from './SidePanelInformationBanner.module.scss';-export type SidePanelInformationBannerProps = {- message: string;- className?: string;- variant?: 'default' | 'warning';- tooltipMessage?: string;-};+import { type SidePanelInformationBannerProps } from './types/SidePanelInformationBannerProps';export const SidePanelInformationBanner = ({message,@@ -20,28 +14,23 @@ export const SidePanelInformationBanner = ({variant = 'default',tooltipMessage,}: SidePanelInformationBannerProps) => {- const tooltipId = useId();-return (- <div- className={clsx(styles.banner, className)}- data-tooltip-id={tooltipMessage ? tooltipId : undefined}+ <Tooltip+ content={tooltipMessage}+ disabled={!isDefined(tooltipMessage)}+ side="bottom"+ delay={500}>- <div className={styles.iconContainer}>- {variant === 'default' ? (- <IconInfoCircle size={16} />- ) : (- <IconAlertTriangle size={16} />- )}+ <div className={clsx(styles.banner, className)}>+ <div className={styles.iconContainer}>+ {variant === 'default' ? (+ <IconInfoCircle size={16} />+ ) : (+ <IconAlertTriangle size={16} />+ )}+ </div>+ <p className={styles.message}>{message}</p></div>- <p className={styles.message}>{message}</p>- {isDefined(tooltipMessage) && (- <AppTooltip- anchorSelect={`[data-tooltip-id='${tooltipId}']`}- title={tooltipMessage}- place="bottom"- />- )}- </div>+ </Tooltip>);};diff --git a/packages/twenty-ui/src/primitives/feedback/SidePanelInformationBanner/types/SidePanelInformationBannerProps.ts b/packages/twenty-ui/src/primitives/feedback/SidePanelInformationBanner/types/SidePanelInformationBannerProps.tsnew file mode 100644index 00000000000..1cfb4e6f5ff--- /dev/null+++ b/packages/twenty-ui/src/primitives/feedback/SidePanelInformationBanner/types/SidePanelInformationBannerProps.ts@@ -0,0 +1,6 @@+export type SidePanelInformationBannerProps = {+ message: string;+ className?: string;+ variant?: 'default' | 'warning';+ tooltipMessage?: string;+};diff --git a/packages/twenty-ui/src/primitives/feedback/index.ts b/packages/twenty-ui/src/primitives/feedback/index.tsindex 4da90b05c28..27b398ddbe3 100644--- a/packages/twenty-ui/src/primitives/feedback/index.ts+++ b/packages/twenty-ui/src/primitives/feedback/index.ts@@ -36,15 +36,27 @@ export { InlineBanner } from './InlineBanner/InlineBanner';export { Loader } from './Loader/Loader';export type { ProgressBarProps } from './ProgressBar/ProgressBar';export { ProgressBar } from './ProgressBar/ProgressBar';-export type { SidePanelInformationBannerProps } from './SidePanelInformationBanner/SidePanelInformationBanner';export { SidePanelInformationBanner } from './SidePanelInformationBanner/SidePanelInformationBanner';+export type { SidePanelInformationBannerProps } from './SidePanelInformationBanner/types/SidePanelInformationBannerProps';+export { DEFAULT_TOAST_LIMIT } from './Toast/constants/DefaultToastLimit';+export { ToastContext } from './Toast/contexts/ToastContext';+export { useCloseToast } from './Toast/hooks/useCloseToast';+export { useEnqueueToast } from './Toast/hooks/useEnqueueToast';export { useToast } from './Toast/hooks/useToast';+export { useToastContext } from './Toast/hooks/useToastContext';+export { useToastEntries } from './Toast/hooks/useToastEntries';+export { createToastStore } from './Toast/stores/createToastStore';export { Toast } from './Toast/Toast';export { ToastProvider } from './Toast/ToastProvider';+export type { ToastEntry } from './Toast/types/ToastEntry';export type { ToastNotification } from './Toast/types/ToastNotification';export type { ToastOptions } from './Toast/types/ToastOptions';export type { ToastProps } from './Toast/types/ToastProps';export type { ToastProviderProps } from './Toast/types/ToastProviderProps';+export type { ToastStoreState } from './Toast/types/ToastStoreState';export type { ToastVariant } from './Toast/types/ToastVariant';+export { completeToastExit } from './Toast/utils/completeToastExit';+export { dismissToasts } from './Toast/utils/dismissToasts';+export { isToastVisible } from './Toast/utils/isToastVisible';export { Toaster } from './Toaster/Toaster';export type { ToasterProps } from './Toaster/types/ToasterProps';diff --git a/packages/twenty-ui/src/primitives/input/TabButton/TabButton.tsx b/packages/twenty-ui/src/primitives/input/TabButton/TabButton.tsxindex f8655ab3246..ee74aa3e440 100644--- a/packages/twenty-ui/src/primitives/input/TabButton/TabButton.tsx+++ b/packages/twenty-ui/src/primitives/input/TabButton/TabButton.tsx@@ -1,5 +1,6 @@import { type IconComponent } from '@ui/icon';-import { AppTooltip, TooltipDelay } from '@ui/primitives/surfaces';+import { isNonEmptyString } from '@sniptt/guards';+import { Tooltip } from '@ui/primitives/surfaces/Tooltip/Tooltip';import {StyledTabButton,StyledTabContainer,@@ -60,41 +61,39 @@ export const TabButton = ({const tabElementId = `tab-${id}`;return (- <div key={id} id={tabElementId} className={styles.tabTooltipWrapper}>- <StyledTabButton- data-testid={disableTestId ? undefined : `tab-${id}`}- active={active}- disabled={disabled}- to={to}- state={state}- replace={replace}- className={className}- onClick={onClick}- onMouseEnter={onMouseEnter}- onMouseLeave={onMouseLeave}- >- <TabContent- id={id}+ <Tooltip+ content={tooltipContent}+ disabled={!isNonEmptyString(tooltipContent)}+ side="bottom"+ positionMethod="fixed"+ delay={300}+ >+ <div key={id} id={tabElementId} className={styles.tabTooltipWrapper}>+ <StyledTabButton+ data-testid={disableTestId ? undefined : `tab-${id}`}active={active}disabled={disabled}- LeftIcon={LeftIcon}- title={title}- logo={logo}- RightIcon={RightIcon}- pill={pill}- contentSize={contentSize}- />- </StyledTabButton>- {tooltipContent && (- <AppTooltip- anchorSelect={`#${tabElementId}`}- title={tooltipContent}- noArrow- place="bottom"- positionStrategy="fixed"- delay={TooltipDelay.shortDelay}- />- )}- </div>+ to={to}+ state={state}+ replace={replace}+ className={className}+ onClick={onClick}+ onMouseEnter={onMouseEnter}+ onMouseLeave={onMouseLeave}+ >+ <TabContent+ id={id}+ active={active}+ disabled={disabled}+ LeftIcon={LeftIcon}+ title={title}+ logo={logo}+ RightIcon={RightIcon}+ pill={pill}+ contentSize={contentSize}+ />+ </StyledTabButton>+ </div>+ </Tooltip>);};diff --git a/packages/twenty-ui/src/primitives/navigation/MenuPicker/MenuPicker.tsx b/packages/twenty-ui/src/primitives/navigation/MenuPicker/MenuPicker.tsxindex 8b3f4951bc4..9873b29133f 100644--- a/packages/twenty-ui/src/primitives/navigation/MenuPicker/MenuPicker.tsx+++ b/packages/twenty-ui/src/primitives/navigation/MenuPicker/MenuPicker.tsx@@ -2,30 +2,12 @@ import { isNonEmptyString } from '@sniptt/guards';import { clsx } from 'clsx';import { isDefined } from '@ui/utilities/utils/isDefined';-import { type IconComponent } from '@ui/icon';-import {- AppTooltip,- TooltipDelay,- TooltipPosition,-} from '@ui/primitives/surfaces';+import { Tooltip } from '@ui/primitives/surfaces/Tooltip/Tooltip';import { useTheme } from '@ui/theme-constants';import styles from './MenuPicker.module.scss';-export type MenuPickerProps = {- id: string;- className?: string;- disabled?: boolean;- icon: IconComponent;- label?: string;- onClick?: () => void;- selected?: boolean;- showLabel?: boolean;- testId?: string;- tooltipContent?: string;- tooltipDelay?: TooltipDelay;- tooltipOffset?: number;-};+import { type MenuPickerProps } from './types/MenuPickerProps';export const MenuPicker = ({id,@@ -38,13 +20,20 @@ export const MenuPicker = ({className,testId,tooltipContent,- tooltipDelay = TooltipDelay.noDelay,+ tooltipDelay = 0,tooltipOffset = 5,}: MenuPickerProps) => {const theme = useTheme();return (- <>+ <Tooltip+ content={tooltipContent}+ disabled={!isNonEmptyString(tooltipContent)}+ sideOffset={tooltipOffset}+ side="bottom"+ positionMethod="fixed"+ delay={tooltipDelay}+ ><buttonid={id}disabled={disabled}@@ -70,18 +59,6 @@ export const MenuPicker = ({</div>)}</button>-- {isNonEmptyString(tooltipContent) && (- <AppTooltip- anchorSelect={`#${id}`}- offset={tooltipOffset}- title={tooltipContent}- place={TooltipPosition.Bottom}- positionStrategy="fixed"- delay={tooltipDelay}- noArrow- />- )}- </>+ </Tooltip>);};diff --git a/packages/twenty-ui/src/primitives/navigation/MenuPicker/__stories__/MenuPicker.stories.tsx b/packages/twenty-ui/src/primitives/navigation/MenuPicker/__stories__/MenuPicker.stories.tsxindex a2c89753b1d..699a2a74c68 100644--- a/packages/twenty-ui/src/primitives/navigation/MenuPicker/__stories__/MenuPicker.stories.tsx+++ b/packages/twenty-ui/src/primitives/navigation/MenuPicker/__stories__/MenuPicker.stories.tsx@@ -1,6 +1,5 @@import { type Meta, type StoryObj } from '@storybook/react-vite';import { IconChartPie } from '@ui/icon';-import { TooltipDelay } from '@ui/primitives/surfaces';import { MenuPicker } from '@ui/primitives/navigation/MenuPicker/MenuPicker';import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';import { type ReactNode } from 'react';@@ -107,7 +106,7 @@ export const AllStates: Story = {icon={IconChartPie}label="Tooltip"tooltipContent="Tooltip"- tooltipDelay={TooltipDelay.mediumDelay}+ tooltipDelay={500}/></div></div>diff --git a/packages/twenty-ui/src/primitives/navigation/MenuPicker/types/MenuPickerProps.ts b/packages/twenty-ui/src/primitives/navigation/MenuPicker/types/MenuPickerProps.tsnew file mode 100644index 00000000000..ee29ffff431--- /dev/null+++ b/packages/twenty-ui/src/primitives/navigation/MenuPicker/types/MenuPickerProps.ts@@ -0,0 +1,16 @@+import { type IconComponent } from '@ui/icon';++export type MenuPickerProps = {+ id: string;+ className?: string;+ disabled?: boolean;+ icon: IconComponent;+ label?: string;+ onClick?: () => void;+ selected?: boolean;+ showLabel?: boolean;+ testId?: string;+ tooltipContent?: string;+ tooltipDelay?: number;+ tooltipOffset?: number;+};diff --git a/packages/twenty-ui/src/primitives/navigation/index.ts b/packages/twenty-ui/src/primitives/navigation/index.tsindex 68be9c29ab0..8edd1621a0d 100644--- a/packages/twenty-ui/src/primitives/navigation/index.ts+++ b/packages/twenty-ui/src/primitives/navigation/index.ts@@ -54,8 +54,8 @@ export type { MenuItemSuggestionProps } from './MenuItemSuggestion/MenuItemSuggeexport { MenuItemSuggestion } from './MenuItemSuggestion/MenuItemSuggestion';export type { MenuItemSwitchProps } from './MenuItemSwitch/MenuItemSwitch';export { MenuItemSwitch } from './MenuItemSwitch/MenuItemSwitch';-export type { MenuPickerProps } from './MenuPicker/MenuPicker';export { MenuPicker } from './MenuPicker/MenuPicker';+export type { MenuPickerProps } from './MenuPicker/types/MenuPickerProps';export { NavigationBar } from './NavigationBar/NavigationBar';export { NavigationBarItem } from './NavigationBarItem/NavigationBarItem';export { RawLink } from './RawLink/RawLink';diff --git a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/AppTooltip.tsx b/packages/twenty-ui/src/primitives/surfaces/AppTooltip/AppTooltip.tsxdeleted file mode 100644index a98207920df..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/AppTooltip.tsx+++ /dev/null@@ -1,405 +0,0 @@-import { Tooltip } from '@base-ui/react/tooltip';-import { isNonEmptyString } from '@sniptt/guards';-import { clsx } from 'clsx';-import { useEffect, useRef, useState } from 'react';-import { type IconComponent } from '@ui/icon/types/IconComponent';-import { useTheme, useThemeContainer } from '@ui/theme-constants';-import { isDefined } from '@ui/utilities/utils/isDefined';--import styles from './AppTooltip.module.scss';--export enum TooltipPosition {- Top = 'top',- Left = 'left',- Right = 'right',- Bottom = 'bottom',-}--export enum TooltipDelay {- noDelay = '0ms',- shortDelay = '300ms',- mediumDelay = '500ms',- longDelay = '1000ms',-}--// Same shapes as react-tooltip's PlacesType and PositionStrategy, kept for-// public API parity with the deprecated AppTooltip-type PlacesType =- | 'top'- | 'top-start'- | 'top-end'- | 'right'- | 'right-start'- | 'right-end'- | 'bottom'- | 'bottom-start'- | 'bottom-end'- | 'left'- | 'left-start'- | 'left-end';--type PositionStrategy = 'absolute' | 'fixed';--// react-tooltip's delayHide that the deprecated AppTooltip hardcoded-const HIDE_DELAY_MS = 20;--// react-tooltip's default anchor offset-const DEFAULT_OFFSET = 10;--export type AppTooltipProps = {- className?: string;- anchorSelect?: string;- offset?: number;- noArrow?: boolean;- hidden?: boolean;- place?: PlacesType;- delay?: TooltipDelay;- positionStrategy?: PositionStrategy;- interactive?: boolean;- maxWidth?: string;- isOpen?: boolean;- title?: string;- Icon?: IconComponent;- description?: string;- children?: React.ReactNode;-};--export const AppTooltip = ({- anchorSelect,- className,- title,- Icon,- description,- hidden = false,- noArrow = true,- offset,- delay = TooltipDelay.mediumDelay,- place,- positionStrategy,- children,- interactive,- maxWidth = '300px',- isOpen,-}: AppTooltipProps) => {- const getDelayInMis = (delay: TooltipDelay) => {- switch (delay) {- case TooltipDelay.noDelay:- return 0;- case TooltipDelay.shortDelay:- return 300;- case TooltipDelay.mediumDelay:- return 500;- case TooltipDelay.longDelay:- return 1000;- }- };-- const themeContainer = useThemeContainer();- const theme = useTheme();-- const [show, setShow] = useState(false);- const [anchorElements, setAnchorElements] = useState<Element[]>([]);- const [activeAnchor, setActiveAnchor] = useState<Element | null>(null);-- const showDelayTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(- undefined,- );- const hideDelayTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(- undefined,- );- // Mirrors react-tooltip's `rendered` flag: while the tooltip is still- // mounted (including its fade-out), re-entering an anchor reopens it- // without waiting for the show delay again- const isRenderedRef = useRef(false);- const isHoveringTooltipRef = useRef(false);-- const isControlled = isDefined(isOpen);- const delayShowMs = getDelayInMis(delay);-- // Track anchors matching the selector, including ones added to the DOM- // later, like react-tooltip does with its MutationObserver- useEffect(() => {- if (!isNonEmptyString(anchorSelect)) {- setAnchorElements([]);- return;- }-- const queryAnchorElements = () => {- try {- return Array.from(document.querySelectorAll(anchorSelect));- } catch {- return [];- }- };-- setAnchorElements(queryAnchorElements());-- const observer = new MutationObserver(() => {- setAnchorElements((previousAnchorElements) => {- const newAnchorElements = queryAnchorElements();-- const hasSameAnchors =- newAnchorElements.length === previousAnchorElements.length &&- newAnchorElements.every(- (anchorElement, index) =>- anchorElement === previousAnchorElements[index],- );-- return hasSameAnchors ? previousAnchorElements : newAnchorElements;- });- });-- // also watch data-tooltip-id like react-tooltip, since anchors are- // commonly matched with a [data-tooltip-id='...'] selector- observer.observe(document.body, {- childList: true,- subtree: true,- attributes: true,- attributeFilter: ['data-tooltip-id'],- });-- return () => observer.disconnect();- }, [anchorSelect]);-- // Like react-tooltip, fall back to the first matched anchor so that a- // controlled tooltip (isOpen) can position itself without a hover event- useEffect(() => {- if (isDefined(activeAnchor) && anchorElements.includes(activeAnchor)) {- return;- }-- setShow(false);- setActiveAnchor(anchorElements[0] ?? null);- }, [anchorElements, activeAnchor]);-- useEffect(() => {- if (hidden || anchorElements.length === 0) {- setShow(false);- isHoveringTooltipRef.current = false;- return;- }-- let hoveredAnchor: Element | null = null;- let focusedAnchor: Element | null = null;-- const handleShow = (value: boolean) => {- if (!isControlled) {- setShow(value);- }- };-- const handleAnchorEnter = (anchorElement: Element) => {- if (!anchorElement.isConnected) {- setActiveAnchor(null);- return;- }-- if (delayShowMs > 0) {- clearTimeout(showDelayTimerRef.current);- if (isRenderedRef.current) {- // the tooltip is already visible, ignore the show delay- handleShow(true);- } else {- showDelayTimerRef.current = setTimeout(() => {- handleShow(true);- }, delayShowMs);- }- } else {- handleShow(true);- }-- setActiveAnchor(anchorElement);- clearTimeout(hideDelayTimerRef.current);- };-- // Always defer the hide: a shared tooltip moved between anchors would- // otherwise unmount and remount, losing the popup node mid-swap.- const handleAnchorLeave = () => {- clearTimeout(showDelayTimerRef.current);- clearTimeout(hideDelayTimerRef.current);-- hideDelayTimerRef.current = setTimeout(() => {- if (isHoveringTooltipRef.current) {- return;- }- handleShow(false);- }, HIDE_DELAY_MS);- };-- // Dragging or replacing a row can prevent its mouseleave event. Only- // watched while an anchor is hovered, so idle tooltips cost nothing.- const handlePointerMove = (event: PointerEvent) => {- if (- isDefined(hoveredAnchor) &&- event.target instanceof Node &&- !hoveredAnchor.contains(event.target)- ) {- stopWatchingPointer();- if (!isDefined(focusedAnchor)) {- handleAnchorLeave();- }- }- };-- const stopWatchingPointer = () => {- hoveredAnchor = null;- document.removeEventListener('pointermove', handlePointerMove);- };-- const removeListeners = anchorElements.map((anchorElement) => {- const handleEnter = () => {- hoveredAnchor = anchorElement;- document.addEventListener('pointermove', handlePointerMove);- handleAnchorEnter(anchorElement);- };- // Keyboard focus keeps the tooltip up on its own, so only a blur closes- // one the anchor itself was focused into.- const handlePointerLeave = () => {- stopWatchingPointer();- if (isDefined(focusedAnchor)) {- return;- }- handleAnchorLeave();- };- const handleFocus = () => {- focusedAnchor = anchorElement;- handleAnchorEnter(anchorElement);- };- const handleBlur = () => {- focusedAnchor = null;- stopWatchingPointer();- handleAnchorLeave();- };-- // Deliberately not react-tooltip's mouseover/mouseout parity: those fire- // per descendant, so child-to-child movement restarted the show timer.- anchorElement.addEventListener('mouseenter', handleEnter);- anchorElement.addEventListener('mouseleave', handlePointerLeave);- anchorElement.addEventListener('focus', handleFocus);- anchorElement.addEventListener('blur', handleBlur);-- return () => {- anchorElement.removeEventListener('mouseenter', handleEnter);- anchorElement.removeEventListener('mouseleave', handlePointerLeave);- anchorElement.removeEventListener('focus', handleFocus);- anchorElement.removeEventListener('blur', handleBlur);- };- });-- return () => {- document.removeEventListener('pointermove', handlePointerMove);- removeListeners.forEach((removeListener) => removeListener());- clearTimeout(showDelayTimerRef.current);- clearTimeout(hideDelayTimerRef.current);- };- }, [anchorElements, isControlled, delayShowMs, interactive, hidden]);-- useEffect(() => {- return () => {- clearTimeout(showDelayTimerRef.current);- clearTimeout(hideDelayTimerRef.current);- };- }, []);-- const handleTooltipMouseEnter = () => {- isHoveringTooltipRef.current = true;- };-- const handleTooltipMouseLeave = () => {- isHoveringTooltipRef.current = false;- if (activeAnchor?.contains(activeAnchor.ownerDocument.activeElement)) {- return;- }- clearTimeout(hideDelayTimerRef.current);- hideDelayTimerRef.current = setTimeout(() => {- if (isHoveringTooltipRef.current) {- return;- }- if (!isControlled) {- setShow(false);- }- }, HIDE_DELAY_MS);- clearTimeout(showDelayTimerRef.current);- };-- const hasTitle = isNonEmptyString(title);- const hasDescription = isNonEmptyString(description);- const renderedContent =- hasTitle || hasDescription ? (- <>- <div className={styles.textContent}>- {hasTitle && (- <div className={styles.title}>- {isDefined(Icon) && (- <Icon- className={styles.icon}- size={theme.icon.size.sm}- aria-hidden- />- )}- <span>{title}</span>- </div>- )}- {hasDescription && (- <div className={styles.description}>{description}</div>- )}- </div>- {children}- </>- ) : (- children- );-- const isTooltipOpen =- !hidden &&- (isOpen ?? show) &&- Boolean(renderedContent) &&- isDefined(activeAnchor);-- useEffect(() => {- if (isTooltipOpen) {- isRenderedRef.current = true;- }- }, [isTooltipOpen]);-- const [parsedSide, parsedAlign] = (place ?? 'top').split('-');- const side = parsedSide as 'top' | 'right' | 'bottom' | 'left';- const align = (parsedAlign ?? 'center') as 'start' | 'center' | 'end';-- return (- <Tooltip.Root- open={isTooltipOpen}- onOpenChangeComplete={(openValue) => {- if (!openValue) {- isRenderedRef.current = false;- }- }}- >- <Tooltip.Portal container={themeContainer ?? undefined}>- <Tooltip.Positioner- anchor={activeAnchor}- side={side}- align={align}- sideOffset={offset ?? DEFAULT_OFFSET}- positionMethod={positionStrategy}- className={styles.positioner}- style={{ maxWidth }}- >- <Tooltip.Popup- role="tooltip"- className={clsx(- styles.tooltip,- interactive && styles.interactive,- className,- )}- onMouseEnter={interactive ? handleTooltipMouseEnter : undefined}- onMouseLeave={interactive ? handleTooltipMouseLeave : undefined}- >- {renderedContent}- {!noArrow && <Tooltip.Arrow className={styles.arrow} />}- </Tooltip.Popup>- </Tooltip.Positioner>- </Tooltip.Portal>- </Tooltip.Root>- );-};diff --git a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__stories__/Tooltip.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__stories__/Tooltip.stories.tsxdeleted file mode 100644index 1a0de7c58a1..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__stories__/Tooltip.stories.tsx+++ /dev/null@@ -1,349 +0,0 @@-import { type Meta, type StoryObj } from '@storybook/react-vite';-import { expect, fn, userEvent, waitFor, within } from 'storybook/test';--import { IconInfoCircle } from '@ui/icon';-import { Button } from '@ui/primitives/input/Button/Button';-import { Text } from '@ui/primitives/typography/Text/Text';-import {- A11Y_DEFER_COLOR_CONTRAST,- CatalogDecorator,- type CatalogStory,- ComponentDecorator,-} from '@ui/testing';--import {- AppTooltip as Tooltip,- TooltipDelay,- TooltipPosition,-} from '../AppTooltip';--const CUSTOM_CONTENT = (- <Text render={<span />}>- <strong>Custom</strong> formatted content- </Text>-);--const findTooltip = async (canvasElement: HTMLElement) => {- const tooltip = await within(canvasElement.ownerDocument.body).findByRole(- 'tooltip',- undefined,- { timeout: 5000 },- );-- await waitFor(() => expect(tooltip).toBeVisible(), { timeout: 5000 });-- return tooltip;-};--const onCustomActionClick = fn();--const meta: Meta<typeof Tooltip> = {- title: 'UI/Surfaces/Tooltip',- component: Tooltip,- args: {- title: 'Amount',- description: '',- anchorSelect: '#tooltip-anchor',- place: TooltipPosition.Bottom,- delay: TooltipDelay.mediumDelay,- },- argTypes: {- title: { control: 'text' },- description: { control: 'text' },- Icon: {- control: 'select',- options: ['None', 'Info'],- mapping: { None: undefined, Info: IconInfoCircle },- },- },- render: (args) => (- <>- <Button- type="button"- id={args.anchorSelect?.slice(1)}- aria-label="Hover or focus me"- >- Hover or focus me- </Button>- <Tooltip {...args} />- </>- ),- play: async ({ canvasElement, args }) => {- await userEvent.hover(within(canvasElement).getByRole('button'));-- const tooltip = await findTooltip(canvasElement);-- expect(tooltip.parentElement).toHaveStyle({- maxWidth: args.maxWidth ?? '300px',- });- if (args.title) {- expect(within(tooltip).getByText(args.title)).toBeVisible();- }- if (args.description) {- expect(within(tooltip).getByText(args.description)).toBeVisible();- }- if (args.Icon) {- expect(tooltip.querySelector('svg')).toHaveAttribute(- 'aria-hidden',- 'true',- );- }- expect(- tooltip.querySelector(':scope > [aria-hidden="true"]') !== null,- ).toBe(args.noArrow === false);- },-};--export default meta;-type Story = StoryObj<typeof Tooltip>;--export const Default: Story = {- decorators: [ComponentDecorator],-};--export const WithArrow: Story = {- args: { noArrow: false },- decorators: [ComponentDecorator],-};--export const WithDescription: Story = {- args: {- description: 'The amount of this opportunity',- delay: TooltipDelay.longDelay,- },- decorators: [ComponentDecorator],- play: async ({ canvasElement }) => {- await userEvent.hover(within(canvasElement).getByRole('button'));-- expect(- within(canvasElement.ownerDocument.body).queryByRole('tooltip'),- ).not.toBeInTheDocument();-- const tooltip = await findTooltip(canvasElement);- expect(within(tooltip).getByText('Amount')).toBeVisible();- expect(- within(tooltip).getByText('The amount of this opportunity'),- ).toBeVisible();- },-};--export const WithIcon: Story = {- args: {- description: 'The amount of this opportunity',- Icon: IconInfoCircle,- },- decorators: [ComponentDecorator],-};--export const DescriptionOnly: Story = {- args: { title: '', description: 'The amount of this opportunity' },- decorators: [ComponentDecorator],-};--export const KeyboardFocus: Story = {- args: {- description: 'The amount of this opportunity',- delay: TooltipDelay.longDelay,- },- decorators: [ComponentDecorator],- play: async ({ canvasElement }) => {- await userEvent.tab();-- expect(within(canvasElement).getByRole('button')).toHaveFocus();- const tooltip = await findTooltip(canvasElement);-- expect(tooltip).toHaveTextContent('The amount of this opportunity');-- await userEvent.tab();-- await waitFor(() =>- expect(- within(canvasElement.ownerDocument.body).queryByRole('tooltip'),- ).not.toBeInTheDocument(),- );- },-};--export const Hoverable: Story = {- args: { interactive: true },- decorators: [ComponentDecorator],-};--export const WithMaxWidth: Story = {- args: {- description:- 'A longer description that wraps naturally within the maximum tooltip width.',- maxWidth: '200px',- },- decorators: [ComponentDecorator],-};--export const CustomContent: Story = {- args: {- title: undefined,- description: undefined,- children: CUSTOM_CONTENT,- },- decorators: [ComponentDecorator],- play: async ({ canvasElement }) => {- await userEvent.hover(within(canvasElement).getByRole('button'));-- expect(await findTooltip(canvasElement)).toHaveTextContent(- 'Custom formatted content',- );- },-};--export const WithDescriptionAndCustomContent: Story = {- args: {- title: 'Amount',- description: 'The amount of this opportunity',- Icon: IconInfoCircle,- children: CUSTOM_CONTENT,- },- decorators: [ComponentDecorator],- play: async ({ canvasElement }) => {- await userEvent.hover(within(canvasElement).getByRole('button'));-- const tooltip = await findTooltip(canvasElement);-- expect(within(tooltip).getByText('Amount')).toBeVisible();- expect(- within(tooltip).getByText('The amount of this opportunity'),- ).toBeVisible();- expect(within(tooltip).getByText('Custom')).toBeVisible();- expect(tooltip).toHaveTextContent('Custom formatted content');- expect(tooltip.querySelector('svg')).toHaveAttribute('aria-hidden', 'true');- },-};--export const InteractiveCustomContent: Story = {- args: {- title: undefined,- description: undefined,- interactive: true,- children: (- <Button- type="button"- aria-label="Show more"- onClick={onCustomActionClick}- >- Show more- </Button>- ),- },- decorators: [ComponentDecorator],- play: async ({ canvasElement }) => {- await userEvent.hover(within(canvasElement).getByRole('button'));-- const tooltip = await findTooltip(canvasElement);-- await userEvent.hover(tooltip);- await userEvent.click(- within(tooltip).getByRole('button', { name: 'Show more' }),- );- expect(onCustomActionClick).toHaveBeenCalledTimes(1);- expect(tooltip).toBeVisible();-- await userEvent.unhover(tooltip);-- await waitFor(() =>- expect(- within(canvasElement.ownerDocument.body).queryByRole('tooltip'),- ).not.toBeInTheDocument(),- );- },-};--export const LongTitle: Story = {- args: {- title: 'LongUnbrokenFieldName'.repeat(10),- Icon: IconInfoCircle,- },- decorators: [ComponentDecorator],- play: async ({ canvasElement }) => {- await userEvent.hover(within(canvasElement).getByRole('button'));-- const tooltip = await findTooltip(canvasElement);-- expect(tooltip.scrollWidth).toBeLessThanOrEqual(tooltip.clientWidth);- expect(tooltip.getBoundingClientRect().width).toBeLessThanOrEqual(300);- },-};--export const Hidden: Story = {- args: { hidden: true, isOpen: true },- decorators: [ComponentDecorator],- play: async ({ canvasElement }) => {- await userEvent.hover(within(canvasElement).getByRole('button'));-- expect(- within(canvasElement.ownerDocument.body).queryByRole('tooltip'),- ).not.toBeInTheDocument();- },-};--export const Empty: Story = {- args: { title: '', description: '', Icon: IconInfoCircle, isOpen: true },- decorators: [ComponentDecorator],- play: async ({ canvasElement }) => {- await userEvent.hover(within(canvasElement).getByRole('button'));-- expect(- within(canvasElement.ownerDocument.body).queryByRole('tooltip'),- ).not.toBeInTheDocument();- },-};--export const Catalog: CatalogStory<Story, typeof Tooltip> = {- args: { isOpen: true },- play: async ({ canvasElement }) => {- const body = within(canvasElement.ownerDocument.body);-- await waitFor(() => expect(body.getAllByRole('tooltip')).toHaveLength(6));-- for (const tooltip of body.getAllByRole('tooltip')) {- await waitFor(() => expect(tooltip).toBeVisible());- }- },- parameters: {- a11y: A11Y_DEFER_COLOR_CONTRAST,- catalog: {- dimensions: [- {- name: 'Content',- values: [- 'title',- 'description',- 'icon',- 'description-only',- 'custom',- 'combined',- ],- props: (example: string) =>- example === 'custom'- ? {- anchorSelect: '#tooltip-custom',- title: undefined,- description: undefined,- Icon: undefined,- children: CUSTOM_CONTENT,- }- : {- anchorSelect: `#tooltip-${example}`,- title: example === 'description-only' ? '' : 'Amount',- description:- example === 'title' ? '' : 'The amount of this opportunity',- Icon:- example === 'icon' || example === 'combined'- ? IconInfoCircle- : undefined,- children: example === 'combined' ? CUSTOM_CONTENT : undefined,- },- },- ],- options: { elementContainer: { style: { margin: '60px 30px' } } },- },- },- decorators: [CatalogDecorator],-};diff --git a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__tests__/AppTooltip.test.tsx b/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__tests__/AppTooltip.test.tsxdeleted file mode 100644index be252a1b618..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__tests__/AppTooltip.test.tsx+++ /dev/null@@ -1,157 +0,0 @@-import { fireEvent, render, screen, waitFor } from '@testing-library/react';-import userEvent from '@testing-library/user-event';--import { AppTooltip, TooltipDelay } from '../AppTooltip';--describe('AppTooltip', () => {- it('closes on pointer leave even when a child retains focus', async () => {- const user = userEvent.setup();-- render(- <>- <div id="row">- <button>Folder</button>- </div>- <AppTooltip- anchorSelect="#row"- title="Click to edit"- delay={TooltipDelay.noDelay}- />- </>,- );-- const button = screen.getByRole('button');- await user.hover(button);- expect(await screen.findByRole('tooltip')).toBeVisible();- await user.click(button);- expect(button).toHaveFocus();- await user.unhover(button);-- await waitFor(() =>- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument(),- );- });-- it('stays open on pointer leave while the anchor itself holds focus', async () => {- const user = userEvent.setup();-- render(- <>- <span id="anchor" tabIndex={0}>- Domain Name- </span>- <AppTooltip- anchorSelect="#anchor"- title="The company website URL"- delay={TooltipDelay.noDelay}- />- </>,- );-- await user.tab();- const anchor = screen.getByText('Domain Name');- expect(anchor).toHaveFocus();- expect(await screen.findByRole('tooltip')).toBeVisible();-- await user.hover(anchor);- await user.unhover(anchor);-- expect(anchor).toHaveFocus();- expect(screen.getByRole('tooltip')).toBeVisible();- });-- it('opens for keyboard focus and closes on blur', async () => {- const user = userEvent.setup();-- render(- <>- <button id="anchor">Folder</button>- <button>Next</button>- <AppTooltip- anchorSelect="#anchor"- title="Click to edit"- delay={TooltipDelay.noDelay}- />- </>,- );-- await user.tab();- expect(await screen.findByRole('tooltip')).toBeVisible();- await user.tab();- await waitFor(() =>- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument(),- );- });- it('does not restore a stale tooltip after a menu closes', async () => {- const user = userEvent.setup();- const renderTooltip = (hidden: boolean) => (- <>- <button id="anchor">Folder</button>- <AppTooltip- anchorSelect="#anchor"- title="Folder tooltip"- hidden={hidden}- delay={TooltipDelay.noDelay}- />- </>- );- const { rerender } = render(renderTooltip(false));-- await user.hover(screen.getByRole('button'));- expect(await screen.findByRole('tooltip')).toBeVisible();- rerender(renderTooltip(true));- await user.unhover(screen.getByRole('button'));- rerender(renderTooltip(false));-- await waitFor(() =>- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument(),- );- await user.hover(screen.getByRole('button'));- expect(await screen.findByRole('tooltip')).toBeVisible();- });-- it('closes when a hovered anchor is replaced without a leave event', async () => {- const user = userEvent.setup();- const renderTooltip = (version: number) => (- <>- <button key={version} id="anchor">- Folder- </button>- <AppTooltip- anchorSelect="#anchor"- title="Folder tooltip"- delay={TooltipDelay.noDelay}- />- </>- );- const { rerender } = render(renderTooltip(0));-- await user.hover(screen.getByRole('button'));- expect(await screen.findByRole('tooltip')).toBeVisible();- rerender(renderTooltip(1));-- await waitFor(() =>- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument(),- );- });- it('closes on pointer movement outside even if mouseleave was missed', async () => {- const user = userEvent.setup();- render(- <>- <button id="anchor">Folder</button>- <AppTooltip- anchorSelect="#anchor"- title="Folder tooltip"- delay={TooltipDelay.noDelay}- />- </>,- );-- await user.hover(screen.getByRole('button'));- expect(await screen.findByRole('tooltip')).toBeVisible();- fireEvent.pointerMove(document.body);- await waitFor(() =>- expect(screen.queryByRole('tooltip')).not.toBeInTheDocument(),- );- });-});diff --git a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__tests__/AppTooltip.types.test.ts b/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__tests__/AppTooltip.types.test.tsdeleted file mode 100644index f8783a92b7f..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__tests__/AppTooltip.types.test.ts+++ /dev/null@@ -1,58 +0,0 @@-import { type ReactElement } from 'react';--import { type IconComponent } from '@ui/icon/types/IconComponent';--import { type AppTooltipProps } from '../AppTooltip';--type IsAssignableToTooltipProps<Props> = Props extends AppTooltipProps- ? true- : false;--describe('AppTooltip prop contract', () => {- it('accepts standard text or custom children on their own', () => {- const title: IsAssignableToTooltipProps<{ title: string }> = true;- const description: IsAssignableToTooltipProps<{ description: string }> =- true;- const standard: IsAssignableToTooltipProps<{- title: string;- Icon: IconComponent;- description: string;- }> = true;- const custom: IsAssignableToTooltipProps<{ children: ReactElement }> = true;-- expect([title, description, standard, custom]).toEqual([- true,- true,- true,- true,- ]);- });-- it('accepts custom children alongside standard content props', () => {- const title: IsAssignableToTooltipProps<{- title: string;- children: ReactElement;- }> = true;- const description: IsAssignableToTooltipProps<{- description: string;- children: ReactElement;- }> = true;- const icon: IsAssignableToTooltipProps<{- Icon: IconComponent;- children: ReactElement;- }> = true;- const combined: IsAssignableToTooltipProps<{- title: string;- description: string;- Icon: IconComponent;- children: ReactElement;- }> = true;-- expect([title, description, icon, combined]).toEqual([- true,- true,- true,- true,- ]);- });-});diff --git a/packages/twenty-ui/src/primitives/surfaces/OverflowingTextWithTooltip/OverflowingTextWithTooltip.tsx b/packages/twenty-ui/src/primitives/surfaces/OverflowingTextWithTooltip/OverflowingTextWithTooltip.tsxindex d7e3738423a..d46fc2623d3 100644--- a/packages/twenty-ui/src/primitives/surfaces/OverflowingTextWithTooltip/OverflowingTextWithTooltip.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/OverflowingTextWithTooltip/OverflowingTextWithTooltip.tsx@@ -1,22 +1,12 @@-import {- type KeyboardEvent,- type ReactNode,- useId,- useRef,- useState,-} from 'react';-import { createPortal } from 'react-dom';+import { memo, type MouseEvent, type ReactNode, useRef, useState } from 'react';import { isNonEmptyString } from '@sniptt/guards';import { clsx } from 'clsx';+import { Tooltip } from '@ui/primitives/surfaces/Tooltip/Tooltip';+import { type TooltipSide } from '@ui/primitives/surfaces/Tooltip/types/TooltipSide';import { LinkifiedText } from '@ui/primitives/typography/LinkifiedText/LinkifiedText';import { Text } from '@ui/primitives/typography/Text/Text';import { isDefined } from '@ui/utilities/utils/isDefined';-import {- AppTooltip,- TooltipDelay,- TooltipPosition,-} from '@ui/primitives/surfaces/AppTooltip/AppTooltip';import styles from './OverflowingTextWithTooltip.module.scss';@@ -24,8 +14,8 @@ type OverflowingTextWithTooltipProps = {size?: 'large' | 'small';isTooltipMultiline?: boolean;displayedMaxRows?: number;- tooltipDelay?: TooltipDelay;- tooltipPlace?: TooltipPosition;+ tooltipDelay?: number;+ tooltipPlace?: TooltipSide;alwaysShowTooltip?: boolean;isFocusable?: boolean;} & (@@ -39,142 +29,124 @@ type OverflowingTextWithTooltipProps = {});-export const OverflowingTextWithTooltip = ({- size = 'small',- text,- isTooltipMultiline,- displayedMaxRows,- tooltipContent,- tooltipDelay = TooltipDelay.mediumDelay,- tooltipPlace = TooltipPosition.Bottom,- alwaysShowTooltip = false,- isFocusable = false,-}: OverflowingTextWithTooltipProps) => {- const textElementId = `title-id-${useId().replace(/:/g, '')}`;-- const textRef = useRef<HTMLDivElement>(null);-- const [isTitleOverflowing, setIsTitleOverflowing] = useState(false);- const [shouldRenderTooltip, setShouldRenderTooltip] = useState(false);-- const handleShowTooltip = () => {- const isOverflowing = textRef.current- ? textRef.current?.scrollHeight > textRef.current?.clientHeight ||- textRef.current.scrollWidth > textRef.current.clientWidth- : false;-- setIsTitleOverflowing(isOverflowing);- setShouldRenderTooltip(true);- };-- const handleHideTooltip = () => {- setIsTitleOverflowing(false);- setShouldRenderTooltip(false);- };-- const handleMouseLeave = () => {- if (isFocusable && document.activeElement === textRef.current) {- return;- }-- handleHideTooltip();- };-- const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {- if (- event.key === 'Escape' &&- shouldRenderTooltip &&- (isTitleOverflowing || alwaysShowTooltip)- ) {+export const OverflowingTextWithTooltip = memo(+ function OverflowingTextWithTooltip({+ size = 'small',+ text,+ isTooltipMultiline,+ displayedMaxRows,+ tooltipContent,+ tooltipDelay = 500,+ tooltipPlace = 'bottom',+ alwaysShowTooltip = false,+ isFocusable = false,+ }: OverflowingTextWithTooltipProps) {+ const textRef = useRef<HTMLDivElement>(null);++ const [isTitleOverflowing, setIsTitleOverflowing] = useState(false);+ const [isTooltipOpen, setIsTooltipOpen] = useState(false);++ const updateOverflowState = () => {+ const textElement = textRef.current;+ const isOverflowing =+ isDefined(textElement) &&+ (textElement.scrollHeight > textElement.clientHeight ||+ textElement.scrollWidth > textElement.clientWidth);++ setIsTitleOverflowing(isOverflowing);++ return isOverflowing;+ };++ const handleOpenChange = (open: boolean) => {+ if (!open) {+ setIsTooltipOpen(false);++ return;+ }++ const isOverflowing = updateOverflowState();++ setIsTooltipOpen(isOverflowing || alwaysShowTooltip);+ };++ const handleTextClick = () => {+ textRef.current?.focus();+ handleOpenChange(true);+ };++ const handleTooltipClick = (event: MouseEvent<HTMLDivElement>) => {event.stopPropagation();- handleHideTooltip();- }- };-- const handleTextClick = () => {- textRef.current?.focus();- handleShowTooltip();- };-- const handleTooltipClick = (event: React.MouseEvent<HTMLDivElement>) => {- event.stopPropagation();- event.preventDefault();- };-- const tooltipText = isNonEmptyString(tooltipContent)- ? tooltipContent- : isNonEmptyString(text)- ? text- : null;-- return (- <>- {isDefined(displayedMaxRows) ? (- <Text- lineClamp={displayedMaxRows || 1}- data-testid="tooltip"- data-content-overflowing={isTitleOverflowing ? '' : undefined}- className={clsx(- styles.overflowingMultilineText,- size === 'large' && styles.large,- )}- ref={textRef}- id={textElementId}- tabIndex={isFocusable ? 0 : undefined}- onFocus={isFocusable ? handleShowTooltip : undefined}- onBlur={isFocusable ? handleHideTooltip : undefined}- onKeyDown={isFocusable ? handleKeyDown : undefined}- onClick={isFocusable ? handleTextClick : undefined}- onMouseEnter={handleShowTooltip}- onMouseLeave={handleMouseLeave}- >- {isNonEmptyString(text) ? <LinkifiedText text={text} /> : text}- </Text>- ) : (- <Text- truncate- data-testid="tooltip"- data-content-overflowing={isTitleOverflowing ? '' : undefined}- className={clsx(- styles.overflowingText,- size === 'large' && styles.large,- )}- ref={textRef}- id={textElementId}- tabIndex={isFocusable ? 0 : undefined}- onFocus={isFocusable ? handleShowTooltip : undefined}- onBlur={isFocusable ? handleHideTooltip : undefined}- onKeyDown={isFocusable ? handleKeyDown : undefined}- onClick={isFocusable ? handleTextClick : undefined}- onMouseEnter={handleShowTooltip}- onMouseLeave={handleMouseLeave}+ event.preventDefault();+ };++ const tooltipText = isNonEmptyString(tooltipContent)+ ? tooltipContent+ : isNonEmptyString(text)+ ? text+ : null;++ const isMultiline = isDefined(displayedMaxRows);++ return (+ <Tooltip.Root+ open={isTooltipOpen && isDefined(tooltipText)}+ onOpenChange={(...openChangeArguments) => {+ const [open, eventDetails] = openChangeArguments;+ const shouldKeepTooltipOpen =+ !open &&+ eventDetails.reason === 'trigger-hover' &&+ isFocusable &&+ document.activeElement === textRef.current;++ if (shouldKeepTooltipOpen) {+ eventDetails.cancel();++ return;+ }++ handleOpenChange(open);+ }}+ disabled={+ !isDefined(tooltipText) || (!isTitleOverflowing && !alwaysShowTooltip)+ }+ >+ <Tooltip.Trigger+ delay={tooltipDelay}+ closeOnClick={false}+ render={+ <Text+ {...(isMultiline+ ? { lineClamp: displayedMaxRows || 1 }+ : { truncate: true })}+ data-testid="tooltip"+ data-content-overflowing={isTitleOverflowing ? '' : undefined}+ className={clsx(+ isMultiline+ ? styles.overflowingMultilineText+ : styles.overflowingText,+ size === 'large' && styles.large,+ )}+ ref={textRef}+ tabIndex={isFocusable ? 0 : undefined}+ onPointerEnter={updateOverflowState}+ onFocus={isFocusable ? () => handleOpenChange(true) : undefined}+ onClick={isFocusable ? handleTextClick : undefined}+ >+ {isNonEmptyString(text) ? <LinkifiedText text={text} /> : text}+ </Text>+ }+ />+ <Tooltip.Popup+ className={isTooltipMultiline ? styles.multilineTooltip : undefined}+ sideOffset={5}+ side={tooltipPlace}+ positionMethod="absolute"+ onClick={handleTooltipClick}>- {isNonEmptyString(text) ? <LinkifiedText text={text} /> : text}- </Text>- )}-- {shouldRenderTooltip &&- (isTitleOverflowing || alwaysShowTooltip) &&- isDefined(tooltipText) &&- createPortal(- // oxlint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events- <div onClick={handleTooltipClick}>- <AppTooltip- anchorSelect={`#${textElementId}`}- title={tooltipText}- className={- isTooltipMultiline ? styles.multilineTooltip : undefined- }- offset={5}- noArrow- place={tooltipPlace}- positionStrategy="absolute"- delay={tooltipDelay}- isOpen={true}- />- </div>,- document.body,- )}- </>- );-};+ {tooltipText}+ </Tooltip.Popup>+ </Tooltip.Root>+ );+ },+);diff --git a/packages/twenty-ui/src/primitives/surfaces/OverflowingTextWithTooltip/__stories__/OverflowTextWithTooltip.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/OverflowingTextWithTooltip/__stories__/OverflowTextWithTooltip.stories.tsxindex 3e20a5b0d0e..d264c5bcf4c 100644--- a/packages/twenty-ui/src/primitives/surfaces/OverflowingTextWithTooltip/__stories__/OverflowTextWithTooltip.stories.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/OverflowingTextWithTooltip/__stories__/OverflowTextWithTooltip.stories.tsx@@ -1,5 +1,5 @@import { type Meta, type StoryObj } from '@storybook/react-vite';-import { userEvent, within } from 'storybook/test';+import { expect, userEvent, waitFor, within } from 'storybook/test';import { ComponentDecorator } from '@ui/testing';@@ -25,6 +25,12 @@ export const SingleLineOverflowing: Story = {const canvas = within(canvasElement);const tooltip = await canvas.findByTestId('tooltip');await userEvent.hover(tooltip);++ const canvasBody = within(canvasElement.ownerDocument.body);++ const popup = await canvasBody.findByRole('tooltip');++ await waitFor(() => expect(popup).toBeVisible());},};@@ -50,6 +56,12 @@ export const MultilineOverflowing: Story = {const canvas = within(canvasElement);const tooltip = await canvas.findByTestId('tooltip');await userEvent.hover(tooltip);++ const canvasBody = within(canvasElement.ownerDocument.body);++ const popup = await canvasBody.findByRole('tooltip');++ await waitFor(() => expect(popup).toBeVisible());},};@@ -80,6 +92,12 @@ export const SingleLineWithReactNodeOverflowing: Story = {const canvas = within(canvasElement);const tooltip = await canvas.findByTestId('tooltip');await userEvent.hover(tooltip);++ const canvasBody = within(canvasElement.ownerDocument.body);++ const popup = await canvasBody.findByRole('tooltip');++ await waitFor(() => expect(popup).toBeVisible());},};@@ -115,6 +133,12 @@ export const MultilineWithReactNodeOverflowing: Story = {const canvas = within(canvasElement);const tooltip = await canvas.findByTestId('tooltip');await userEvent.hover(tooltip);++ const canvasBody = within(canvasElement.ownerDocument.body);++ const popup = await canvasBody.findByRole('tooltip');++ await waitFor(() => expect(popup).toBeVisible());},};diff --git a/packages/twenty-ui/src/primitives/surfaces/OverflowingTextWithTooltip/__tests__/OverflowingTextWithTooltip.test.tsx b/packages/twenty-ui/src/primitives/surfaces/OverflowingTextWithTooltip/__tests__/OverflowingTextWithTooltip.test.tsxnew file mode 100644index 00000000000..33a21165a19--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/OverflowingTextWithTooltip/__tests__/OverflowingTextWithTooltip.test.tsx@@ -0,0 +1,160 @@+import { render, screen, waitFor } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import { describe, expect, it } from 'vitest';++import { Tooltip } from '@ui/primitives/surfaces/Tooltip/Tooltip';++import { OverflowingTextWithTooltip } from '../OverflowingTextWithTooltip';++const setTextDimensions = ({+ element,+ clientWidth,+ scrollWidth,+}: {+ element: HTMLElement;+ clientWidth: number;+ scrollWidth: number;+}) => {+ Object.defineProperties(element, {+ clientWidth: { value: clientWidth },+ scrollWidth: { value: scrollWidth },+ });+};++describe('OverflowingTextWithTooltip', () => {+ it('lets a parent tooltip open when the nested text fits', async () => {+ const user = userEvent.setup();++ render(+ <Tooltip content="Field label" delay={0}>+ <div>+ <OverflowingTextWithTooltip text="Short value" tooltipDelay={0} />+ </div>+ </Tooltip>,+ );++ const text = screen.getByText('Short value');++ setTextDimensions({ element: text, clientWidth: 100, scrollWidth: 80 });++ await user.hover(text);++ expect(await screen.findByRole('tooltip')).toHaveTextContent('Field label');+ });++ it('gives the nested tooltip priority when its text is truncated', async () => {+ const user = userEvent.setup();++ render(+ <Tooltip content="Field label" delay={0}>+ <div>+ <OverflowingTextWithTooltip text="Truncated value" tooltipDelay={0} />+ </div>+ </Tooltip>,+ );++ const text = screen.getByText('Truncated value');++ setTextDimensions({ element: text, clientWidth: 80, scrollWidth: 160 });++ await user.hover(text);++ expect(await screen.findByRole('tooltip')).toHaveTextContent(+ 'Truncated value',+ );+ expect(screen.getAllByRole('tooltip')).toHaveLength(1);+ });++ it('opens only when the text is truncated without adding a layout wrapper', async () => {+ const user = userEvent.setup();+ const { container } = render(+ <OverflowingTextWithTooltip text="Truncated label" tooltipDelay={0} />,+ );+ const text = screen.getByText('Truncated label');++ setTextDimensions({ element: text, clientWidth: 80, scrollWidth: 160 });++ expect(container.firstElementChild).toBe(text);++ await user.hover(text);++ expect(await screen.findByRole('tooltip')).toHaveTextContent(+ 'Truncated label',+ );+ });++ it('keeps text that fits hidden on keyboard focus', async () => {+ const user = userEvent.setup();++ render(<OverflowingTextWithTooltip text="Short label" isFocusable />);++ const text = screen.getByText('Short label');++ setTextDimensions({ element: text, clientWidth: 100, scrollWidth: 80 });++ await user.tab();++ expect(text).toHaveFocus();+ expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();+ });++ it('opens on focus and dismisses with Escape while retaining focus', async () => {+ const user = userEvent.setup();++ render(+ <OverflowingTextWithTooltip+ text="Short label"+ tooltipContent="Additional information"+ alwaysShowTooltip+ isFocusable+ />,+ );++ const text = screen.getByText('Short label');++ await user.tab();++ expect(await screen.findByRole('tooltip')).toHaveTextContent(+ 'Additional information',+ );++ await user.keyboard('{Escape}');++ await waitFor(() => {+ expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();+ });+ expect(text).toHaveFocus();+ });++ it('keeps the tooltip open while a clicked label retains focus', async () => {+ const user = userEvent.setup();++ render(+ <OverflowingTextWithTooltip+ text="Clickable label"+ alwaysShowTooltip+ isFocusable+ tooltipDelay={0}+ />,+ );++ const text = screen.getByText('Clickable label');++ await user.click(text);++ expect(await screen.findByRole('tooltip')).toHaveTextContent(+ 'Clickable label',+ );+ expect(text).toHaveFocus();++ await user.unhover(text);++ expect(screen.getByRole('tooltip')).toBeVisible();++ await user.tab();++ await waitFor(() => {+ expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();+ });+ });+});diff --git a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/AppTooltip.module.scss b/packages/twenty-ui/src/primitives/surfaces/Tooltip/Tooltip.module.scsssimilarity index 68%rename from packages/twenty-ui/src/primitives/surfaces/AppTooltip/AppTooltip.module.scssrename to packages/twenty-ui/src/primitives/surfaces/Tooltip/Tooltip.module.scssindex 041c5555359..02b2093092a 100644--- a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/AppTooltip.module.scss+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/Tooltip.module.scss@@ -1,11 +1,8 @@.positioner {- // the tooltip never intercepts pointer events unless interactive,- // like react-tooltip's core styles- pointer-events: none;z-index: var(--t-last-layer-z-index);}-.tooltip {+.popup {backdrop-filter: var(--t-blur-strong);background-color: var(--t-tooltip-background);border-radius: var(--t-border-radius-md);@@ -17,8 +14,8 @@overflow: visible;padding: var(--t-spacing-1) var(--t-spacing-1_5);word-break: break-word;- width: max-content;- max-width: 100%;+ inline-size: max-content;+ max-inline-size: min(100%, var(--available-width));will-change: opacity;transition: opacity 0.15s ease-out;@@ -35,7 +32,7 @@}}-.textContent {+.content {display: flex;flex-direction: column;line-height: var(--t-spacing-4);@@ -46,18 +43,23 @@display: flex;font-weight: var(--t-font-weight-medium);gap: var(--t-spacing-1);- min-width: 0;+ min-inline-size: 0;span {- min-width: 0;+ min-inline-size: 0;overflow-wrap: anywhere;}}.icon {flex-shrink: 0;- height: calc(var(--t-icon-size-sm) * 1px);- width: calc(var(--t-icon-size-sm) * 1px);+ align-items: center;+ display: inline-flex;++ & > svg {+ block-size: calc(var(--t-icon-size-sm) * 1px);+ inline-size: calc(var(--t-icon-size-sm) * 1px);+ }}.description {@@ -66,45 +68,47 @@white-space: pre-wrap;}-.interactive {- pointer-events: auto;-}-.arrow {- --tooltip-arrow-size: 6px;+ --tw-tooltip-arrow-size: 6px;position: absolute;background: inherit;&[data-side='top'],&[data-side='bottom'] {- width: calc(2 * var(--tooltip-arrow-size));- height: var(--tooltip-arrow-size);+ width: calc(2 * var(--tw-tooltip-arrow-size));+ height: var(--tw-tooltip-arrow-size);}&[data-side='left'],&[data-side='right'] {- width: var(--tooltip-arrow-size);- height: calc(2 * var(--tooltip-arrow-size));+ width: var(--tw-tooltip-arrow-size);+ height: calc(2 * var(--tw-tooltip-arrow-size));}&[data-side='top'] {- bottom: calc(-1 * var(--tooltip-arrow-size));+ bottom: calc(-1 * var(--tw-tooltip-arrow-size));clip-path: polygon(0 0, 100% 0, 50% 100%);}&[data-side='bottom'] {- top: calc(-1 * var(--tooltip-arrow-size));+ top: calc(-1 * var(--tw-tooltip-arrow-size));clip-path: polygon(50% 0, 100% 100%, 0 100%);}&[data-side='left'] {- right: calc(-1 * var(--tooltip-arrow-size));+ right: calc(-1 * var(--tw-tooltip-arrow-size));clip-path: polygon(0 0, 100% 50%, 0 100%);}&[data-side='right'] {- left: calc(-1 * var(--tooltip-arrow-size));+ left: calc(-1 * var(--tw-tooltip-arrow-size));clip-path: polygon(100% 0, 100% 100%, 0 50%);}}++@media (prefers-reduced-motion: reduce) {+ .popup {+ transition: none;+ }+}diff --git a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/AppTooltip.module.scss.d.ts b/packages/twenty-ui/src/primitives/surfaces/Tooltip/Tooltip.module.scss.d.tssimilarity index 66%rename from packages/twenty-ui/src/primitives/surfaces/AppTooltip/AppTooltip.module.scss.d.tsrename to packages/twenty-ui/src/primitives/surfaces/Tooltip/Tooltip.module.scss.d.tsindex 7d1f22a2cc4..7bea402e70e 100644--- a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/AppTooltip.module.scss.d.ts+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/Tooltip.module.scss.d.ts@@ -1,11 +1,10 @@declare const classNames: {readonly positioner: 'positioner';- readonly tooltip: 'tooltip';- readonly textContent: 'textContent';+ readonly popup: 'popup';+ readonly content: 'content';readonly title: 'title';readonly icon: 'icon';readonly description: 'description';- readonly interactive: 'interactive';readonly arrow: 'arrow';};export default classNames;diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/Tooltip.tsx b/packages/twenty-ui/src/primitives/surfaces/Tooltip/Tooltip.tsxnew file mode 100644index 00000000000..e54bf03cc8b--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/Tooltip.tsx@@ -0,0 +1,14 @@+import { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';++import { TooltipComponent } from './internal/TooltipComponent';+import { TooltipContent } from './internal/TooltipContent';+import { TooltipPopup } from './internal/TooltipPopup';++export const Tooltip = Object.assign(TooltipComponent, {+ Root: TooltipPrimitive.Root,+ Trigger: TooltipPrimitive.Trigger,+ Popup: TooltipPopup,+ Content: TooltipContent,+ Provider: TooltipPrimitive.Provider,+ createHandle: TooltipPrimitive.createHandle,+});diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/__stories__/Tooltip.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/Tooltip/__stories__/Tooltip.stories.tsxnew file mode 100644index 00000000000..841c7ea5331--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/__stories__/Tooltip.stories.tsx@@ -0,0 +1,194 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { useState } from 'react';+import { expect, userEvent, waitFor, within } from 'storybook/test';++import { IconInfoCircle } from '@ui/icon';+import { Button } from '@ui/primitives/input/Button/Button';+import { ComponentDecorator } from '@ui/testing';++import { Tooltip } from '../Tooltip';++const findTooltip = async (canvasElement: HTMLElement) => {+ const tooltip = await within(canvasElement.ownerDocument.body).findByRole(+ 'tooltip',+ );++ await waitFor(() => expect(tooltip).toBeVisible());++ return tooltip;+};++const meta: Meta<typeof Tooltip> = {+ title: 'UI/Surfaces/Tooltip',+ component: Tooltip,+ decorators: [ComponentDecorator],+ args: {+ content: 'Amount',+ side: 'bottom',+ delay: 300,+ },+ render: (args) => (+ <Tooltip {...args}>+ <span>+ <Button>Show details</Button>+ </span>+ </Tooltip>+ ),+ play: async ({ canvasElement }) => {+ await userEvent.hover(within(canvasElement).getByRole('button'));++ expect(await findTooltip(canvasElement)).toHaveTextContent('Amount');+ },+};++export default meta;+type Story = StoryObj<typeof Tooltip>;++export const Default: Story = {};++export const WithArrow: Story = {+ args: { arrow: true },+};++export const WithDescription: Story = {+ args: {+ content: (+ <Tooltip.Content description="The amount of this opportunity">+ Amount+ </Tooltip.Content>+ ),+ },+};++export const WithIcon: Story = {+ args: {+ content: (+ <Tooltip.Content+ startIcon={<IconInfoCircle />}+ description="The amount of this opportunity"+ >+ Amount+ </Tooltip.Content>+ ),+ },+};++export const KeyboardFocus: Story = {+ play: async ({ canvasElement }) => {+ await userEvent.tab();++ expect(within(canvasElement).getByRole('button')).toHaveFocus();+ expect(await findTooltip(canvasElement)).toHaveTextContent('Amount');++ await userEvent.keyboard('{Escape}');++ await waitFor(() =>+ expect(+ within(canvasElement.ownerDocument.body).queryByRole('tooltip'),+ ).not.toBeInTheDocument(),+ );+ expect(within(canvasElement).getByRole('button')).toHaveFocus();+ },+};++const ControlledExample = () => {+ const [open, setOpen] = useState(false);++ return (+ <Tooltip content="Amount" open={open} onOpenChange={setOpen}>+ <span>+ <Button>Show details</Button>+ </span>+ </Tooltip>+ );+};++export const Controlled: Story = {+ render: () => <ControlledExample />,+};++export const DisabledButton: Story = {+ render: (args) => (+ <Tooltip {...args}>+ <span>+ <Button disabled>Show details</Button>+ </span>+ </Tooltip>+ ),+};++export const Hoverable: Story = {+ args: { closeDelay: 100 },+ play: async ({ canvasElement }) => {+ await userEvent.hover(within(canvasElement).getByRole('button'));+ const tooltip = await findTooltip(canvasElement);++ await userEvent.hover(tooltip);+ expect(tooltip).toBeVisible();++ await userEvent.unhover(tooltip);++ await waitFor(() =>+ expect(+ within(canvasElement.ownerDocument.body).queryByRole('tooltip'),+ ).not.toBeInTheDocument(),+ );+ },+};++export const WithMaxWidth: Story = {+ args: {+ maxWidth: '200px',+ content: (+ <Tooltip.Content description="A longer description that wraps naturally within the maximum tooltip width.">+ Amount+ </Tooltip.Content>+ ),+ },+};++export const CustomContent: Story = {+ args: { content: <strong>Amount in workspace currency</strong> },+};++export const SharedPopup: Story = {+ render: () => (+ <Tooltip.Root<string>>+ {({ payload }) => (+ <>+ <Tooltip.Trigger payload="First amount" render={<span />}>+ <Button>First field</Button>+ </Tooltip.Trigger>+ <Tooltip.Trigger payload="Second amount" render={<span />}>+ <Button>Second field</Button>+ </Tooltip.Trigger>+ <Tooltip.Popup>{payload}</Tooltip.Popup>+ </>+ )}+ </Tooltip.Root>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.hover(canvas.getByRole('button', { name: 'First field' }));+ expect(await findTooltip(canvasElement)).toHaveTextContent('First amount');++ await userEvent.hover(canvas.getByRole('button', { name: 'Second field' }));++ await waitFor(() =>+ expect(+ within(canvasElement.ownerDocument.body).getByRole('tooltip'),+ ).toHaveTextContent('Second amount'),+ );+ },+};++export const Hidden: Story = {+ args: { disabled: true, open: true },+ play: async ({ canvasElement }) => {+ await userEvent.hover(within(canvasElement).getByRole('button'));++ expect(+ within(canvasElement.ownerDocument.body).queryByRole('tooltip'),+ ).not.toBeInTheDocument();+ },+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/__tests__/Tooltip.test.tsx b/packages/twenty-ui/src/primitives/surfaces/Tooltip/__tests__/Tooltip.test.tsxnew file mode 100644index 00000000000..ffe177acedc--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/__tests__/Tooltip.test.tsx@@ -0,0 +1,173 @@+import { render, screen, waitFor } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import { type ReactNode, useState } from 'react';+import { describe, expect, it, vi } from 'vitest';++import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';++import { Tooltip } from '../Tooltip';+import styles from '../Tooltip.module.scss';++const TooltipRootWrapper = ({ children }: { children: ReactNode }) => (+ <Tooltip.Root>{children}</Tooltip.Root>+);++const OpenTooltipWrapper = ({ children }: { children: ReactNode }) => (+ <Tooltip.Root open>{children}</Tooltip.Root>+);++runComponentConformance({+ name: 'Tooltip.Trigger',+ element: <Tooltip.Trigger>Details</Tooltip.Trigger>,+ refInstanceOf: HTMLButtonElement,+ wrapper: TooltipRootWrapper,+ renderPropTagName: 'button',+});++runComponentConformance({+ name: 'Tooltip.Popup',+ element: <Tooltip.Popup />,+ refInstanceOf: HTMLDivElement,+ wrapper: OpenTooltipWrapper,+ ownClassName: styles.popup,+});++runComponentConformance({+ name: 'Tooltip.Content',+ element: <Tooltip.Content>Details</Tooltip.Content>,+ refInstanceOf: HTMLDivElement,+ ownClassName: styles.content,+});++runComponentConformance({+ name: 'Tooltip',+ element: (+ <Tooltip content="Details" open>+ <button type="button">Trigger</button>+ </Tooltip>+ ),+ refInstanceOf: HTMLDivElement,+ ownClassName: styles.popup,+});++const ControlledTooltip = () => {+ const [open, setOpen] = useState(false);++ return (+ <Tooltip content="Controlled hint" open={open} onOpenChange={setOpen}>+ <button type="button">Details</button>+ </Tooltip>+ );+};++describe('Tooltip interactions', () => {+ it('can enable an uncontrolled tooltip without changing its state contract', async () => {+ const user = userEvent.setup();+ const consoleError = vi.spyOn(console, 'error');+ const { rerender } = render(+ <Tooltip content="Account details" disabled>+ <button type="button">Account</button>+ </Tooltip>,+ );++ rerender(+ <Tooltip content="Account details">+ <button type="button">Account</button>+ </Tooltip>,+ );+ await user.tab();++ expect(await screen.findByRole('tooltip')).toHaveTextContent(+ 'Account details',+ );+ expect(consoleError).not.toHaveBeenCalled();+ consoleError.mockRestore();+ });++ it('composes the existing trigger and preserves its handlers', async () => {+ const user = userEvent.setup();+ const onFocus = vi.fn();+ const onClick = vi.fn();+ const { container } = render(+ <Tooltip content="Account details">+ <button type="button" onFocus={onFocus} onClick={onClick}>+ Account+ </button>+ </Tooltip>,+ );++ expect(container.firstElementChild).toBe(screen.getByRole('button'));++ await user.tab();++ expect(onFocus).toHaveBeenCalledOnce();+ expect(await screen.findByRole('tooltip')).toHaveTextContent(+ 'Account details',+ );++ await user.click(screen.getByRole('button'));++ expect(onClick).toHaveBeenCalledOnce();+ await waitFor(() => expect(screen.queryByRole('tooltip')).toBeNull());+ });++ it('reports controlled opening and Escape dismissal', async () => {+ const user = userEvent.setup();+ render(<ControlledTooltip />);++ await user.tab();+ expect(await screen.findByRole('tooltip')).toHaveTextContent(+ 'Controlled hint',+ );++ await user.keyboard('{Escape}');++ await waitFor(() => expect(screen.queryByRole('tooltip')).toBeNull());+ expect(screen.getByRole('button')).toHaveFocus();+ });++ it('shares one popup across detached triggers with their own content', async () => {+ const user = userEvent.setup();+ const handle = Tooltip.createHandle<string>();+ render(+ <>+ <Tooltip.Trigger handle={handle} payload="First hint">+ First+ </Tooltip.Trigger>+ <Tooltip.Trigger handle={handle} payload="Second hint">+ Second+ </Tooltip.Trigger>+ <Tooltip.Root handle={handle}>+ {({ payload }) => <Tooltip.Popup>{payload}</Tooltip.Popup>}+ </Tooltip.Root>+ </>,+ );++ await user.tab();+ expect(await screen.findByRole('tooltip')).toHaveTextContent('First hint');++ await user.tab();++ await waitFor(() =>+ expect(screen.getByRole('tooltip')).toHaveTextContent('Second hint'),+ );+ expect(screen.getAllByRole('tooltip')).toHaveLength(1);+ });++ it('suppresses a disabled tooltip without disabling its action', async () => {+ const user = userEvent.setup();+ const onClick = vi.fn();+ render(+ <Tooltip content="Unavailable hint" disabled open>+ <button type="button" onClick={onClick}>+ Action+ </button>+ </Tooltip>,+ );++ await user.click(screen.getByRole('button'));++ expect(onClick).toHaveBeenCalledOnce();+ expect(screen.queryByRole('tooltip')).toBeNull();+ });+});diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/internal/TooltipComponent.tsx b/packages/twenty-ui/src/primitives/surfaces/Tooltip/internal/TooltipComponent.tsxnew file mode 100644index 00000000000..c7f01096fc0--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/internal/TooltipComponent.tsx@@ -0,0 +1,51 @@+import { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';++import { isDefined } from '@ui/utilities/utils/isDefined';++import { type TooltipProps } from '../types/TooltipProps';+import { TooltipPopup } from './TooltipPopup';++export const TooltipComponent = ({+ content,+ children,+ open,+ defaultOpen,+ onOpenChange,+ onOpenChangeComplete,+ disabled = false,+ disableHoverablePopup,+ trackCursorAxis,+ actionsRef,+ triggerId,+ defaultTriggerId,+ delay,+ closeDelay,+ closeOnClick,+ ...props+}: TooltipProps) => {+ const isDisabled =+ disabled || !isDefined(content) || content === '' || content === false;++ return (+ <TooltipPrimitive.Root+ open={isDefined(open) ? open && !isDisabled : undefined}+ defaultOpen={defaultOpen && !isDisabled}+ onOpenChange={onOpenChange}+ onOpenChangeComplete={onOpenChangeComplete}+ disabled={isDisabled}+ disableHoverablePopup={disableHoverablePopup}+ trackCursorAxis={trackCursorAxis}+ actionsRef={actionsRef}+ triggerId={triggerId}+ defaultTriggerId={defaultTriggerId}+ >+ <TooltipPrimitive.Trigger+ render={children}+ delay={delay}+ closeDelay={closeDelay}+ closeOnClick={closeOnClick}+ />+ <TooltipPopup {...props}>{content}</TooltipPopup>+ </TooltipPrimitive.Root>+ );+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/internal/TooltipContent.tsx b/packages/twenty-ui/src/primitives/surfaces/Tooltip/internal/TooltipContent.tsxnew file mode 100644index 00000000000..b64235f702c--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/internal/TooltipContent.tsx@@ -0,0 +1,43 @@+import { useRender } from '@base-ui/react/use-render';+import { clsx } from 'clsx';++import { isDefined } from '@ui/utilities/utils/isDefined';++import styles from '../Tooltip.module.scss';+import { type TooltipContentProps } from '../types/TooltipContentProps';++export const TooltipContent = ({+ children,+ description,+ startIcon,+ className,+ render,+ ref,+ ...props+}: TooltipContentProps) =>+ useRender({+ defaultTagName: 'div',+ render,+ ref,+ props: {+ ...props,+ className: clsx(styles.content, className),+ children: (+ <>+ {isDefined(children) && children !== '' && (+ <div className={styles.title}>+ {isDefined(startIcon) && (+ <span className={styles.icon} aria-hidden>+ {startIcon}+ </span>+ )}+ <span>{children}</span>+ </div>+ )}+ {isDefined(description) && (+ <div className={styles.description}>{description}</div>+ )}+ </>+ ),+ },+ });diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/internal/TooltipPopup.tsx b/packages/twenty-ui/src/primitives/surfaces/Tooltip/internal/TooltipPopup.tsxnew file mode 100644index 00000000000..eef5afe22ce--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/internal/TooltipPopup.tsx@@ -0,0 +1,72 @@+import { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';+import { isNumber, isString } from '@sniptt/guards';++import { useThemeContainer } from '@ui/theme-constants';+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import styles from '../Tooltip.module.scss';+import { type TooltipPopupProps } from '../types/TooltipPopupProps';+import { TooltipContent } from './TooltipContent';++const DEFAULT_SIDE_OFFSET = 10;+const DEFAULT_MAX_WIDTH = '300px';++export const TooltipPopup = ({+ side = 'top',+ align = 'center',+ sideOffset = DEFAULT_SIDE_OFFSET,+ alignOffset,+ anchor,+ positionMethod,+ collisionBoundary,+ collisionPadding,+ collisionAvoidance,+ sticky,+ disableAnchorTracking,+ arrow = false,+ maxWidth = DEFAULT_MAX_WIDTH,+ container,+ keepMounted,+ className,+ children,+ ...props+}: TooltipPopupProps) => {+ const themeContainer = useThemeContainer();+ const hasPlainTextContent = isString(children) || isNumber(children);++ return (+ <TooltipPrimitive.Portal+ container={container ?? themeContainer ?? undefined}+ keepMounted={keepMounted}+ >+ <TooltipPrimitive.Positioner+ side={side}+ align={align}+ sideOffset={sideOffset}+ alignOffset={alignOffset}+ anchor={anchor}+ positionMethod={positionMethod}+ collisionBoundary={collisionBoundary}+ collisionPadding={collisionPadding}+ collisionAvoidance={collisionAvoidance}+ sticky={sticky}+ disableAnchorTracking={disableAnchorTracking}+ className={styles.positioner}+ style={{ maxWidth }}+ >+ <TooltipPrimitive.Popup+ role="tooltip"+ {...props}+ className={mergeClassNames(styles.popup, className)}+ >+ {hasPlainTextContent ? (+ <TooltipContent>{children}</TooltipContent>+ ) : (+ children+ )}+ {arrow && <TooltipPrimitive.Arrow className={styles.arrow} />}+ </TooltipPrimitive.Popup>+ </TooltipPrimitive.Positioner>+ </TooltipPrimitive.Portal>+ );+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipAlign.ts b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipAlign.tsnew file mode 100644index 00000000000..f9c0e0d6310--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipAlign.ts@@ -0,0 +1 @@+export type TooltipAlign = 'start' | 'center' | 'end';diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipContentProps.ts b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipContentProps.tsnew file mode 100644index 00000000000..9675f8d79c7--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipContentProps.ts@@ -0,0 +1,7 @@+import { type useRender } from '@base-ui/react/use-render';+import { type ReactNode } from 'react';++export type TooltipContentProps = useRender.ComponentProps<'div'> & {+ description?: ReactNode;+ startIcon?: ReactNode;+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipPopupProps.ts b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipPopupProps.tsnew file mode 100644index 00000000000..6c895d8d2f6--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipPopupProps.ts@@ -0,0 +1,26 @@+import { type Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';+import { type CSSProperties } from 'react';++import { type TooltipAlign } from './TooltipAlign';+import { type TooltipSide } from './TooltipSide';++export type TooltipPopupProps = TooltipPrimitive.Popup.Props &+ Pick<+ TooltipPrimitive.Positioner.Props,+ | 'anchor'+ | 'sideOffset'+ | 'alignOffset'+ | 'positionMethod'+ | 'collisionBoundary'+ | 'collisionPadding'+ | 'collisionAvoidance'+ | 'sticky'+ | 'disableAnchorTracking'+ > & {+ side?: TooltipSide;+ align?: TooltipAlign;+ arrow?: boolean;+ maxWidth?: CSSProperties['maxWidth'];+ container?: TooltipPrimitive.Portal.Props['container'];+ keepMounted?: boolean;+ };diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipProps.ts b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipProps.tsnew file mode 100644index 00000000000..0bf326b7b7e--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipProps.ts@@ -0,0 +1,14 @@+import { type Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';+import { type ReactElement, type ReactNode } from 'react';++import { type TooltipPopupProps } from './TooltipPopupProps';++export type TooltipProps = Omit<TooltipPopupProps, 'children' | 'content'> &+ Omit<TooltipPrimitive.Root.Props, 'children' | 'handle'> &+ Pick<+ TooltipPrimitive.Trigger.Props,+ 'delay' | 'closeDelay' | 'closeOnClick'+ > & {+ content: ReactNode;+ children: ReactElement;+ };diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipProviderProps.ts b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipProviderProps.tsnew file mode 100644index 00000000000..0eee2236f09--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipProviderProps.ts@@ -0,0 +1,3 @@+import { type Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';++export type TooltipProviderProps = TooltipPrimitive.Provider.Props;diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipRootProps.ts b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipRootProps.tsnew file mode 100644index 00000000000..c2be602c7cc--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipRootProps.ts@@ -0,0 +1,4 @@+import { type Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';++export type TooltipRootProps<TPayload = unknown> =+ TooltipPrimitive.Root.Props<TPayload>;diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipSide.ts b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipSide.tsnew file mode 100644index 00000000000..7f8aaa14255--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipSide.ts@@ -0,0 +1 @@+export type TooltipSide = 'top' | 'right' | 'bottom' | 'left';diff --git a/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipTriggerProps.ts b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipTriggerProps.tsnew file mode 100644index 00000000000..da0e1bc2db7--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Tooltip/types/TooltipTriggerProps.ts@@ -0,0 +1,4 @@+import { type Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';++export type TooltipTriggerProps<TPayload = unknown> =+ TooltipPrimitive.Trigger.Props<TPayload>;diff --git a/packages/twenty-ui/src/primitives/surfaces/index.ts b/packages/twenty-ui/src/primitives/surfaces/index.tsindex c9dce700aed..2cba3b89772 100644--- a/packages/twenty-ui/src/primitives/surfaces/index.ts+++ b/packages/twenty-ui/src/primitives/surfaces/index.ts@@ -18,12 +18,6 @@ export type { AlertDialogRootProps } from './AlertDialog/types/AlertDialogRootPrexport type { AlertDialogSize } from './AlertDialog/types/AlertDialogSize';export type { AlertDialogTitleProps } from './AlertDialog/types/AlertDialogTitleProps';export type { AlertDialogTriggerProps } from './AlertDialog/types/AlertDialogTriggerProps';-export type { AppTooltipProps } from './AppTooltip/AppTooltip';-export {- TooltipPosition,- TooltipDelay,- AppTooltip,-} from './AppTooltip/AppTooltip';export { Card } from './Card/Card';export { CardContent } from './CardContent/CardContent';export { CardFooter } from './CardFooter/CardFooter';@@ -66,3 +60,12 @@ export type { PopoverRootProps } from './Popover/types/PopoverRootProps';export type { PopoverSide } from './Popover/types/PopoverSide';export type { PopoverTitleProps } from './Popover/types/PopoverTitleProps';export type { PopoverTriggerProps } from './Popover/types/PopoverTriggerProps';+export { Tooltip } from './Tooltip/Tooltip';+export type { TooltipAlign } from './Tooltip/types/TooltipAlign';+export type { TooltipContentProps } from './Tooltip/types/TooltipContentProps';+export type { TooltipPopupProps } from './Tooltip/types/TooltipPopupProps';+export type { TooltipProps } from './Tooltip/types/TooltipProps';+export type { TooltipProviderProps } from './Tooltip/types/TooltipProviderProps';+export type { TooltipRootProps } from './Tooltip/types/TooltipRootProps';+export type { TooltipSide } from './Tooltip/types/TooltipSide';+export type { TooltipTriggerProps } from './Tooltip/types/TooltipTriggerProps';