Skip to content

The open alternative to Salesforce, designed for AI.

[1/4] Desktop Recorder: support existing UI controls (#25632)

Thomas des Francs4019e10d1e29
diff --git a/packages/twenty-ui/src/feedback/AnimatedPlaceholder/AnimatedPlaceholder.tsx b/packages/twenty-ui/src/feedback/AnimatedPlaceholder/AnimatedPlaceholder.tsx
index 039e2bb8066..38233b49405 100644
--- a/packages/twenty-ui/src/feedback/AnimatedPlaceholder/AnimatedPlaceholder.tsx
+++ b/packages/twenty-ui/src/feedback/AnimatedPlaceholder/AnimatedPlaceholder.tsx
@@ -17,9 +17,13 @@ export type AnimatedPlaceholderType =
type AnimatedPlaceholderProps = {
type: AnimatedPlaceholderType;
+ assetBasePath?: string;
};
-export const AnimatedPlaceholder = ({ type }: AnimatedPlaceholderProps) => {
+export const AnimatedPlaceholder = ({
+ type,
+ assetBasePath = '',
+}: AnimatedPlaceholderProps) => {
const colorScheme = useThemeColorScheme();
const movingImageRef = useRef<HTMLImageElement>(null);
@@ -68,7 +72,7 @@ export const AnimatedPlaceholder = ({ type }: AnimatedPlaceholderProps) => {
return (
<div className={styles.container}>
<img
- src={colorScheme === 'dark' ? DARK_BACKGROUND[type] : BACKGROUND[type]}
+ src={`${assetBasePath}${colorScheme === 'dark' ? DARK_BACKGROUND[type] : BACKGROUND[type]}`}
alt=""
className={clsx(
styles.backgroundImage,
@@ -77,9 +81,7 @@ export const AnimatedPlaceholder = ({ type }: AnimatedPlaceholderProps) => {
/>
<img
ref={movingImageRef}
- src={
- colorScheme === 'dark' ? DARK_MOVING_IMAGE[type] : MOVING_IMAGE[type]
- }
+ src={`${assetBasePath}${colorScheme === 'dark' ? DARK_MOVING_IMAGE[type] : MOVING_IMAGE[type]}`}
alt=""
className={clsx(styles.movingImage, isLarge && styles.movingImageLarge)}
/>
diff --git a/packages/twenty-ui/src/input/Button/Button.tsx b/packages/twenty-ui/src/input/Button/Button.tsx
index 91ae7634920..0bcef9cde95 100644
--- a/packages/twenty-ui/src/input/Button/Button.tsx
+++ b/packages/twenty-ui/src/input/Button/Button.tsx
@@ -39,6 +39,7 @@ export type ButtonProps = {
dataTestId?: string;
hotkeys?: string[];
ariaLabel?: string;
+ ariaExpanded?: boolean;
isLoading?: boolean;
} & Pick<React.ComponentProps<'button'>, 'type'> &
ClickOutsideAttributes;
@@ -66,6 +67,7 @@ export const Button = ({
dataGloballyPreventClickOutside,
hotkeys,
ariaLabel,
+ ariaExpanded,
type,
isLoading = false,
}: ButtonProps) => {
@@ -110,6 +112,7 @@ export const Button = ({
data-click-outside-id={dataClickOutsideId}
data-globally-prevent-click-outside={dataGloballyPreventClickOutside}
aria-label={ariaLabel}
+ aria-expanded={ariaExpanded}
type={type}
onFocus={() => setIsFocused(true)}
onBlur={() => setIsFocused(false)}
diff --git a/packages/twenty-ui/src/input/Button/internal/ButtonIcon.tsx b/packages/twenty-ui/src/input/Button/internal/ButtonIcon.tsx
index 1e214130e19..829866eb6b1 100644
--- a/packages/twenty-ui/src/input/Button/internal/ButtonIcon.tsx
+++ b/packages/twenty-ui/src/input/Button/internal/ButtonIcon.tsx
@@ -1,5 +1,5 @@
import { type IconComponent } from '@ui/icon';
-import { Loader } from '@ui/feedback';
+import { Loader } from '@ui/feedback/Loader/Loader';
import { useTheme } from '@ui/theme-constants';
import styles from './ButtonIcon.module.scss';
diff --git a/packages/twenty-ui/src/input/Button/internal/ButtonSoon.tsx b/packages/twenty-ui/src/input/Button/internal/ButtonSoon.tsx
index 9cf0dd15409..d91750bdc67 100644
--- a/packages/twenty-ui/src/input/Button/internal/ButtonSoon.tsx
+++ b/packages/twenty-ui/src/input/Button/internal/ButtonSoon.tsx
@@ -1,4 +1,4 @@
-import { Pill } from '@ui/data-display';
+import { Pill } from '@ui/data-display/Pill/Pill';
import styles from './ButtonSoon.module.scss';
diff --git a/packages/twenty-ui/src/input/IconButton/IconButton.tsx b/packages/twenty-ui/src/input/IconButton/IconButton.tsx
index bf670abb1d8..9056a319bdd 100644
--- a/packages/twenty-ui/src/input/IconButton/IconButton.tsx
+++ b/packages/twenty-ui/src/input/IconButton/IconButton.tsx
@@ -11,7 +11,7 @@ export type IconButtonPosition = 'standalone' | 'left' | 'middle' | 'right';
export type IconButtonVariant = 'primary' | 'secondary' | 'tertiary';
export type IconButtonAccent = 'default' | 'blue' | 'danger';
-export type IconButtonProps = {
+export type IconButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
className?: string;
Icon?: IconComponent;
variant?: IconButtonVariant;
@@ -27,41 +27,55 @@ export type IconButtonProps = {
children?: React.ReactNode;
};
-export const IconButton = ({
- className,
- Icon,
- variant = 'primary',
- size = 'medium',
- accent = 'default',
- position = 'standalone',
- disabled = false,
- focus = false,
- dataTestId,
- ariaLabel,
- onClick,
- to,
- children,
-}: IconButtonProps) => {
- const theme = useTheme();
+export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
+ (
+ {
+ className,
+ Icon,
+ variant = 'primary',
+ size = 'medium',
+ accent = 'default',
+ position = 'standalone',
+ disabled = false,
+ focus = false,
+ dataTestId,
+ ariaLabel,
+ 'aria-label': nativeAriaLabel,
+ onClick,
+ to,
+ children,
+ ...buttonProps
+ },
+ ref,
+ ) => {
+ const theme = useTheme();
+ const resolvedAriaLabel = ariaLabel ?? nativeAriaLabel;
- return (
- <button
- data-testid={dataTestId}
- className={clsx(styles.button, styles[size], className)}
- data-variant={variant}
- data-accent={accent}
- data-position={position}
- data-disabled={disabled || undefined}
- data-focus={focus || undefined}
- disabled={disabled}
- onClick={onClick}
- aria-label={ariaLabel}
- // The legacy Linaria button never navigated: `to` was simply forwarded
- // to the DOM as an inert attribute. Keep forwarding it for DOM parity.
- {...{ to }}
- >
- {Icon && <Icon size={theme.icon.size.md} aria-hidden={!!ariaLabel} />}
- {children}
- </button>
- );
-};
+ return (
+ <button
+ {...buttonProps}
+ ref={ref}
+ data-testid={dataTestId}
+ className={clsx(styles.button, styles[size], className)}
+ data-variant={variant}
+ data-accent={accent}
+ data-position={position}
+ data-disabled={disabled || undefined}
+ data-focus={focus || undefined}
+ disabled={disabled}
+ onClick={onClick}
+ aria-label={resolvedAriaLabel}
+ // The legacy Linaria button never navigated: `to` was simply forwarded
+ // to the DOM as an inert attribute. Keep forwarding it for DOM parity.
+ {...{ to }}
+ >
+ {Icon ? (
+ <Icon size={theme.icon.size.md} aria-hidden={!!resolvedAriaLabel} />
+ ) : null}
+ {children}
+ </button>
+ );
+ },
+);
+
+IconButton.displayName = 'IconButton';