Skip to content

The open alternative to Salesforce, designed for AI.

Make Callout dismissal caller-owned (#27485)

Raphaël Bosi526daf42b188
diff --git a/packages/twenty-agent-skills/references/design/front-component-ui.md b/packages/twenty-agent-skills/references/design/front-component-ui.md
index d62a720dc74..a4a4ae7f906 100644
--- a/packages/twenty-agent-skills/references/design/front-component-ui.md
+++ b/packages/twenty-agent-skills/references/design/front-component-ui.md
@@ -380,7 +380,7 @@ Empty example:
```tsx
<Callout
- variant="secondary"
+ status="neutral"
title="No activity yet"
description="Activity will appear here once this record has timeline events."
/>
diff --git a/packages/twenty-docs/snippets/ui/generated/components/feedback/callout.mdx b/packages/twenty-docs/snippets/ui/generated/components/feedback/callout.mdx
index 3ce61129a29..dcefc32736d 100644
--- a/packages/twenty-docs/snippets/ui/generated/components/feedback/callout.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/components/feedback/callout.mdx
@@ -11,38 +11,118 @@
* npx nx generate:ui twenty-docs
*/}
-<ParamField body="action" type="{ label: string; onClick: () =&gt; void; }">
- Optional footer action with a label and onClick callback.
+<ParamField body="action" type="ReactNode">
+ Optional footer node. Use Callout.Action for the standard action or supply custom controls.
+</ParamField>
+
+<ParamField body="className" type="string">
+ Additional class names merged onto the root.
</ParamField>
<ParamField body="closeLabel" type="string" default="Close">
Accessible name of the dismiss button. Defaults to `Close`.
</ParamField>
-<ParamField body="description" type="string">
- Optional supporting text. Empty strings are hidden.
+<ParamField body="color" type="&quot;blue&quot; | &quot;gray&quot; | &quot;green&quot; | &quot;orange&quot; | &quot;red&quot;" default="status palette">
+ Palette override: gray, blue, green, orange, or red. Defaults to the status palette.
+</ParamField>
+
+<ParamField body="description" type="ReactNode">
+ Optional supporting content node. Empty slots are hidden.
</ParamField>
<ParamField body="fullWidth" type="boolean" default="false">
- Fills the available container width.
+ Removes the default 512px maximum width.
+</ParamField>
+
+<ParamField body="icon" type="ReactNode" default="decorative help icon">
+ Leading icon node. Defaults to a decorative help icon. Pass null to omit it.
+</ParamField>
+
+<ParamField body="onDismiss" type="(() =&gt; void)">
+ Shows a dismiss button and notifies the caller once per activation. The caller owns visibility.
+</ParamField>
+
+<ParamField body="ref" type="Ref&lt;HTMLDivElement&gt;">
+ Ref to the root div, or the element supplied through render.
+</ParamField>
+
+<ParamField body="render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, CalloutState&gt;">
+ Element or callback composition for the root. Receives status, variant, and color state.
+</ParamField>
+
+<ParamField body="status" type="&quot;error&quot; | &quot;info&quot; | &quot;neutral&quot; | &quot;success&quot; | &quot;warning&quot;" default="info">
+ Feedback meaning: neutral, info, success, warning, or error. Defaults to info.
+</ParamField>
+
+<ParamField body="style" type="CSSProperties">
+ Inline styles forwarded to the root.
+</ParamField>
+
+<ParamField body="title" type="ReactNode" required>
+ Main message node displayed beside the icon.
+</ParamField>
+
+<ParamField body="variant" type="&quot;soft&quot;" default="soft">
+ Supported appearance: soft.
+</ParamField>
+
+### Callout.Action
+
+<ParamField body="Action.className" type="string | ((state: ButtonState) =&gt; string | undefined)">
+ CSS class applied to the element, or a function that
+ returns a class based on the component's state.
+</ParamField>
+
+<ParamField body="Action.color" type="&quot;accent&quot; | &quot;danger&quot; | &quot;neutral&quot; | &quot;success&quot;">
+ Semantic color of the button.
+</ParamField>
+
+<ParamField body="Action.elevated" type="boolean">
+ Adds a shadow and backdrop blur. Neutral outline buttons also use elevated surface colors.
+</ParamField>
+
+<ParamField body="Action.endIcon" type="ReactNode">
+ Decorative content displayed after the label.
+</ParamField>
+
+<ParamField body="Action.focusableWhenDisabled" type="boolean" default="false">
+ Whether the button should be focusable when disabled.
+</ParamField>
+
+<ParamField body="Action.fullWidth" type="boolean">
+ Expands the button to fill its container width.
+</ParamField>
+
+<ParamField body="Action.href" type="string">
+ Destination URL. Enables native link semantics instead of button semantics.
+</ParamField>
+
+<ParamField body="Action.loading" type="boolean">
+ Shows a loading indicator and disables activation.
+</ParamField>
+
+<ParamField body="Action.loadingPosition" type="&quot;center&quot; | &quot;end&quot; | &quot;start&quot;">
+ Where the loading indicator appears. `center` hides the content while preserving its layout space; `start` and `end` keep children and the opposite icon visible and replace the corresponding icon with the spinner.
</ParamField>
-<ParamField body="Icon" type="IconComponent">
- Leading icon component. Defaults to the help icon.
+<ParamField body="Action.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, ButtonState&gt;">
+ Caller-supplied root element or renderer. Preserve a native button, or an anchor when `href` is set. Router integration belongs to the caller.
</ParamField>
-<ParamField body="isClosable" type="boolean" default="false">
- Shows a close button that hides the callout until it is remounted.
+<ParamField body="Action.shortcut" type="ShortcutDefinition">
+ Flat key array for simultaneous keys, or nested key arrays for an ordered sequence. Displayed on non-mobile screens.
</ParamField>
-<ParamField body="onClose" type="(() =&gt; void)">
- Called after the close button hides the callout.
+<ParamField body="Action.shortcutJoinLabel" type="string">
+ Localized text between sequence steps. Defaults to then.
</ParamField>
-<ParamField body="title" type="string" required>
- Main message displayed beside the icon.
+<ParamField body="Action.startIcon" type="ReactNode">
+ Decorative content displayed before the label.
</ParamField>
-<ParamField body="variant" type="&quot;error&quot; | &quot;info&quot; | &quot;neutral&quot; | &quot;success&quot; | &quot;warning&quot;" required>
- Semantic appearance: info, warning, error, neutral, or success.
+<ParamField body="Action.style" type="CSSProperties | ((state: ButtonState) =&gt; CSSProperties | undefined)">
+ Style applied to the element, or a function that
+ returns a style object based on the component's state.
</ParamField>
diff --git a/packages/twenty-docs/ui/components/feedback/callout.mdx b/packages/twenty-docs/ui/components/feedback/callout.mdx
index 75293e236b5..7ff94a0395a 100644
--- a/packages/twenty-docs/ui/components/feedback/callout.mdx
+++ b/packages/twenty-docs/ui/components/feedback/callout.mdx
@@ -1,31 +1,60 @@
---
title: Callout
-description: A message with semantic styling, an optional action, and dismissal.
+description: Feedback with node content, actions, and caller-owned dismissal.
---
import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';
import CalloutReference from '/snippets/ui/generated/components/feedback/callout.mdx';
-`Callout` combines a title, optional description, icon, and action. Choose `info`, `warning`, `error`, `neutral`, or `success` to match the message.
+`Callout` combines title, description, icon, and action nodes. Use `status` for `neutral`, `info`, `success`, `warning`, or `error`. It defaults to `info` and supports the `soft` appearance. The status selects a gray, blue, green, orange, or red palette; `color` overrides that palette without changing the meaning.
```tsx
+import { useState } from 'react';
import { Callout } from 'twenty-ui/components/feedback';
+import { IconAlertTriangle } from 'twenty-ui/icon';
+import { Button } from 'twenty-ui/primitives/input';
-export const ImportNotice = ({ onReview }: { onReview: () => void }) => (
- <Callout
- variant="warning"
- title="Some records need attention"
- description="Review the missing email addresses before importing."
- action={{ label: 'Review records', onClick: onReview }}
- isClosable
- closeLabel="Dismiss import notice"
- />
-);
+export const ImportNotice = ({ onReview }: { onReview: () => void }) => {
+ const [isVisible, setIsVisible] = useState(true);
+
+ return (
+ <>
+ {isVisible && (
+ <Callout
+ status="warning"
+ title="Some records need attention"
+ description="Review the missing email addresses before importing."
+ icon={<IconAlertTriangle size={16} aria-hidden="true" />}
+ action={
+ <Callout.Action onClick={onReview}>
+ Review records
+ </Callout.Action>
+ }
+ onDismiss={() => setIsVisible(false)}
+ closeLabel="Dismiss import notice"
+ />
+ )}
+ <Button onClick={() => setIsVisible(true)}>Show notice</Button>
+ </>
+ );
+};
```
-Closing a closable callout updates its internal visibility and calls `onClose`. Remount it to show it again. `fullWidth` fills its container. Use `Icon` to replace the default help icon.
+## Dismissal and labels
+
+Passing `onDismiss` exposes an accessible close button. Each pointer or keyboard activation calls it once. The callout remains rendered until its caller hides it. Omit `onDismiss` for a persistent message. `closeLabel` defaults to `Close`.
+
+Your application owns the content, actions, accessible names, and translations. Use `Callout.Action` for a small ghost button with regular font weight. It accepts Button props, including link attributes, disabled state, refs, and custom rendering; size and appearance are fixed. The action slot also accepts custom buttons, links, disabled controls, or multiple nodes. The default help icon is decorative; pass `icon={null}` to omit it or supply a node with appropriate accessible semantics. Twenty UI does not require an i18n provider.
+
+## Native integration
+
+Native attributes, `className`, `style`, and `ref` target the root `div`. Use `render` to compose a different root element or a callback receiving the root props and `{ status, variant, color }`. `title` and `description` are content slots. `fullWidth` removes the default 512px maximum width.
-The component does not add live-region semantics or forward native attributes. Put it in a separately labeled or announced region when that is needed.
+The component adds no live-region role or announcements. Supply native `role`, `aria-live`, and other accessible attributes when the surrounding workflow requires them.
+
+## Migration
+
+Replace the previous semantic `variant` with `status`, and constructor `Icon` with an `icon` node. Replace `{ label, onClick }` action objects with `Callout.Action` or custom controls. Replace `isClosable` and `onClose` with `onDismiss`, and conditionally render the callout in the caller when dismissal should hide it. Existing translated content and action labels stay in the application.
<StoryEmbed
storyId="ui-feedback-callout--default"
@@ -33,12 +62,6 @@ The component does not add live-region semantics or forward native attributes. P
height={280}
/>
-## Labels and dismissal
-
-Your application owns `title`, `description`, and `action.label`. Set `isClosable` to show a dismiss button and pass `closeLabel` for its accessible name. The default is `Close`.
-
-Pass labels from your application's localization system. Twenty UI does not require an i18n provider.
-
## Props
<CalloutReference />
diff --git a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
index b1f64bafd34..4b554155e68 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
@@ -64,7 +64,7 @@ import { sliderTest } from '@/__stories__/twenty-ui-gallery/utils/sliderTest';
import { toastTest } from '@/__stories__/twenty-ui-gallery/utils/toastTest';
import { avatarImageTest } from '@/__stories__/twenty-ui-gallery/utils/avatarImageTest';
import { colorSampleTest } from '@/__stories__/twenty-ui-gallery/utils/colorSampleTest';
-import { bannerTest } from '@/__stories__/twenty-ui-gallery/utils/bannerTest';
+import { calloutTest } from '@/__stories__/twenty-ui-gallery/utils/calloutTest';
const meta: Meta<typeof FrontComponentRenderer> = {
title: 'FrontComponent/Twenty UI Gallery',
@@ -92,12 +92,12 @@ export const DataDisplayPreact: Story = createGalleryStory({
export const FeedbackReact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-feedback-gallery',
runtime: 'react',
- play: bannerTest,
+ play: calloutTest,
});
export const FeedbackPreact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-feedback-gallery',
runtime: 'preact',
- play: bannerTest,
+ play: calloutTest,
});
export const ProgressReact: Story = createGalleryStory({
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/callout-gallery-example.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/callout-gallery-example.tsx
new file mode 100644
index 00000000000..35dcc8d2a03
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/callout-gallery-example.tsx
@@ -0,0 +1,80 @@
+import { createElement, useState } from 'react';
+import { isDefined } from 'twenty-shared/utils';
+import { Callout } from 'twenty-ui/components/feedback';
+import { IconAlertTriangle } from 'twenty-ui/icon';
+import { Button } from 'twenty-ui/primitives/input';
+import { Text } from 'twenty-ui/primitives/typography';
+import { themeCssVariables } from 'twenty-ui/theme';
+
+export const CalloutGalleryExample = () => {
+ const [dismissRequests, setDismissRequests] = useState(0);
+ const [retryAttempts, setRetryAttempts] = useState(0);
+ const [isVisible, setIsVisible] = useState(true);
+
+ return (
+ <>
+ <Callout
+ title={<Text render={<span />}>Import needs review</Text>}
+ description={
+ <Text render={<span />}>
+ Review{' '}
+ <Button variant="link" href="#records">
+ missing records
+ </Button>
+ .
+ </Text>
+ }
+ icon={
+ <IconAlertTriangle
+ size={themeCssVariables.icon.size.md}
+ aria-label="Import warning"
+ />
+ }
+ action={
+ <>
+ <Callout.Action
+ onClick={() => setRetryAttempts((count) => count + 1)}
+ >
+ Retry callout
+ </Callout.Action>
+ <Button disabled>Unavailable action</Button>
+ </>
+ }
+ status="warning"
+ color="blue"
+ onDismiss={() => setDismissRequests((count) => count + 1)}
+ closeLabel="Request dismissal"
+ className="custom-callout"
+ style={{ marginTop: 7 }}
+ aria-label="Import notice"
+ render={<section data-composed="true" />}
+ ref={(element) => {
+ if (isDefined(element)) element.dataset.refTag = element.tagName;
+ }}
+ />
+ <Text>Dismiss requests: {dismissRequests}</Text>
+ <Text>Retry attempts: {retryAttempts}</Text>
+ {isVisible && (
+ <Callout
+ title="Caller-owned notice"
+ onDismiss={() => setIsVisible(false)}
+ closeLabel="Dismiss controlled notice"
+ role="status"
+ aria-live="polite"
+ aria-label="Controlled notice"
+ render={(props, state) =>
+ createElement('article', {
+ ...props,
+ 'data-render-status': state.status,
+ })
+ }
+ ref={(element) => {
+ if (isDefined(element)) element.dataset.refTag = element.tagName;
+ }}
+ />
+ )}
+ <Button onClick={() => setIsVisible(true)}>Show callout</Button>
+ <Callout title="Persistent notice" icon={null} />
+ </>
+ );
+};
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-feedback-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-feedback-gallery.front-component.tsx
index 9b3d8e22784..cd65b45232b 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-feedback-gallery.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-feedback-gallery.front-component.tsx
@@ -1,6 +1,6 @@
import { createElement } from 'react';
import { defineFrontComponent } from 'twenty-sdk/define';
-import { Callout, InlineBanner } from 'twenty-ui/components/feedback';
+import { InlineBanner } from 'twenty-ui/components/feedback';
import {
Banner,
Loader,
@@ -15,6 +15,7 @@ import {
ComponentGallery,
type GalleryEntry,
} from '../shared/front-components/component-gallery';
+import { CalloutGalleryExample } from './callout-gallery-example';
const FEEDBACK_ENTRIES: GalleryEntry[] = [
{
@@ -40,9 +41,7 @@ const FEEDBACK_ENTRIES: GalleryEntry[] = [
},
{
name: 'Callout',
- node: (
- <Callout variant="info" title="Info" description="A short description." />
- ),
+ node: <CalloutGalleryExample />,
},
{
name: 'InlineBanner compact link',
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-label-overrides.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-label-overrides.front-component.tsx
index ce5fc772d28..be3510fc115 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-label-overrides.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-label-overrides.front-component.tsx
@@ -1,3 +1,4 @@
+import { useState } from 'react';
import { defineFrontComponent } from 'twenty-sdk/define';
import { Callout } from 'twenty-ui/components/feedback';
import { MenuItem } from 'twenty-ui/components/navigation';
@@ -6,15 +7,18 @@ import { ListItem } from 'twenty-ui/primitives/navigation';
import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';
const LabelOverrides = () => {
+ const [isSuppliedVisible, setIsSuppliedVisible] = useState(true);
return (
<TwentyUiGalleryCard title="Label overrides">
- <Callout variant="info" title="Default notice" isClosable />
- <Callout
- variant="info"
- title="Supplied notice"
- isClosable
- closeLabel="Dismiss notice"
- />
+ <Callout status="info" title="Default notice" onDismiss={() => {}} />
+ {isSuppliedVisible && (
+ <Callout
+ status="info"
+ title="Supplied notice"
+ onDismiss={() => setIsSuppliedVisible(false)}
+ closeLabel="Dismiss notice"
+ />
+ )}
<ListItem shortcut={[['G'], ['D']]}>Default shortcut</ListItem>
<ListItem shortcut={[['G'], ['S']]} shortcutJoinLabel="followed by">
Supplied shortcut
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-reading-directions.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-reading-directions.front-component.tsx
index 579646d238d..0deeacbc883 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-reading-directions.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-reading-directions.front-component.tsx
@@ -37,7 +37,7 @@ const DirectionalLayoutExample = ({
</div>
</DirectionProvider>
<Callout
- variant="info"
+ status="info"
title="Account details"
description="Review the information before continuing."
/>
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/calloutTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/calloutTest.ts
new file mode 100644
index 00000000000..f070db1f2aa
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/calloutTest.ts
@@ -0,0 +1,81 @@
+import { expect, userEvent, waitFor, within } from 'storybook/test';
+
+import { errorHandler } from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';
+import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
+import { bannerTest } from '@/__stories__/twenty-ui-gallery/utils/bannerTest';
+
+export const calloutTest: TwentyUiGalleryPlayFunction = async (context) => {
+ await bannerTest(context);
+ const canvas = within(context.canvasElement);
+ const callout = canvas.getByRole('region', { name: 'Import notice' });
+ await waitFor(() =>
+ expect(callout).toHaveAttribute('data-ref-tag', 'HTML-SECTION'),
+ );
+ expect(callout.tagName).toBe('SECTION');
+ expect(callout).toHaveAttribute('data-composed', 'true');
+ expect(callout).toHaveAttribute('data-status', 'warning');
+ expect(callout).toHaveAttribute('data-variant', 'soft');
+ expect(callout).toHaveAttribute('data-color', 'blue');
+ expect(callout).toHaveClass('custom-callout');
+ expect(callout).toHaveStyle({ marginTop: '7px' });
+ expect(callout).not.toHaveAttribute('role');
+ expect(callout).not.toHaveAttribute('aria-live');
+ expect(canvas.getByLabelText('Import warning')).toBeVisible();
+ expect(canvas.getByRole('link', { name: 'missing records' })).toHaveAttribute(
+ 'href',
+ '#records',
+ );
+ const close = canvas.getByRole('button', { name: 'Request dismissal' });
+ await userEvent.click(close);
+ await waitFor(() =>
+ expect(canvas.getByText('Dismiss requests: 1')).toBeVisible(),
+ );
+ await userEvent.keyboard('{Enter}');
+ await waitFor(() =>
+ expect(canvas.getByText('Dismiss requests: 2')).toBeVisible(),
+ );
+ await userEvent.keyboard(' ');
+ await waitFor(() =>
+ expect(canvas.getByText('Dismiss requests: 3')).toBeVisible(),
+ );
+ expect(canvas.getByText('Import needs review')).toBeVisible();
+ const action = canvas.getByRole('button', { name: 'Retry callout' });
+ const regularFontWeight = getComputedStyle(action)
+ .getPropertyValue('--t-font-weight-regular')
+ .trim();
+ expect(action).toHaveStyle({ fontWeight: regularFontWeight });
+ await userEvent.click(action);
+ await waitFor(() =>
+ expect(canvas.getByText('Retry attempts: 1')).toBeVisible(),
+ );
+ expect(
+ canvas.getByRole('button', { name: 'Unavailable action' }),
+ ).toBeDisabled();
+ const controlled = canvas.getByRole('status', { name: 'Controlled notice' });
+ await waitFor(() =>
+ expect(controlled).toHaveAttribute('data-ref-tag', 'HTML-ARTICLE'),
+ );
+ expect(controlled).toHaveAttribute('data-render-status', 'info');
+ expect(controlled).toHaveAttribute('aria-live', 'polite');
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Dismiss controlled notice' }),
+ );
+ await waitFor(() =>
+ expect(canvas.queryByText('Caller-owned notice')).not.toBeInTheDocument(),
+ );
+ await userEvent.click(canvas.getByRole('button', { name: 'Show callout' }));
+ await waitFor(() =>
+ expect(canvas.getByText('Caller-owned notice')).toBeVisible(),
+ );
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Dismiss controlled notice' }),
+ );
+ await waitFor(() =>
+ expect(canvas.queryByText('Caller-owned notice')).not.toBeInTheDocument(),
+ );
+ expect(canvas.getByText('Persistent notice')).toBeVisible();
+ expect(
+ canvas.queryByRole('button', { name: 'Close' }),
+ ).not.toBeInTheDocument();
+ expect(errorHandler).not.toHaveBeenCalled();
+};
diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventComposerFields.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventComposerFields.tsx
index f153e14b439..42f861a47b5 100644
--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventComposerFields.tsx
+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventComposerFields.tsx
@@ -304,7 +304,7 @@ export const CalendarEventComposerFields = ({
<StyledNoticesContainer>
{composerState.accountOptions.length === 0 && (
<Callout
- variant="warning"
+ status="warning"
title={t`Connect a calendar account`}
description={
isDefined(onAddAccount)
@@ -312,15 +312,18 @@ export const CalendarEventComposerFields = ({
: t`Ask a workspace admin for the Sync Account permission to connect a calendar account.`
}
action={
- isDefined(onAddAccount)
- ? { label: t`Add account`, onClick: onAddAccount }
- : undefined
+ isDefined(onAddAccount) ? (
+ <Callout.Action
+ type="button"
+ onClick={onAddAccount}
+ >{t`Add account`}</Callout.Action>
+ ) : undefined
}
/>
)}
{composerState.missingScopes.length > 0 && (
<Callout
- variant="error"
+ status="error"
title={t`Calendar access needs approval`}
description={
isDefined(onReauthorize)
@@ -328,15 +331,18 @@ export const CalendarEventComposerFields = ({
: t`Ask a workspace admin for the Sync Account permission to reconnect this account.`
}
action={
- isDefined(onReauthorize)
- ? { label: t`Reconnect`, onClick: onReauthorize }
- : undefined
+ isDefined(onReauthorize) ? (
+ <Callout.Action
+ type="button"
+ onClick={onReauthorize}
+ >{t`Reconnect`}</Callout.Action>
+ ) : undefined
}
/>
)}
{!composerState.hasValidDateRange && (
<Callout
- variant="warning"
+ status="warning"
title={t`Check the event dates`}
description={
composerState.isFullDay
@@ -347,7 +353,7 @@ export const CalendarEventComposerFields = ({
)}
{composerState.hasTooManyAttendees && (
<Callout
- variant="warning"
+ status="warning"
title={t`Too many guests`}
description={t`Remove some guests before creating this event.`}
/>
diff --git a/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionTriggersTab.tsx b/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionTriggersTab.tsx
index add08617c3a..a16cc92d870 100644
--- a/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionTriggersTab.tsx
+++ b/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionTriggersTab.tsx
@@ -51,8 +51,13 @@ export const SettingsLogicFunctionTriggersTab = ({
return isDefined(applicationName) ? (
<StyledCalloutWrapper>
<Callout
- variant="info"
- Icon={IconInfoCircle}
+ status="info"
+ icon={
+ <IconInfoCircle
+ size={themeCssVariables.icon.size.md}
+ aria-hidden="true"
+ />
+ }
title={t`Bundled with ${applicationName}`}
description={t`This function has no trigger configured, so it can only be invoked from the Test tab or by other functions.`}
/>
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateCalendarEvent.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateCalendarEvent.tsx
index 9dee217fb0c..aedd0cc95d3 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateCalendarEvent.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateCalendarEvent.tsx
@@ -131,7 +131,7 @@ export const WorkflowEditActionCreateCalendarEvent = ({
/>
{isDefined(missingScopes) && (
<Callout
- variant={'error'}
+ status={'error'}
title={t`Missing calendar permission.`}
description={
hasConnectedAccountsPermission
@@ -139,9 +139,12 @@ export const WorkflowEditActionCreateCalendarEvent = ({
: t`Ask a workspace admin for the Sync Account permission to reconnect this account.`
}
action={
- hasConnectedAccountsPermission
- ? { label: t`Reauthorize`, onClick: handleReauthorize }
- : undefined
+ hasConnectedAccountsPermission ? (
+ <Callout.Action
+ type="button"
+ onClick={handleReauthorize}
+ >{t`Reauthorize`}</Callout.Action>
+ ) : undefined
}
/>
)}
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx
index 1efe20c7435..d38c0ec3eab 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx
@@ -255,7 +255,7 @@ export const WorkflowEditActionEmailBase = ({
{isDefined(missingScopes) && (
<>
<Callout
- variant={'error'}
+ status={'error'}
title={t`Missing email draft permission.`}
description={
hasConnectedAccountsPermission
@@ -263,9 +263,12 @@ export const WorkflowEditActionEmailBase = ({
: t`Ask a workspace admin for the Sync Account permission to reconnect this account.`
}
action={
- hasConnectedAccountsPermission
- ? { label: t`Reauthorize`, onClick: handleReauthorize }
- : undefined
+ hasConnectedAccountsPermission ? (
+ <Callout.Action
+ type="button"
+ onClick={handleReauthorize}
+ >{t`Reauthorize`}</Callout.Action>
+ ) : undefined
}
/>
</>
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx
index f9a2b080402..8277c5d319b 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx
@@ -265,22 +265,29 @@ export const WorkflowEditActionFormBuilder = ({
{triggerType && triggerType !== 'MANUAL' && isCalloutVisible && (
<StyledCalloutContainer>
<Callout
- variant={'warning'}
- Icon={IconAlertTriangle}
+ status={'warning'}
+ icon={
+ <IconAlertTriangle
+ size={themeCssVariables.icon.size.md}
+ aria-hidden="true"
+ />
+ }
title={t`Forms are meant for manual triggers`}
description={t`A form opens for the person who launches the workflow and is filled in on the spot. With this trigger, it only shows in the workflow run. To ask someone for an answer or an approval in their inbox, use a Send to Inbox step instead.`}
- isClosable
closeLabel={t`Close`}
- onClose={() => setIsCalloutVisible(false)}
- action={{
- label: t`Learn more`,
- onClick: () =>
- window.open(
- 'https://docs.twenty.com/user-guide/workflows/capabilities/workflow-actions#form',
- '_blank',
- 'noopener,noreferrer',
- ),
- }}
+ onDismiss={() => setIsCalloutVisible(false)}
+ action={
+ <Callout.Action
+ type="button"
+ onClick={() =>
+ window.open(
+ 'https://docs.twenty.com/user-guide/workflows/capabilities/workflow-actions#form',
+ '_blank',
+ 'noopener,noreferrer',
+ )
+ }
+ >{t`Learn more`}</Callout.Action>
+ }
/>
</StyledCalloutContainer>
)}
@@ -298,8 +305,7 @@ export const WorkflowEditActionFormBuilder = ({
{formData.length === 0 && (
<StyledNotClosableCalloutContainer>
<Callout
- variant={'neutral'}
- isClosable={false}
+ status={'neutral'}
title={t`Add inputs to your form`}
description={t`Click on "Add Field" below to add the first input to your form. The form pops up for the person who launches the workflow manually. For workflows with other triggers, it is filled in from the workflow run.`}
/>
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/logic-function-action/components/WorkflowEditActionLogicFunction.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/logic-function-action/components/WorkflowEditActionLogicFunction.tsx
index 79c04e15c83..178f1da7fe3 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/logic-function-action/components/WorkflowEditActionLogicFunction.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/logic-function-action/components/WorkflowEditActionLogicFunction.tsx
@@ -261,7 +261,7 @@ export const WorkflowEditActionLogicFunction = ({
/>
) : (
<Callout
- variant={'neutral'}
+ status={'neutral'}
title={t`No input fields for this action`}
description={t`You can see the function logic in your application settings.`}
/>
diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationHealthBanner.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationHealthBanner.tsx
index d337f6a459e..5baafd25234 100644
--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationHealthBanner.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationHealthBanner.tsx
@@ -1,5 +1,6 @@
import { isDefined } from 'twenty-shared/utils';
import { Callout } from 'twenty-ui/components/feedback';
+import { themeCssVariables } from 'twenty-ui/theme';
import { type ApplicationHealthStatus } from '~/generated-metadata/graphql';
import { getApplicationHealthBannerAppearance } from '~/pages/settings/applications/utils/getApplicationHealthBannerAppearance';
@@ -24,11 +25,22 @@ export const SettingsApplicationHealthBanner = ({
return (
<Callout
- variant={appearance.variant}
- Icon={appearance.Icon}
+ status={appearance.status}
+ icon={
+ <appearance.Icon
+ size={themeCssVariables.icon.size.md}
+ aria-hidden={true}
+ />
+ }
title={title}
description={description}
- action={action}
+ action={
+ isDefined(action) ? (
+ <Callout.Action type="button" onClick={action.onClick}>
+ {action.label}
+ </Callout.Action>
+ ) : undefined
+ }
fullWidth
/>
);
diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx
index eeecc5fcc11..5afc675c599 100644
--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx
@@ -227,23 +227,25 @@ export const SettingsClaimApplicationSection = () => {
{isDefined(claimError) && (
<StyledCalloutContainer>
<Callout
- variant="error"
+ status="error"
title={t`Could not claim this application`}
description={i18n._(claimError.message)}
- action={{
- label: t`Read documentation`,
- onClick: () =>
- window.open(
- getDocumentationUrl({
- locale: currentWorkspaceMember?.locale,
- path: claimError.docPath,
- }),
- '_blank',
- ),
- }}
- isClosable
+ action={
+ <Callout.Action
+ type="button"
+ onClick={() =>
+ window.open(
+ getDocumentationUrl({
+ locale: currentWorkspaceMember?.locale,
+ path: claimError.docPath,
+ }),
+ '_blank',
+ )
+ }
+ >{t`Read documentation`}</Callout.Action>
+ }
closeLabel={t`Close`}
- onClose={dismissClaimError}
+ onDismiss={dismissClaimError}
/>
</StyledCalloutContainer>
)}
diff --git a/packages/twenty-front/src/pages/settings/applications/utils/__tests__/getApplicationHealthBannerAppearance.test.ts b/packages/twenty-front/src/pages/settings/applications/utils/__tests__/getApplicationHealthBannerAppearance.test.ts
index bc04bdd6bbb..961b41e7e3d 100644
--- a/packages/twenty-front/src/pages/settings/applications/utils/__tests__/getApplicationHealthBannerAppearance.test.ts
+++ b/packages/twenty-front/src/pages/settings/applications/utils/__tests__/getApplicationHealthBannerAppearance.test.ts
@@ -3,16 +3,19 @@ import { getApplicationHealthBannerAppearance } from '~/pages/settings/applicati
describe('getApplicationHealthBannerAppearance', () => {
it.each([
- [ApplicationHealthStatus.SUCCESS, 'success'],
- [ApplicationHealthStatus.INFO, 'info'],
- [ApplicationHealthStatus.WARNING, 'warning'],
- [ApplicationHealthStatus.ERROR, 'error'],
- [ApplicationHealthStatus.NEUTRAL, 'neutral'],
- ])('should map %s to the %s callout variant', (healthStatus, variant) => {
- expect(getApplicationHealthBannerAppearance(healthStatus)?.variant).toBe(
- variant,
- );
- });
+ { healthStatus: ApplicationHealthStatus.SUCCESS, status: 'success' },
+ { healthStatus: ApplicationHealthStatus.INFO, status: 'info' },
+ { healthStatus: ApplicationHealthStatus.WARNING, status: 'warning' },
+ { healthStatus: ApplicationHealthStatus.ERROR, status: 'error' },
+ { healthStatus: ApplicationHealthStatus.NEUTRAL, status: 'neutral' },
+ ])(
+ 'should map $healthStatus to the $status callout status',
+ ({ healthStatus, status }) => {
+ expect(getApplicationHealthBannerAppearance(healthStatus)?.status).toBe(
+ status,
+ );
+ },
+ );
it.each([ApplicationHealthStatus.OK, ApplicationHealthStatus.UNKNOWN])(
'should return nothing for %s',
diff --git a/packages/twenty-front/src/pages/settings/applications/utils/getApplicationHealthBannerAppearance.ts b/packages/twenty-front/src/pages/settings/applications/utils/getApplicationHealthBannerAppearance.ts
index 5d1b8dd0bc7..c9d5ab5e213 100644
--- a/packages/twenty-front/src/pages/settings/applications/utils/getApplicationHealthBannerAppearance.ts
+++ b/packages/twenty-front/src/pages/settings/applications/utils/getApplicationHealthBannerAppearance.ts
@@ -1,4 +1,4 @@
-import { type CalloutVariant } from 'twenty-ui/components/feedback';
+import { type CalloutStatus } from 'twenty-ui/components/feedback';
import {
IconAlertCircle,
IconAlertTriangle,
@@ -10,7 +10,7 @@ import {
import { ApplicationHealthStatus } from '~/generated-metadata/graphql';
type ApplicationHealthBannerAppearance = {
- variant: CalloutVariant;
+ status: CalloutStatus;
Icon: IconComponent;
};
@@ -18,23 +18,23 @@ const APPEARANCE_BY_STATUS: Partial<
Record<ApplicationHealthStatus, ApplicationHealthBannerAppearance>
> = {
[ApplicationHealthStatus.SUCCESS]: {
- variant: 'success',
+ status: 'success',
Icon: IconCheck,
},
[ApplicationHealthStatus.INFO]: {
- variant: 'info',
+ status: 'info',
Icon: IconInfoCircle,
},
[ApplicationHealthStatus.WARNING]: {
- variant: 'warning',
+ status: 'warning',
Icon: IconAlertTriangle,
},
[ApplicationHealthStatus.ERROR]: {
- variant: 'error',
+ status: 'error',
Icon: IconAlertCircle,
},
[ApplicationHealthStatus.NEUTRAL]: {
- variant: 'neutral',
+ status: 'neutral',
Icon: IconHelp,
},
};
diff --git a/packages/twenty-front/src/pages/settings/data-model/new-index/SettingsObjectNewIndex.tsx b/packages/twenty-front/src/pages/settings/data-model/new-index/SettingsObjectNewIndex.tsx
index 2543b156903..6a94b5467cf 100644
--- a/packages/twenty-front/src/pages/settings/data-model/new-index/SettingsObjectNewIndex.tsx
+++ b/packages/twenty-front/src/pages/settings/data-model/new-index/SettingsObjectNewIndex.tsx
@@ -22,6 +22,7 @@ import { getSettingsPath, isDefined } from 'twenty-shared/utils';
import { Callout, useToast } from 'twenty-ui/components/feedback';
import { Section } from 'twenty-ui/components/layout';
import { IconAlertTriangle } from 'twenty-ui/icon';
+import { themeCssVariables } from 'twenty-ui/theme';
import { IndexType } from '~/generated-metadata/graphql';
import { useNavigateApp } from '~/hooks/useNavigateApp';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
@@ -157,8 +158,13 @@ export const SettingsObjectNewIndex = () => {
<SettingsPageContainer>
<Section.Root>
<Callout
- variant="warning"
- Icon={IconAlertTriangle}
+ status="warning"
+ icon={
+ <IconAlertTriangle
+ size={themeCssVariables.icon.size.md}
+ aria-hidden="true"
+ />
+ }
title={t`Use indexes sparingly`}
description={t`Each index speeds up reads on the fields it covers, but slows down every insert and update, and uses disk space. Only add an index when you know which queries it serves.`}
/>
diff --git a/packages/twenty-ui/docs/calloutPropDescriptions.ts b/packages/twenty-ui/docs/calloutPropDescriptions.ts
index fb7fdf205b2..58f4d5f8ab5 100644
--- a/packages/twenty-ui/docs/calloutPropDescriptions.ts
+++ b/packages/twenty-ui/docs/calloutPropDescriptions.ts
@@ -3,14 +3,23 @@ import { type ComponentProps } from 'react';
import { type Callout } from '../src/components/feedback/Callout/Callout';
export const CALLOUT_PROP_DESCRIPTIONS = {
- variant: 'Semantic appearance: info, warning, error, neutral, or success.',
- title: 'Main message displayed beside the icon.',
- description: 'Optional supporting text. Empty strings are hidden.',
- fullWidth: 'Fills the available container width.',
- Icon: 'Leading icon component. Defaults to the help icon.',
- action: 'Optional footer action with a label and onClick callback.',
- isClosable:
- 'Shows a close button that hides the callout until it is remounted.',
+ status:
+ 'Feedback meaning: neutral, info, success, warning, or error. Defaults to info.',
+ variant: 'Supported appearance: soft.',
+ color:
+ 'Palette override: gray, blue, green, orange, or red. Defaults to the status palette.',
+ title: 'Main message node displayed beside the icon.',
+ description: 'Optional supporting content node. Empty slots are hidden.',
+ fullWidth: 'Removes the default 512px maximum width.',
+ icon: 'Leading icon node. Defaults to a decorative help icon. Pass null to omit it.',
+ action:
+ 'Optional footer node. Use Callout.Action for the standard action or supply custom controls.',
closeLabel: 'Accessible name of the dismiss button. Defaults to `Close`.',
- onClose: 'Called after the close button hides the callout.',
+ onDismiss:
+ 'Shows a dismiss button and notifies the caller once per activation. The caller owns visibility.',
+ className: 'Additional class names merged onto the root.',
+ style: 'Inline styles forwarded to the root.',
+ ref: 'Ref to the root div, or the element supplied through render.',
+ render:
+ 'Element or callback composition for the root. Receives status, variant, and color state.',
} satisfies Partial<Record<keyof ComponentProps<typeof Callout>, string>>;
diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.ts
index 9d6bbf12c3a..007bb3c4625 100644
--- a/packages/twenty-ui/docs/components.ts
+++ b/packages/twenty-ui/docs/components.ts
@@ -659,10 +659,21 @@ export const DOCUMENTED_COMPONENTS = [
},
{
name: 'Callout',
+ nativeProps: 'div',
source: 'components/feedback/Callout/Callout.tsx',
entryPoint: 'twenty-ui/components/feedback',
slug: 'components/feedback/callout',
propDescriptions: CALLOUT_PROP_DESCRIPTIONS,
+ parts: ['Action'],
+ partPropDescriptions: { Action: BUTTON_PROP_DESCRIPTIONS },
+ propDefaults: {
+ closeLabel: 'Close',
+ color: 'status palette',
+ fullWidth: 'false',
+ icon: 'decorative help icon',
+ status: 'info',
+ variant: 'soft',
+ },
},
{
name: 'InlineBanner',
diff --git a/packages/twenty-ui/docs/label-ownership.md b/packages/twenty-ui/docs/label-ownership.md
index ead60c958b0..b441629e62e 100644
--- a/packages/twenty-ui/docs/label-ownership.md
+++ b/packages/twenty-ui/docs/label-ownership.md
@@ -4,7 +4,7 @@ This covers production exports under components, primitives, and icons, includin
| Surface | Text ownership |
| --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| Callout | `title`, `description`, `action.label`, and `closeLabel` (default `Close`). |
+| Callout | `title`, `description`, `icon`, and `action` nodes, plus `closeLabel` (default `Close`). The optional `onDismiss` requests caller-owned visibility changes. |
| ListItem and Menu item parts | Children, description, action slots, native accessible attributes, and `shortcutJoinLabel` (default `then`). |
| Dropdown | Children name actions, options, titles, sections, empty states, and loading states. `Back` children default to `Back`. Search accepts native placeholder and accessible attributes. Close requires a caller-supplied accessible label and accepts native `aria-labelledby`. Item parts pass `shortcutJoinLabel` to ListItem. |
| CurrencyPicker | `searchLabel` defaults to `Search` and supplies the search placeholder and accessible name. `emptyLabel` defaults to `No results`. Currency names and codes are caller data; trigger and dropdown accessible names belong to the host. |
diff --git a/packages/twenty-ui/docs/public-exports.json b/packages/twenty-ui/docs/public-exports.json
index 8d61851ad83..8dc58a71c92 100644
--- a/packages/twenty-ui/docs/public-exports.json
+++ b/packages/twenty-ui/docs/public-exports.json
@@ -66,7 +66,11 @@
"useToast": "components/feedback/Toast/hooks/useToast"
},
"types": {
+ "CalloutActionProps": "components/feedback/Callout/types/CalloutActionProps",
+ "CalloutColor": "components/feedback/Callout/types/CalloutColor",
"CalloutProps": "components/feedback/Callout/types/CalloutProps",
+ "CalloutState": "components/feedback/Callout/types/CalloutState",
+ "CalloutStatus": "components/feedback/Callout/types/CalloutStatus",
"CalloutVariant": "components/feedback/Callout/types/CalloutVariant",
"InlineBannerLayout": "components/feedback/InlineBanner/types/InlineBannerLayout",
"InlineBannerProps": "components/feedback/InlineBanner/types/InlineBannerProps",
diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.json
index c2e0146c022..e9a7852dc64 100644
--- a/packages/twenty-ui/generated/components.docs.json
+++ b/packages/twenty-ui/generated/components.docs.json
@@ -10330,10 +10330,17 @@
"props": [
{
"name": "action",
- "type": "{ label: string; onClick: () => void; }",
+ "type": "ReactNode",
+ "required": false,
+ "defaultValue": null,
+ "description": "Optional footer node. Use Callout.Action for the standard action or supply custom controls."
+ },
+ {
+ "name": "className",
+ "type": "string",
"required": false,
"defaultValue": null,
- "description": "Optional footer action with a label and onClick callback."
+ "description": "Additional class names merged onto the root."
},
{
"name": "closeLabel",
@@ -10342,54 +10349,187 @@
"defaultValue": "Close",
"description": "Accessible name of the dismiss button. Defaults to `Close`."
},
+ {
+ "name": "color",
+ "type": "\"blue\" | \"gray\" | \"green\" | \"orange\" | \"red\"",
+ "required": false,
+ "defaultValue": "status palette",
+ "description": "Palette override: gray, blue, green, orange, or red. Defaults to the status palette."
+ },
{
"name": "description",
- "type": "string",
+ "type": "ReactNode",
"required": false,
"defaultValue": null,
- "description": "Optional supporting text. Empty strings are hidden."
+ "description": "Optional supporting content node. Empty slots are hidden."
},
{
"name": "fullWidth",
"type": "boolean",
"required": false,
"defaultValue": "false",
- "description": "Fills the available container width."
+ "description": "Removes the default 512px maximum width."
},
{
- "name": "Icon",
- "type": "IconComponent",
+ "name": "icon",
+ "type": "ReactNode",
+ "required": false,
+ "defaultValue": "decorative help icon",
+ "description": "Leading icon node. Defaults to a decorative help icon. Pass null to omit it."
+ },
+ {
+ "name": "onDismiss",
+ "type": "(() => void)",
"required": false,
"defaultValue": null,
- "description": "Leading icon component. Defaults to the help icon."
+ "description": "Shows a dismiss button and notifies the caller once per activation. The caller owns visibility."
},
{
- "name": "isClosable",
- "type": "boolean",
+ "name": "ref",
+ "type": "Ref<HTMLDivElement>",
"required": false,
- "defaultValue": "false",
- "description": "Shows a close button that hides the callout until it is remounted."
+ "defaultValue": null,
+ "description": "Ref to the root div, or the element supplied through render."
},
{
- "name": "onClose",
- "type": "(() => void)",
+ "name": "render",
+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, CalloutState>",
"required": false,
"defaultValue": null,
- "description": "Called after the close button hides the callout."
+ "description": "Element or callback composition for the root. Receives status, variant, and color state."
+ },
+ {
+ "name": "status",
+ "type": "\"error\" | \"info\" | \"neutral\" | \"success\" | \"warning\"",
+ "required": false,
+ "defaultValue": "info",
+ "description": "Feedback meaning: neutral, info, success, warning, or error. Defaults to info."
+ },
+ {
+ "name": "style",
+ "type": "CSSProperties",
+ "required": false,
+ "defaultValue": null,
+ "description": "Inline styles forwarded to the root."
},
{
"name": "title",
- "type": "string",
+ "type": "ReactNode",
"required": true,
"defaultValue": null,
- "description": "Main message displayed beside the icon."
+ "description": "Main message node displayed beside the icon."
},
{
"name": "variant",
- "type": "\"error\" | \"info\" | \"neutral\" | \"success\" | \"warning\"",
- "required": true,
- "defaultValue": null,
- "description": "Semantic appearance: info, warning, error, neutral, or success."
+ "type": "\"soft\"",
+ "required": false,
+ "defaultValue": "soft",
+ "description": "Supported appearance: soft."
+ }
+ ],
+ "parts": [
+ {
+ "name": "Action",
+ "props": [
+ {
+ "name": "className",
+ "type": "string | ((state: ButtonState) => 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": "color",
+ "type": "\"accent\" | \"danger\" | \"neutral\" | \"success\"",
+ "required": false,
+ "defaultValue": null,
+ "description": "Semantic color of the button."
+ },
+ {
+ "name": "elevated",
+ "type": "boolean",
+ "required": false,
+ "defaultValue": null,
+ "description": "Adds a shadow and backdrop blur. Neutral outline buttons also use elevated surface colors."
+ },
+ {
+ "name": "endIcon",
+ "type": "ReactNode",
+ "required": false,
+ "defaultValue": null,
+ "description": "Decorative content displayed after the label."
+ },
+ {
+ "name": "focusableWhenDisabled",
+ "type": "boolean",
+ "required": false,
+ "defaultValue": "false",
+ "description": "Whether the button should be focusable when disabled."
+ },
+ {
+ "name": "fullWidth",
+ "type": "boolean",
+ "required": false,
+ "defaultValue": null,
+ "description": "Expands the button to fill its container width."
+ },
+ {
+ "name": "href",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Destination URL. Enables native link semantics instead of button semantics."
+ },
+ {
+ "name": "loading",
+ "type": "boolean",
+ "required": false,
+ "defaultValue": null,
+ "description": "Shows a loading indicator and disables activation."
+ },
+ {
+ "name": "loadingPosition",
+ "type": "\"center\" | \"end\" | \"start\"",
+ "required": false,
+ "defaultValue": null,
+ "description": "Where the loading indicator appears. `center` hides the content while preserving its layout space; `start` and `end` keep children and the opposite icon visible and replace the corresponding icon with the spinner."
+ },
+ {
+ "name": "render",
+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ButtonState>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Caller-supplied root element or renderer. Preserve a native button, or an anchor when `href` is set. Router integration belongs to the caller."
+ },
+ {
+ "name": "shortcut",
+ "type": "ShortcutDefinition",
+ "required": false,
+ "defaultValue": null,
+ "description": "Flat key array for simultaneous keys, or nested key arrays for an ordered sequence. Displayed on non-mobile screens."
+ },
+ {
+ "name": "shortcutJoinLabel",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Localized text between sequence steps. Defaults to then."
+ },
+ {
+ "name": "startIcon",
+ "type": "ReactNode",
+ "required": false,
+ "defaultValue": null,
+ "description": "Decorative content displayed before the label."
+ },
+ {
+ "name": "style",
+ "type": "CSSProperties | ((state: ButtonState) => 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."
+ }
+ ]
}
]
},
diff --git a/packages/twenty-ui/src/components/__stories__/LabelOverrides.stories.tsx b/packages/twenty-ui/src/components/__stories__/LabelOverrides.stories.tsx
index dbed2b1bcbc..1ccfdf45536 100644
--- a/packages/twenty-ui/src/components/__stories__/LabelOverrides.stories.tsx
+++ b/packages/twenty-ui/src/components/__stories__/LabelOverrides.stories.tsx
@@ -1,3 +1,4 @@
+import { useState } from 'react';
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
@@ -27,17 +28,22 @@ export default meta;
type Story = StoryObj;
export const CalloutDismissal: Story = {
- render: () => (
- <>
- <Callout variant="info" title="Default notice" isClosable />
- <Callout
- variant="info"
- title="Supplied notice"
- isClosable
- closeLabel="Dismiss notice"
- />
- </>
- ),
+ render: function CalloutDismissal() {
+ const [isSuppliedVisible, setIsSuppliedVisible] = useState(true);
+ return (
+ <>
+ <Callout status="info" title="Default notice" onDismiss={() => {}} />
+ {isSuppliedVisible && (
+ <Callout
+ status="info"
+ title="Supplied notice"
+ onDismiss={() => setIsSuppliedVisible(false)}
+ closeLabel="Dismiss notice"
+ />
+ )}
+ </>
+ );
+ },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
diff --git a/packages/twenty-ui/src/components/__stories__/reading-direction/DirectionalLayoutExample.tsx b/packages/twenty-ui/src/components/__stories__/reading-direction/DirectionalLayoutExample.tsx
index d1429f04fe4..7d86209a69e 100644
--- a/packages/twenty-ui/src/components/__stories__/reading-direction/DirectionalLayoutExample.tsx
+++ b/packages/twenty-ui/src/components/__stories__/reading-direction/DirectionalLayoutExample.tsx
@@ -33,7 +33,7 @@ export const DirectionalLayoutExample = ({
>
<Text>{direction.toUpperCase()}</Text>
<Callout
- variant="info"
+ status="info"
title="Account details"
description="Review the information before continuing."
/>
diff --git a/packages/twenty-ui/src/components/feedback/Callout/Callout.module.scss b/packages/twenty-ui/src/components/feedback/Callout/Callout.module.scss
index 3259068e2e8..4c689ac698f 100644
--- a/packages/twenty-ui/src/components/feedback/Callout/Callout.module.scss
+++ b/packages/twenty-ui/src/components/feedback/Callout/Callout.module.scss
@@ -1,6 +1,7 @@
.container {
align-items: flex-start;
- border: 1px solid;
+ background-color: var(--callout-background);
+ border: 1px solid var(--callout-border);
border-radius: var(--t-border-radius-md);
box-sizing: border-box;
display: flex;
@@ -9,37 +10,42 @@
max-width: 512px;
padding: var(--t-spacing-3) var(--t-spacing-3) var(--t-spacing-2);
width: 100%;
+
+ &[data-color='gray'] {
+ --callout-background: var(--t-color-gray1);
+ --callout-border: var(--t-color-gray6);
+ --callout-icon: var(--t-color-gray9);
+ }
+
+ &[data-color='blue'] {
+ --callout-background: var(--t-color-blue1);
+ --callout-border: var(--t-color-blue6);
+ --callout-icon: var(--t-color-blue9);
+ }
+
+ &[data-color='green'] {
+ --callout-background: var(--t-color-green1);
+ --callout-border: var(--t-color-green6);
+ --callout-icon: var(--t-color-green9);
+ }
+
+ &[data-color='orange'] {
+ --callout-background: var(--t-color-orange1);
+ --callout-border: var(--t-color-orange6);
+ --callout-icon: var(--t-color-orange9);
+ }
+
+ &[data-color='red'] {
+ --callout-background: var(--t-color-red1);
+ --callout-border: var(--t-color-red6);
+ --callout-icon: var(--t-color-red9);
+ }
}
.containerFullWidth {
max-width: none;
}
-.containerInfo {
- background-color: var(--t-accent-accent1);
- border-color: var(--t-accent-accent6);
-}
-
-.containerWarning {
- background-color: var(--t-color-orange1);
- border-color: var(--t-color-orange6);
-}
-
-.containerSuccess {
- background-color: var(--t-color-turquoise1);
- border-color: var(--t-color-turquoise6);
-}
-
-.containerError {
- background-color: var(--t-color-red1);
- border-color: var(--t-color-red6);
-}
-
-.containerNeutral {
- background-color: var(--t-color-gray1);
- border-color: var(--t-color-gray6);
-}
-
.header {
align-items: center;
align-self: stretch;
@@ -50,32 +56,13 @@
}
.iconContainer {
+ color: var(--callout-icon);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
- height: var(--t-spacing-4);
- width: var(--t-spacing-4);
-}
-
-.iconContainerInfo {
- color: var(--t-accent-accent9);
-}
-
-.iconContainerWarning {
- color: var(--t-color-orange9);
-}
-
-.iconContainerSuccess {
- color: var(--t-color-turquoise9);
-}
-
-.iconContainerError {
- color: var(--t-color-red9);
-}
-
-.iconContainerNeutral {
- color: var(--t-color-gray9);
+ height: calc(var(--t-icon-size-md) * 1px);
+ width: calc(var(--t-icon-size-md) * 1px);
}
.title {
@@ -95,7 +82,10 @@
display: flex;
align-self: stretch;
padding-bottom: var(--t-spacing-2);
- padding-inline-start: var(--t-spacing-6);
+}
+
+.descriptionWrapperWithIcon {
+ padding-inline-start: calc(var(--t-icon-size-md) * 1px + var(--t-spacing-2));
}
.descriptionWrapperWithAction {
diff --git a/packages/twenty-ui/src/components/feedback/Callout/Callout.module.scss.d.ts b/packages/twenty-ui/src/components/feedback/Callout/Callout.module.scss.d.ts
index d75f25220cd..b65214cde6c 100644
--- a/packages/twenty-ui/src/components/feedback/Callout/Callout.module.scss.d.ts
+++ b/packages/twenty-ui/src/components/feedback/Callout/Callout.module.scss.d.ts
@@ -1,23 +1,14 @@
declare const classNames: {
- readonly closeButton: 'closeButton';
readonly container: 'container';
readonly containerFullWidth: 'containerFullWidth';
- readonly containerInfo: 'containerInfo';
- readonly containerWarning: 'containerWarning';
- readonly containerSuccess: 'containerSuccess';
- readonly containerError: 'containerError';
- readonly containerNeutral: 'containerNeutral';
readonly header: 'header';
readonly iconContainer: 'iconContainer';
- readonly iconContainerInfo: 'iconContainerInfo';
- readonly iconContainerWarning: 'iconContainerWarning';
- readonly iconContainerSuccess: 'iconContainerSuccess';
- readonly iconContainerError: 'iconContainerError';
- readonly iconContainerNeutral: 'iconContainerNeutral';
readonly title: 'title';
readonly descriptionWrapper: 'descriptionWrapper';
+ readonly descriptionWrapperWithIcon: 'descriptionWrapperWithIcon';
readonly descriptionWrapperWithAction: 'descriptionWrapperWithAction';
readonly description: 'description';
readonly footer: 'footer';
+ readonly closeButton: 'closeButton';
};
export default classNames;
diff --git a/packages/twenty-ui/src/components/feedback/Callout/Callout.tsx b/packages/twenty-ui/src/components/feedback/Callout/Callout.tsx
index 23871f798db..30d39a1f1f4 100644
--- a/packages/twenty-ui/src/components/feedback/Callout/Callout.tsx
+++ b/packages/twenty-ui/src/components/feedback/Callout/Callout.tsx
@@ -1,109 +1,6 @@
-import { isNonEmptyString } from '@sniptt/guards';
-import { isDefined } from '@ui/utilities/utils/isDefined';
-import { clsx } from 'clsx';
-import { useState } from 'react';
-import { type CalloutProps } from './types/CalloutProps';
-import { type CalloutVariant } from './types/CalloutVariant';
+import { CalloutAction } from './internal/CalloutAction';
+import { CalloutComponent } from './internal/CalloutComponent';
-import { IconHelp, IconX } from '@ui/icon/components/TablerIcons';
-import { Button } from '@ui/primitives/input/Button/Button';
-
-import styles from './Callout.module.scss';
-
-const CALLOUT_CONTAINER_VARIANT_CLASS_NAMES: Record<CalloutVariant, string> = {
- info: styles.containerInfo,
- warning: styles.containerWarning,
- error: styles.containerError,
- neutral: styles.containerNeutral,
- success: styles.containerSuccess,
-};
-
-const CALLOUT_ICON_VARIANT_CLASS_NAMES: Record<CalloutVariant, string> = {
- info: styles.iconContainerInfo,
- warning: styles.iconContainerWarning,
- error: styles.iconContainerError,
- neutral: styles.iconContainerNeutral,
- success: styles.iconContainerSuccess,
-};
-
-export const Callout = ({
- variant,
- title,
- description,
- fullWidth = false,
- Icon = IconHelp,
- action,
- isClosable = false,
- closeLabel = 'Close',
- onClose,
-}: CalloutProps) => {
- const [isVisible, setIsVisible] = useState(true);
-
- const handleClose = () => {
- if (!isClosable) {
- return;
- }
-
- setIsVisible(false);
- onClose?.();
- };
-
- if (!isVisible) {
- return null;
- }
-
- return (
- <div
- className={clsx(
- styles.container,
- CALLOUT_CONTAINER_VARIANT_CLASS_NAMES[variant],
- fullWidth && styles.containerFullWidth,
- )}
- >
- <div className={styles.header}>
- <div
- className={clsx(
- styles.iconContainer,
- CALLOUT_ICON_VARIANT_CLASS_NAMES[variant],
- )}
- >
- <Icon size={16} />
- </div>
- <div className={styles.title}>{title}</div>
- {isClosable && (
- <Button
- startIcon={<IconX />}
- className={styles.closeButton}
- variant="ghost"
- size="sm"
- aria-label={closeLabel}
- onClick={handleClose}
- />
- )}
- </div>
- {isNonEmptyString(description) && (
- <div
- className={clsx(
- styles.descriptionWrapper,
- isDefined(action) && styles.descriptionWrapperWithAction,
- )}
- >
- <div className={styles.description}>{description}</div>
- </div>
- )}
- {isDefined(action) && (
- <div className={styles.footer}>
- <Button
- type="button"
- onClick={action.onClick}
- size="sm"
- variant="ghost"
- style={{ fontWeight: 'var(--t-font-weight-regular)' }}
- >
- {action.label}
- </Button>
- </div>
- )}
- </div>
- );
-};
+export const Callout = Object.assign(CalloutComponent, {
+ Action: CalloutAction,
+});
diff --git a/packages/twenty-ui/src/components/feedback/Callout/__stories__/Callout.stories.tsx b/packages/twenty-ui/src/components/feedback/Callout/__stories__/Callout.stories.tsx
index 849f5d2b1a2..3537b5a3fc2 100644
--- a/packages/twenty-ui/src/components/feedback/Callout/__stories__/Callout.stories.tsx
+++ b/packages/twenty-ui/src/components/feedback/Callout/__stories__/Callout.stories.tsx
@@ -1,4 +1,13 @@
import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { useState } from 'react';
+import { expect, fn, userEvent, within } from 'storybook/test';
+
+import { Callout } from '@ui/components/feedback/Callout/Callout';
+import { type CalloutStatus } from '@ui/components/feedback/Callout/types/CalloutStatus';
+import { InlineBanner } from '@ui/components/feedback/InlineBanner/InlineBanner';
+import { IconAlertTriangle } from '@ui/icon';
+import { Button } from '@ui/primitives/input';
+import { Text } from '@ui/primitives/typography';
import {
A11Y_DEFER_COLOR_CONTRAST,
CatalogDecorator,
@@ -6,81 +15,209 @@ import {
type CatalogStory,
} from '@ui/testing';
-import { Callout } from '@ui/components/feedback/Callout/Callout';
-import { type CalloutVariant } from '@ui/components/feedback/Callout/types/CalloutVariant';
+import { ThemeProvider, themeCssVariables } from '@ui/theme';
+
+const THEMED_ICON_SIZE = 20;
+
+const onDismiss = fn();
+const onAction = fn();
+const onSubmit = fn((event) => event.preventDefault());
const meta: Meta<typeof Callout> = {
id: 'ui-feedback-callout',
title: 'UI/Components/Feedback/Callout',
component: Callout,
+ decorators: [ComponentDecorator],
+ parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },
};
export default meta;
type Story = StoryObj<typeof Callout>;
export const Default: Story = {
- parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },
args: {
- variant: 'neutral',
+ status: 'neutral',
title: 'This form will appear in workflow runs.',
description:
'Because this workflow is not using a manual trigger, the form will not open on top of the interface. To fill it, open the corresponding workflow run and complete the form there.',
- action: {
- label: 'Learn more',
- onClick: () => {},
- },
+ action: <Callout.Action>Learn more</Callout.Action>,
},
- decorators: [ComponentDecorator],
};
export const FullWidth: Story = {
- parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },
args: {
- variant: 'error',
+ status: 'error',
title: 'Your Postcard provider key was revoked.',
fullWidth: true,
- action: {
- label: 'Reconnect',
- onClick: () => {},
- },
+ action: <Callout.Action>Reconnect</Callout.Action>,
},
- decorators: [ComponentDecorator],
};
-export const Catalog: CatalogStory<Story, typeof Callout> = {
+export const ThemeIconSize: Story = {
args: {
- title: 'This form will appear in workflow runs.',
- description:
- 'Because this workflow is not using a manual trigger, the form will not open on top of the interface. To fill it, open the corresponding workflow run and complete the form there.',
- action: {
- label: 'Learn more',
- onClick: () => {},
- },
+ title: 'Themed feedback',
+ description: 'Callout text follows the themed icon.',
+ },
+ render: (args) => (
+ <ThemeProvider
+ colorScheme="light"
+ applyToRoot={false}
+ overrides={{ '--t-icon-size-md': THEMED_ICON_SIZE }}
+ >
+ <Callout {...args} />
+ <Callout
+ title="Custom themed icon"
+ icon={
+ <IconAlertTriangle
+ size={themeCssVariables.icon.size.md}
+ aria-label="Custom themed icon"
+ />
+ }
+ />
+ <InlineBanner>Theme-sized inline message</InlineBanner>
+ </ThemeProvider>
+ ),
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const icons = canvasElement.querySelectorAll('svg');
+
+ await expect(icons).toHaveLength(3);
+
+ for (const icon of icons) {
+ await expect(icon).toHaveStyle({
+ width: `${THEMED_ICON_SIZE}px`,
+ height: `${THEMED_ICON_SIZE}px`,
+ });
+ }
+
+ const title = canvas.getByText('Themed feedback');
+ const description = canvas.getByText(
+ 'Callout text follows the themed icon.',
+ );
+
+ await expect(description.getBoundingClientRect().left).toBe(
+ title.getBoundingClientRect().left,
+ );
+ },
+};
+
+export const DismissalRequest: Story = {
+ args: {
+ status: 'warning',
+ title: <Text render={<span />}>Import needs review</Text>,
+ description: (
+ <Text render={<span />}>
+ Review{' '}
+ <Button variant="link" href="#records">
+ missing records
+ </Button>
+ .
+ </Text>
+ ),
+ icon: (
+ <IconAlertTriangle
+ size={themeCssVariables.icon.size.md}
+ aria-label="Import warning"
+ />
+ ),
+ action: <Callout.Action onClick={onAction}>Review import</Callout.Action>,
+ onDismiss,
+ closeLabel: 'Dismiss import notice',
+ },
+ render: (args) => (
+ <form onSubmit={onSubmit}>
+ <Callout {...args} />
+ </form>
+ ),
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const close = canvas.getByRole('button', { name: 'Dismiss import notice' });
+ await expect(canvas.getByLabelText('Import warning')).toBeVisible();
+ await expect(
+ canvas.getByRole('link', { name: 'missing records' }),
+ ).toHaveAttribute('href', '#records');
+ await userEvent.click(close);
+ await expect(onDismiss).toHaveBeenCalledTimes(1);
+ await expect(onDismiss).toHaveBeenLastCalledWith();
+ await userEvent.keyboard('{Enter}');
+ await expect(onDismiss).toHaveBeenCalledTimes(2);
+ await userEvent.keyboard(' ');
+ await expect(onDismiss).toHaveBeenCalledTimes(3);
+ await expect(canvas.getByText('Import needs review')).toBeVisible();
+ await expect(onSubmit).not.toHaveBeenCalled();
+ const action = canvas.getByRole('button', { name: 'Review import' });
+ const regularFontWeight = getComputedStyle(action)
+ .getPropertyValue('--t-font-weight-regular')
+ .trim();
+ await expect(action).toHaveStyle({ fontWeight: regularFontWeight });
+ await userEvent.click(action);
+ await expect(onAction).toHaveBeenCalledTimes(1);
+ await expect(onDismiss).toHaveBeenCalledTimes(3);
+ },
+};
+
+export const CallerVisibility: Story = {
+ render: function CallerVisibility() {
+ const [isVisible, setIsVisible] = useState(true);
+ return (
+ <>
+ {isVisible && (
+ <Callout
+ title="Caller-owned notice"
+ onDismiss={() => setIsVisible(false)}
+ />
+ )}
+ <Button onClick={() => setIsVisible(true)}>Show notice</Button>
+ </>
+ );
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ await userEvent.click(canvas.getByRole('button', { name: 'Close' }));
+ await expect(
+ canvas.queryByText('Caller-owned notice'),
+ ).not.toBeInTheDocument();
+ await userEvent.click(canvas.getByRole('button', { name: 'Show notice' }));
+ await expect(canvas.getByText('Caller-owned notice')).toBeVisible();
+ await userEvent.click(canvas.getByRole('button', { name: 'Close' }));
+ await expect(
+ canvas.queryByText('Caller-owned notice'),
+ ).not.toBeInTheDocument();
+ },
+};
+
+export const WithoutDismissal: Story = {
+ args: {
+ title: 'Persistent notice',
+ icon: null,
+ description: 'Caller-owned content',
},
- argTypes: {
- variant: { control: false },
+ play: async ({ canvasElement }) => {
+ await expect(
+ within(canvasElement).queryByRole('button'),
+ ).not.toBeInTheDocument();
},
+};
+
+export const Catalog: CatalogStory<Story, typeof Callout> = {
+ args: Default.args,
+ argTypes: { status: { control: false } },
parameters: {
- a11y: A11Y_DEFER_COLOR_CONTRAST,
catalog: {
dimensions: [
{
- name: 'accents',
+ name: 'status',
values: [
'success',
'warning',
'error',
'neutral',
'info',
- ] satisfies CalloutVariant[],
- props: (variant: CalloutVariant) => ({ variant }),
+ ] satisfies CalloutStatus[],
+ props: (status: CalloutStatus) => ({ status }),
},
],
- options: {
- elementContainer: {
- width: 512,
- },
- },
+ options: { elementContainer: { width: 512 } },
},
},
decorators: [CatalogDecorator],
diff --git a/packages/twenty-ui/src/components/feedback/Callout/__tests__/Callout.test.tsx b/packages/twenty-ui/src/components/feedback/Callout/__tests__/Callout.test.tsx
new file mode 100644
index 00000000000..821a200545b
--- /dev/null
+++ b/packages/twenty-ui/src/components/feedback/Callout/__tests__/Callout.test.tsx
@@ -0,0 +1,75 @@
+import { render, screen } from '@testing-library/react';
+import { describe, expect, it } from 'vitest';
+
+import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';
+
+import { Callout } from '../Callout';
+import styles from '../Callout.module.scss';
+
+runComponentConformance({
+ name: 'Callout',
+ element: <Callout title="Sync result" />,
+ refInstanceOf: HTMLDivElement,
+ ownClassName: styles.container,
+});
+
+describe('Callout feedback', () => {
+ it('keeps status, soft appearance and an explicit palette independent', () => {
+ const { rerender } = render(
+ <Callout
+ title="Sync failed"
+ status="error"
+ color="blue"
+ data-testid="feedback"
+ />,
+ );
+ const callout = screen.getByTestId('feedback');
+ expect(callout).toHaveAttribute('data-status', 'error');
+ expect(callout).toHaveAttribute('data-variant', 'soft');
+ expect(callout).toHaveAttribute('data-color', 'blue');
+ rerender(
+ <Callout title="Sync finished" status="success" data-testid="feedback" />,
+ );
+ expect(callout).toHaveAttribute('data-status', 'success');
+ expect(callout).toHaveAttribute('data-color', 'green');
+ });
+
+ it('leaves announcement semantics to the caller', () => {
+ const { rerender } = render(
+ <Callout title="Sync failed" status="error" data-testid="feedback" />,
+ );
+ const callout = screen.getByTestId('feedback');
+ expect(callout).not.toHaveAttribute('role');
+ expect(callout).not.toHaveAttribute('aria-live');
+ rerender(
+ <Callout
+ title="Sync finished"
+ role="status"
+ aria-live="polite"
+ aria-atomic="true"
+ />,
+ );
+ expect(screen.getByRole('status')).toHaveAttribute('aria-live', 'polite');
+ expect(screen.getByRole('status')).toHaveAttribute('aria-atomic', 'true');
+ });
+
+ it('preserves zero content and omits empty optional slots', () => {
+ const { rerender } = render(
+ <Callout
+ title="No records"
+ icon={null}
+ description={0}
+ action={false}
+ data-testid="feedback"
+ />,
+ );
+ expect(screen.getByText('0')).toBeInTheDocument();
+ expect(screen.getByTestId('feedback').querySelector('svg')).toBeNull();
+ expect(
+ screen.getByTestId('feedback').querySelector(`.${styles.footer}`),
+ ).toBeNull();
+ rerender(<Callout title="No records" description="" />);
+ expect(screen.queryByText('0')).not.toBeInTheDocument();
+ expect(screen.queryByRole('button')).not.toBeInTheDocument();
+ });
+});
diff --git a/packages/twenty-ui/src/components/feedback/Callout/__tests__/CalloutAction.test.tsx b/packages/twenty-ui/src/components/feedback/Callout/__tests__/CalloutAction.test.tsx
new file mode 100644
index 00000000000..03054040a70
--- /dev/null
+++ b/packages/twenty-ui/src/components/feedback/Callout/__tests__/CalloutAction.test.tsx
@@ -0,0 +1,11 @@
+import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';
+
+import { Callout } from '../Callout';
+import styles from '../internal/CalloutAction.module.scss';
+
+runComponentConformance({
+ name: 'Callout.Action',
+ element: <Callout.Action>Retry sync</Callout.Action>,
+ refInstanceOf: HTMLButtonElement,
+ ownClassName: styles.action,
+});
diff --git a/packages/twenty-ui/src/components/feedback/Callout/internal/CalloutAction.module.scss b/packages/twenty-ui/src/components/feedback/Callout/internal/CalloutAction.module.scss
new file mode 100644
index 00000000000..bbf2060ad0e
--- /dev/null
+++ b/packages/twenty-ui/src/components/feedback/Callout/internal/CalloutAction.module.scss
@@ -0,0 +1,3 @@
+.action {
+ --tw-button-font-weight: var(--t-font-weight-regular);
+}
diff --git a/packages/twenty-ui/src/components/feedback/Callout/internal/CalloutAction.module.scss.d.ts b/packages/twenty-ui/src/components/feedback/Callout/internal/CalloutAction.module.scss.d.ts
new file mode 100644
index 00000000000..d6444d25cb7
--- /dev/null
+++ b/packages/twenty-ui/src/components/feedback/Callout/internal/CalloutAction.module.scss.d.ts
@@ -0,0 +1,4 @@
+declare const classNames: {
+ readonly action: 'action';
+};
+export default classNames;
diff --git a/packages/twenty-ui/src/components/feedback/Callout/internal/CalloutAction.tsx b/packages/twenty-ui/src/components/feedback/Callout/internal/CalloutAction.tsx
new file mode 100644
index 00000000000..7a2e563a7cc
--- /dev/null
+++ b/packages/twenty-ui/src/components/feedback/Callout/internal/CalloutAction.tsx
@@ -0,0 +1,16 @@
+import { Button } from '@ui/primitives/input/Button/Button';
+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';
+
+import styles from './CalloutAction.module.scss';
+import { type CalloutActionProps } from '../types/CalloutActionProps';
+
+export const CalloutAction = ({ className, ...props }: CalloutActionProps) => {
+ return (
+ <Button
+ {...props}
+ size="sm"
+ variant="ghost"
+ className={mergeClassNames(styles.action, className)}
+ />
+ );
+};
diff --git a/packages/twenty-ui/src/components/feedback/Callout/internal/CalloutComponent.tsx b/packages/twenty-ui/src/components/feedback/Callout/internal/CalloutComponent.tsx
new file mode 100644
index 00000000000..dd90bc32ecc
--- /dev/null
+++ b/packages/twenty-ui/src/components/feedback/Callout/internal/CalloutComponent.tsx
@@ -0,0 +1,77 @@
+import { useRender } from '@base-ui/react/use-render';
+import { clsx } from 'clsx';
+
+import { IconHelp, IconX } from '@ui/icon/components/TablerIcons';
+import { Button } from '@ui/primitives/input/Button/Button';
+import { FEEDBACK_STATUS_COLORS } from '@ui/primitives/feedback/internal/constants/FeedbackStatusColors';
+import { themeCssVariables } from '@ui/theme';
+import { isRenderableSlot } from '@ui/utilities/internal/isRenderableSlot';
+import { isDefined } from '@ui/utilities/utils/isDefined';
+
+import styles from '../Callout.module.scss';
+import { type CalloutProps } from '../types/CalloutProps';
+
+export const CalloutComponent = ({
+ status = 'info',
+ variant = 'soft',
+ color = FEEDBACK_STATUS_COLORS[status],
+ title,
+ description,
+ fullWidth = false,
+ icon = <IconHelp size={themeCssVariables.icon.size.md} aria-hidden="true" />,
+ action,
+ closeLabel = 'Close',
+ onDismiss,
+ className,
+ render,
+ ref,
+ ...props
+}: CalloutProps) => {
+ const hasIcon = isRenderableSlot(icon);
+ const hasAction = isRenderableSlot(action);
+
+ return useRender({
+ render,
+ ref,
+ state: { status, variant, color },
+ props: {
+ ...props,
+ className: clsx(
+ styles.container,
+ fullWidth && styles.containerFullWidth,
+ className,
+ ),
+ children: (
+ <>
+ <div className={styles.header}>
+ {hasIcon && <div className={styles.iconContainer}>{icon}</div>}
+ <div className={styles.title}>{title}</div>
+ {isDefined(onDismiss) && (
+ <Button
+ type="button"
+ startIcon={<IconX aria-hidden="true" />}
+ className={styles.closeButton}
+ variant="ghost"
+ size="sm"
+ aria-label={closeLabel}
+ onClick={() => onDismiss()}
+ />
+ )}
+ </div>
+ {isRenderableSlot(description) && (
+ <div
+ className={clsx(
+ styles.descriptionWrapper,
+ hasIcon && styles.descriptionWrapperWithIcon,
+ hasAction && styles.descriptionWrapperWithAction,
+ )}
+ >
+ <div className={styles.description}>{description}</div>
+ </div>
+ )}
+ {hasAction && <div className={styles.footer}>{action}</div>}
+ </>
+ ),
+ },
+ });
+};
diff --git a/packages/twenty-ui/src/components/feedback/Callout/types/CalloutActionProps.ts b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutActionProps.ts
new file mode 100644
index 00000000000..b03d2272847
--- /dev/null
+++ b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutActionProps.ts
@@ -0,0 +1,3 @@
+import { type ButtonProps } from '@ui/primitives/input/Button/types/ButtonProps';
+
+export type CalloutActionProps = Omit<ButtonProps, 'size' | 'variant'>;
diff --git a/packages/twenty-ui/src/components/feedback/Callout/types/CalloutColor.ts b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutColor.ts
new file mode 100644
index 00000000000..f7d71536320
--- /dev/null
+++ b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutColor.ts
@@ -0,0 +1,3 @@
+import { type BannerColor } from '@ui/primitives/feedback/Banner/types/BannerColor';
+
+export type CalloutColor = BannerColor;
diff --git a/packages/twenty-ui/src/components/feedback/Callout/types/CalloutProps.ts b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutProps.ts
index f8003f3685b..63d0a138004 100644
--- a/packages/twenty-ui/src/components/feedback/Callout/types/CalloutProps.ts
+++ b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutProps.ts
@@ -1,17 +1,23 @@
-import { type IconComponent } from '@ui/icon/types/IconComponent';
+import { type useRender } from '@base-ui/react/use-render';
+import { type ReactNode } from 'react';
+
+import { type CalloutColor } from './CalloutColor';
+import { type CalloutState } from './CalloutState';
+import { type CalloutStatus } from './CalloutStatus';
import { type CalloutVariant } from './CalloutVariant';
-export type CalloutProps = {
- variant: CalloutVariant;
- title: string;
- description?: string;
+export type CalloutProps = Omit<
+ useRender.ComponentProps<'div', CalloutState>,
+ 'title' | 'color' | 'children'
+> & {
+ status?: CalloutStatus;
+ variant?: CalloutVariant;
+ color?: CalloutColor;
+ title: ReactNode;
+ description?: ReactNode;
fullWidth?: boolean;
- Icon?: IconComponent;
- action?: {
- label: string;
- onClick: () => void;
- };
- isClosable?: boolean;
+ icon?: ReactNode;
+ action?: ReactNode;
closeLabel?: string;
- onClose?: () => void;
+ onDismiss?: () => void;
};
diff --git a/packages/twenty-ui/src/components/feedback/Callout/types/CalloutState.ts b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutState.ts
new file mode 100644
index 00000000000..3abd8c4618f
--- /dev/null
+++ b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutState.ts
@@ -0,0 +1,9 @@
+import { type CalloutColor } from './CalloutColor';
+import { type CalloutStatus } from './CalloutStatus';
+import { type CalloutVariant } from './CalloutVariant';
+
+export type CalloutState = {
+ status: CalloutStatus;
+ variant: CalloutVariant;
+ color: CalloutColor;
+};
diff --git a/packages/twenty-ui/src/components/feedback/Callout/types/CalloutStatus.ts b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutStatus.ts
new file mode 100644
index 00000000000..b91a6af4377
--- /dev/null
+++ b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutStatus.ts
@@ -0,0 +1,3 @@
+import { type BannerStatus } from '@ui/primitives/feedback/Banner/types/BannerStatus';
+
+export type CalloutStatus = BannerStatus;
diff --git a/packages/twenty-ui/src/components/feedback/Callout/types/CalloutVariant.ts b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutVariant.ts
index bcbba21611b..8b59b2eb611 100644
--- a/packages/twenty-ui/src/components/feedback/Callout/types/CalloutVariant.ts
+++ b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutVariant.ts
@@ -1,6 +1 @@
-export type CalloutVariant =
- | 'info'
- | 'warning'
- | 'error'
- | 'neutral'
- | 'success';
+export type CalloutVariant = 'soft';
diff --git a/packages/twenty-ui/src/components/feedback/index.ts b/packages/twenty-ui/src/components/feedback/index.ts
index 217d4b97863..9ea31542ba9 100644
--- a/packages/twenty-ui/src/components/feedback/index.ts
+++ b/packages/twenty-ui/src/components/feedback/index.ts
@@ -8,7 +8,11 @@
*/
export { Callout } from './Callout/Callout';
+export type { CalloutActionProps } from './Callout/types/CalloutActionProps';
+export type { CalloutColor } from './Callout/types/CalloutColor';
export type { CalloutProps } from './Callout/types/CalloutProps';
+export type { CalloutState } from './Callout/types/CalloutState';
+export type { CalloutStatus } from './Callout/types/CalloutStatus';
export type { CalloutVariant } from './Callout/types/CalloutVariant';
export { InlineBanner } from './InlineBanner/InlineBanner';
export type { InlineBannerLayout } from './InlineBanner/types/InlineBannerLayout';
diff --git a/packages/twenty-ui/src/primitives/feedback/Banner/internal/BannerComponent.tsx b/packages/twenty-ui/src/primitives/feedback/Banner/internal/BannerComponent.tsx
index dcd76e004d8..01310db8268 100644
--- a/packages/twenty-ui/src/primitives/feedback/Banner/internal/BannerComponent.tsx
+++ b/packages/twenty-ui/src/primitives/feedback/Banner/internal/BannerComponent.tsx
@@ -1,25 +1,16 @@
import { useRender } from '@base-ui/react/use-render';
import { clsx } from 'clsx';
+import { FEEDBACK_STATUS_COLORS } from '@ui/primitives/feedback/internal/constants/FeedbackStatusColors';
import { isRenderableSlot } from '@ui/utilities/internal/isRenderableSlot';
import styles from '../Banner.module.scss';
-import { type BannerColor } from '../types/BannerColor';
import { type BannerProps } from '../types/BannerProps';
-import { type BannerStatus } from '../types/BannerStatus';
-
-const BANNER_STATUS_COLORS = {
- neutral: 'gray',
- info: 'blue',
- success: 'green',
- warning: 'orange',
- error: 'red',
-} satisfies Record<BannerStatus, BannerColor>;
export const BannerComponent = ({
status = 'info',
variant = 'solid',
- color = BANNER_STATUS_COLORS[status],
+ color = FEEDBACK_STATUS_COLORS[status],
icon,
action,
className,
diff --git a/packages/twenty-ui/src/primitives/feedback/internal/constants/FeedbackStatusColors.ts b/packages/twenty-ui/src/primitives/feedback/internal/constants/FeedbackStatusColors.ts
new file mode 100644
index 00000000000..cb18935a0d2
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/feedback/internal/constants/FeedbackStatusColors.ts
@@ -0,0 +1,10 @@
+import { type BannerColor } from '@ui/primitives/feedback/Banner/types/BannerColor';
+import { type BannerStatus } from '@ui/primitives/feedback/Banner/types/BannerStatus';
+
+export const FEEDBACK_STATUS_COLORS = {
+ neutral: 'gray',
+ info: 'blue',
+ success: 'green',
+ warning: 'orange',
+ error: 'red',
+} satisfies Record<BannerStatus, BannerColor>;