The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Add 32px Avatars and move 40px to xxl (#28394)
Raphaël Bosie11b9cd22145
diff --git a/packages/create-twenty-app/src/constants/template/src/front-components/main-page.tsx b/packages/create-twenty-app/src/constants/template/src/front-components/main-page.tsxindex ce33dd031b5..3afa22a109e 100644--- a/packages/create-twenty-app/src/constants/template/src/front-components/main-page.tsx+++ b/packages/create-twenty-app/src/constants/template/src/front-components/main-page.tsx@@ -204,7 +204,7 @@ const MainPage = () => {padding: '40px',}}>- <Avatar name={APP_DISPLAY_NAME} colorSeed={APP_DISPLAY_NAME} size="xl" />+ <Avatar name={APP_DISPLAY_NAME} colorSeed={APP_DISPLAY_NAME} size="xxl" /><spanstyle={{fontSize: '24px',diff --git a/packages/twenty-cli/app-template/src/front-components/main-page.tsx b/packages/twenty-cli/app-template/src/front-components/main-page.tsxindex ce33dd031b5..3afa22a109e 100644--- a/packages/twenty-cli/app-template/src/front-components/main-page.tsx+++ b/packages/twenty-cli/app-template/src/front-components/main-page.tsx@@ -204,7 +204,7 @@ const MainPage = () => {padding: '40px',}}>- <Avatar name={APP_DISPLAY_NAME} colorSeed={APP_DISPLAY_NAME} size="xl" />+ <Avatar name={APP_DISPLAY_NAME} colorSeed={APP_DISPLAY_NAME} size="xxl" /><spanstyle={{fontSize: '24px',diff --git a/packages/twenty-companion/src/renderer/components/RecordingControls.tsx b/packages/twenty-companion/src/renderer/components/RecordingControls.tsxindex c8d76d737fb..ba0584f7980 100644--- a/packages/twenty-companion/src/renderer/components/RecordingControls.tsx+++ b/packages/twenty-companion/src/renderer/components/RecordingControls.tsx@@ -38,7 +38,7 @@ export const RecordingControls = ({<Avatarname={active.title}colorSeed={active.id}- size="xl"+ size="xxl"shape="rounded-square"/><Section.Headerdiff --git a/packages/twenty-docs/snippets/ui/generated/data-display/avatar.mdx b/packages/twenty-docs/snippets/ui/generated/data-display/avatar.mdxindex 00ab8acd6df..079f6960c77 100644--- a/packages/twenty-docs/snippets/ui/generated/data-display/avatar.mdx+++ b/packages/twenty-docs/snippets/ui/generated/data-display/avatar.mdx@@ -64,8 +64,8 @@Shape of the avatar and its fallback.</ParamField>-<ParamField body="size" type=""lg" | "md" | "sm" | "xl" | "xs"" default="md">- Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), or `xl` (40px).+<ParamField body="size" type=""lg" | "md" | "sm" | "xl" | "xs" | "xxl"" default="md">+ Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), `xl` (32px), or `xxl` (40px).</ParamField><ParamField body="src" type="string | null">@@ -128,8 +128,8 @@Shape of the avatar and its fallback.</ParamField>-<ParamField body="Root.size" type=""lg" | "md" | "sm" | "xl" | "xs"" default="md">- Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), or `xl` (40px).+<ParamField body="Root.size" type=""lg" | "md" | "sm" | "xl" | "xs" | "xxl"" default="md">+ Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), `xl` (32px), or `xxl` (40px).</ParamField><ParamField body="Root.style" type="CSSProperties | ((state: AvatarRootState) => CSSProperties | undefined)">diff --git a/packages/twenty-docs/ui/primitives/data-display/avatar.mdx b/packages/twenty-docs/ui/primitives/data-display/avatar.mdxindex c8099fcb76c..0f534a1d00c 100644--- a/packages/twenty-docs/ui/primitives/data-display/avatar.mdx+++ b/packages/twenty-docs/ui/primitives/data-display/avatar.mdx@@ -79,7 +79,7 @@ export const ContactAvatar = ({imageUrl,initials,}: ContactAvatarProps) => (- <Avatar.Root name={name} shape="circle" size="xl">+ <Avatar.Root name={name} shape="circle" size="xxl"><Avatar.Image src={imageUrl} alt={name} decoding="async" /><Avatar.Fallback role="img" aria-label={name} delay={150}>{initials}@@ -112,7 +112,11 @@ The public `AvatarRootProps`, `AvatarImageProps`, `AvatarFallbackProps`, `Avatarheight={320}/>-`shape` accepts `square`, `rounded-square`, or `circle`. Sizes run from `xs` (12px) to `xl` (40px); `md` is 16px. `variant="outline"` adds a border to the fallback. The `color`, `backgroundColor`, and `borderColor` overrides customize the fallback, while a loaded image keeps its original appearance.+`shape` accepts `square`, `rounded-square`, or `circle`. Sizes are `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), `xl` (32px), and `xxl` (40px). Both `xl` and `xxl` use 16px fallback text.++The former 40px `xl` size is now `xxl`. Update existing `size="xl"` usages to `size="xxl"` when they should remain 40px.++`variant="outline"` adds a border to the fallback. The `color`, `backgroundColor`, and `borderColor` overrides customize the fallback, while a loaded image keeps its original appearance.```tsximport { IconUser } from 'twenty-ui/icon';@@ -122,7 +126,7 @@ export const ContactIcon = () => (<Avataricon={<IconUser />}shape="rounded-square"- size="xl"+ size="xxl"role="img"aria-label="Contact"/>diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-avatar-controls.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-avatar-controls.front-component.tsxindex 84f52892bf1..06f21193af2 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-avatar-controls.front-component.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-avatar-controls.front-component.tsx@@ -41,7 +41,13 @@ const AvatarControls = () => {}}}shape="circle"+ size="xxl"+ />+ <Avatar+ name="32px avatar"size="xl"+ role="img"+ aria-label="32px avatar"/><Avatarname="Disabled avatar"diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-avatar-image.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-avatar-image.front-component.tsxindex 4a655b6c01c..d1a09b8f964 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-avatar-image.front-component.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-avatar-image.front-component.tsx@@ -24,7 +24,7 @@ const AvatarImageExample = () => {{isMounted && (<Avatar.Rootaria-label="Profile avatar"- size="xl"+ size="xxl"render={<button type="button" />}onClick={() => setActivations((count) => count + 1)}style={({ imageLoadingStatus }) =>diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/avatarControlsTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/avatarControlsTest.tsindex 1606d6a0918..7b4f28b81eb 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/avatarControlsTest.ts+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/avatarControlsTest.ts@@ -29,6 +29,11 @@ export const avatarControlsTest: TwentyUiGalleryPlayFunction = async (await expect(button.tagName).toBe('BUTTON');await expect(button).toHaveAttribute('type', 'button');await expect(button).toHaveAttribute('data-ref-tag', 'HTML-BUTTON');+ await expect(button).toHaveStyle({ width: '40px', height: '40px' });+ await expect(canvas.getByRole('img', { name: '32px avatar' })).toHaveStyle({+ width: '32px',+ height: '32px',+ });await userEvent.click(button);await userEvent.keyboard('{Enter} ');await waitFor(() => expect(activations).toHaveTextContent('3'));diff --git a/packages/twenty-front/src/modules/applications/components/AppConnectionHeader.tsx b/packages/twenty-front/src/modules/applications/components/AppConnectionHeader.tsxindex f9a82b0636a..63e65a5adee 100644--- a/packages/twenty-front/src/modules/applications/components/AppConnectionHeader.tsx+++ b/packages/twenty-front/src/modules/applications/components/AppConnectionHeader.tsx@@ -79,7 +79,12 @@ export const AppConnectionHeader = ({onError={() => setHasAppLogoError(true)}/>) : (- <Avatar size="xl" name={appName} colorSeed={appName} shape="square" />+ <Avatar+ size="xxl"+ name={appName}+ colorSeed={appName}+ shape="square"+ />)}</StyledAppLogoTile></StyledContainer>diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWorkspaceCreationForm.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWorkspaceCreationForm.tsxindex cd6cd86bc66..4996882dcb9 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWorkspaceCreationForm.tsx+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWorkspaceCreationForm.tsx@@ -63,11 +63,6 @@ const StyledLogoRow = styled.div`gap: ${themeCssVariables.spacing[2]};`;-const StyledLogoAvatar = styled(Avatar)`- height: ${themeCssVariables.spacing[8]};- width: ${themeCssVariables.spacing[8]};-`;-const StyledLogoButtons = styled.div`align-items: center;display: flex;@@ -251,12 +246,13 @@ export const SignInUpWorkspaceCreationForm = () => {<StyledFormSection><OnboardingStepAnimatedItem index={2}><StyledLogoRow>- <StyledLogoAvatar+ <Avatarsrc={logoPreviewUrl}name={isNonEmptyString(workspaceName) ? workspaceName : '?'}colorSeed={getWorkspaceAvatarColorSeed(workspaceName)}shape="square"size="xl"+ variant="outline"render={<buttontype="button"diff --git a/packages/twenty-front/src/modules/onboarding/components/OnboardingProfilePictureUploader.tsx b/packages/twenty-front/src/modules/onboarding/components/OnboardingProfilePictureUploader.tsxindex 0c5972b86ed..7698becd432 100644--- a/packages/twenty-front/src/modules/onboarding/components/OnboardingProfilePictureUploader.tsx+++ b/packages/twenty-front/src/modules/onboarding/components/OnboardingProfilePictureUploader.tsx@@ -11,33 +11,10 @@ import { FileFolder } from 'twenty-shared/types';import { getImageAbsoluteURI, isDefined } from 'twenty-shared/utils';import { useToast } from 'twenty-ui/components/feedback';import { IconUserCircle } from 'twenty-ui/icon';+import { Avatar } from 'twenty-ui/primitives/data-display';import { themeCssVariables, useTheme } from 'twenty-ui/theme';import { REACT_APP_SERVER_BASE_URL } from '~/config';-const StyledUploader = styled.button`- align-items: center;- background: ${themeCssVariables.background.transparent.lighter};- border: 1px solid ${themeCssVariables.border.color.medium};- border-radius: ${themeCssVariables.border.radius.rounded};- box-sizing: border-box;- color: ${themeCssVariables.font.color.light};- corner-shape: round;- cursor: pointer;- display: flex;- flex-shrink: 0;- height: ${themeCssVariables.spacing[8]};- justify-content: center;- overflow: hidden;- padding: 0;- width: ${themeCssVariables.spacing[8]};-`;--const StyledImage = styled.img`- height: 100%;- object-fit: cover;- width: 100%;-`;-const StyledHiddenFileInput = styled.input`display: none;`;@@ -96,20 +73,27 @@ export const OnboardingProfilePictureUploader = ({return (<>- <StyledUploader- type="button"- aria-label={t`Upload profile picture`}- onClick={() => hiddenFileInputRef.current?.click()}- >- {isNonEmptyString(pictureUri) ? (- <StyledImage src={pictureUri} alt="" />- ) : (- <IconUserCircle- size={theme.icon.size.md}- color={themeCssVariables.font.color.light}+ <Avatar.Root+ size="xl"+ shape="circle"+ variant="outline"+ color={themeCssVariables.font.color.light}+ backgroundColor={themeCssVariables.background.transparent.lighter}+ borderColor={themeCssVariables.border.color.medium}+ render={+ <button+ type="button"+ aria-label={t`Upload profile picture`}+ onClick={() => hiddenFileInputRef.current?.click()}/>- )}- </StyledUploader>+ }+ >+ <Avatar.Image src={pictureUri ?? undefined} alt="" />+ <Avatar.Fallback+ aria-hidden+ render={<IconUserCircle size={theme.icon.size.md} />}+ />+ </Avatar.Root><StyledHiddenFileInputtype="file"ref={hiddenFileInputRef}diff --git a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationAboutSidebar.tsx b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationAboutSidebar.tsxindex 8c59ae04f72..4104e49e472 100644--- a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationAboutSidebar.tsx+++ b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationAboutSidebar.tsx@@ -265,7 +265,7 @@ export const SettingsApplicationAboutSidebar = ({applicationId={applicationId}logoUrl={logoUrl}fallbackApplicationData={{ name: displayName }}- size="xl"+ size="xxl"chipOnly/><StyledIdentity>diff --git a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationOverviewCard.tsx b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationOverviewCard.tsxindex 35712cd80b1..95e40250f9d 100644--- a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationOverviewCard.tsx+++ b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationOverviewCard.tsx@@ -99,7 +99,7 @@ export const SettingsApplicationOverviewCard = ({applicationId={applicationId}logoUrl={logoUrl}fallbackApplicationData={{ name: displayName }}- size="xl"+ size="xxl"chipOnly/><StyledText>diff --git a/packages/twenty-front/src/pages/onboarding/__stories__/CreateProfile.stories.tsx b/packages/twenty-front/src/pages/onboarding/__stories__/CreateProfile.stories.tsxindex 1bdf76766cb..6a8a5c73bbf 100644--- a/packages/twenty-front/src/pages/onboarding/__stories__/CreateProfile.stories.tsx+++ b/packages/twenty-front/src/pages/onboarding/__stories__/CreateProfile.stories.tsx@@ -1,9 +1,12 @@import { getOperationName } from '~/utils/getOperationName';import { type Meta, type StoryObj } from '@storybook/react-vite';import { HttpResponse, graphql } from 'msw';-import { within } from 'storybook/test';+import { expect, spyOn, userEvent, waitFor, within } from 'storybook/test';+import { isDefined } from 'twenty-shared/utils';import { AppPath } from 'twenty-shared/types';+import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';+import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { OnboardingStatus } from '~/generated-metadata/graphql';import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser';import { CreateProfile } from '~/pages/onboarding/CreateProfile';@@ -12,13 +15,27 @@ import {type PageDecoratorArgs,} from '~/testing/decorators/PageDecorator';import { graphqlMocks } from '~/testing/graphqlMocks';-import { mockedOnboardingUserData } from '~/testing/mock-data/users';+import {+ mockedOnboardingUserData,+ mockedWorkspaceMemberData,+} from '~/testing/mock-data/users';const meta: Meta<PageDecoratorArgs> = {title: 'Pages/Onboarding/CreateProfile',component: CreateProfile,decorators: [PageDecorator],args: { routePath: AppPath.CreateProfile },+ beforeEach: () => {+ jotaiStore.set(currentWorkspaceMemberState.atom, {+ ...mockedWorkspaceMemberData,+ avatarUrl: null,+ name: { firstName: '', lastName: '' },+ });++ return () => {+ jotaiStore.set(currentWorkspaceMemberState.atom, null);+ };+ },parameters: {msw: {handlers: [@@ -31,6 +48,9 @@ const meta: Meta<PageDecoratorArgs> = {},});}),+ graphql.query('GetInviteSuggestions', () =>+ HttpResponse.json({ data: { getInviteSuggestions: [] } }),+ ),graphqlMocks.handlers,],},@@ -45,5 +65,36 @@ export const Default: Story = {play: async ({ canvasElement }) => {const canvas = within(canvasElement.ownerDocument.body);await canvas.findByText('Create profile');++ const uploadButton = await canvas.findByRole('button', {+ name: 'Upload profile picture',+ });+ const fileInput =+ uploadButton.parentElement?.querySelector<HTMLInputElement>(+ 'input[type="file"]',+ );++ if (!isDefined(fileInput)) {+ throw new Error('Profile picture file input not found');+ }++ await waitFor(() => expect(uploadButton).toBeVisible());+ await expect(uploadButton).toHaveAttribute('type', 'button');+ await expect(uploadButton).toHaveStyle({ width: '32px', height: '32px' });+ await expect(fileInput).toHaveAttribute(+ 'accept',+ 'image/jpeg, image/png, image/gif',+ );+ const openFilePicker = spyOn(fileInput, 'click').mockImplementation(+ () => undefined,+ );++ try {+ await userEvent.click(uploadButton);+ await userEvent.keyboard('{Enter} ');+ await expect(openFilePicker).toHaveBeenCalledTimes(3);+ } finally {+ openFilePicker.mockRestore();+ }},};diff --git a/packages/twenty-front/src/pages/settings/billing/SettingsUsageUserDetail.tsx b/packages/twenty-front/src/pages/settings/billing/SettingsUsageUserDetail.tsxindex 479dff2e8b4..54e7e5ae55d 100644--- a/packages/twenty-front/src/pages/settings/billing/SettingsUsageUserDetail.tsx+++ b/packages/twenty-front/src/pages/settings/billing/SettingsUsageUserDetail.tsx@@ -114,7 +114,7 @@ export const SettingsUsageUserDetail = () => {<StyledUserHeader><Avatarshape="circle"- size="xl"+ size="xxl"name={displayName}colorSeed={userWorkspaceId}/>diff --git a/packages/twenty-ui/docs/avatarPropDescriptions.ts b/packages/twenty-ui/docs/avatarPropDescriptions.tsindex c310aa91490..d28e5ea42d3 100644--- a/packages/twenty-ui/docs/avatarPropDescriptions.ts+++ b/packages/twenty-ui/docs/avatarPropDescriptions.ts@@ -4,7 +4,7 @@ export const AVATAR_PROP_DESCRIPTIONS = {src: 'Image URL. A missing or failed image shows the fallback. `imageProps.src` overrides this value.',name: 'Name used for the first-letter fallback and fallback colors. Does not add an accessible label.',colorSeed: 'Stable value used to choose fallback colors. Defaults to `name`.',- size: 'Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), or `xl` (40px).',+ size: 'Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), `xl` (32px), or `xxl` (40px).',shape: 'Shape of the avatar and its fallback.',variant: 'Visual treatment of the fallback.',icon: 'Decorative icon rendered instead of the image and first-letter fallback. Give the root an accessible label when the icon conveys information.',diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex 5997eb5884c..31b774a68ee 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -10766,10 +10766,10 @@},{"name": "size",- "type": "\"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\"",+ "type": "\"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\" | \"xxl\"","required": false,"defaultValue": "md",- "description": "Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), or `xl` (40px)."+ "description": "Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), `xl` (32px), or `xxl` (40px)."},{"name": "src",@@ -10876,10 +10876,10 @@},{"name": "size",- "type": "\"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\"",+ "type": "\"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\" | \"xxl\"","required": false,"defaultValue": "md",- "description": "Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), or `xl` (40px)."+ "description": "Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), `xl` (32px), or `xxl` (40px)."},{"name": "style",diff --git a/packages/twenty-ui/src/components/data-display/AvatarGroup/__stories__/AvatarGroup.stories.tsx b/packages/twenty-ui/src/components/data-display/AvatarGroup/__stories__/AvatarGroup.stories.tsxindex 3197e7ee6fa..12da5a4b8ed 100644--- a/packages/twenty-ui/src/components/data-display/AvatarGroup/__stories__/AvatarGroup.stories.tsx+++ b/packages/twenty-ui/src/components/data-display/AvatarGroup/__stories__/AvatarGroup.stories.tsx@@ -16,7 +16,14 @@ import { AvatarGroup } from '@ui/components/data-display/AvatarGroup/AvatarGroupimport { type AvatarGroupProps } from '@ui/components/data-display/AvatarGroup/types/AvatarGroupProps';const AVATAR_SHAPES = ['circle', 'square'] satisfies AvatarShape[];-const AVATAR_SIZES = ['xs', 'sm', 'md', 'lg', 'xl'] satisfies AvatarSize[];+const AVATAR_SIZES = [+ 'xs',+ 'sm',+ 'md',+ 'lg',+ 'xl',+ 'xxl',+] satisfies AvatarSize[];const makeAvatar = ({userName,diff --git a/packages/twenty-ui/src/primitives/data-display/Avatar/Avatar.module.scss b/packages/twenty-ui/src/primitives/data-display/Avatar/Avatar.module.scssindex 19876bed1a1..0e1b1314ecc 100644--- a/packages/twenty-ui/src/primitives/data-display/Avatar/Avatar.module.scss+++ b/packages/twenty-ui/src/primitives/data-display/Avatar/Avatar.module.scss@@ -47,12 +47,18 @@}}-.root[data-size='xl'] {+.root[data-size='xxl'] {font-size: 16px;block-size: 40px;inline-size: 40px;}+.root[data-size='xl'] {+ font-size: 16px;+ block-size: 32px;+ inline-size: 32px;+}+.root[data-size='lg'] {font-size: 13px;block-size: 24px;diff --git a/packages/twenty-ui/src/primitives/data-display/Avatar/__stories__/Avatar.stories.tsx b/packages/twenty-ui/src/primitives/data-display/Avatar/__stories__/Avatar.stories.tsxindex d3ae6d7775b..d9803e4c7c3 100644--- a/packages/twenty-ui/src/primitives/data-display/Avatar/__stories__/Avatar.stories.tsx+++ b/packages/twenty-ui/src/primitives/data-display/Avatar/__stories__/Avatar.stories.tsx@@ -16,11 +16,14 @@ import { Avatar } from '@ui/primitives/data-display/Avatar/Avatar';import { type AvatarProps } from '@ui/primitives/data-display/Avatar/types/AvatarProps';import { type AvatarRootProps } from '@ui/primitives/data-display/Avatar/types/AvatarRootProps';import { type AvatarShape } from '@ui/primitives/data-display/Avatar/types/AvatarShape';+import { type AvatarSize } from '@ui/primitives/data-display/Avatar/types/AvatarSize';import { Button } from '@ui/primitives/input/Button/Button';-import { IconUser } from '@ui/icon';+import { IconUser, IconUserCircle } from '@ui/icon';+import { themeCssVariables } from '@ui/theme';const VALID_IMAGE = illustrationUserUrl;const INVALID_IMAGE = 'data:image/png;base64,invalid';+const UPLOAD_AVATAR_ICON_SIZE = 16;const meta: Meta<typeof Avatar> = {title: 'UI/Data Display/Avatar',@@ -62,6 +65,80 @@ export const Squared: Story = {args: { shape: 'square' },};+export const ExtraLargeSizes: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <>+ <Avatar name="Acme" size="xl" role="img" aria-label="32px avatar" />+ <Avatar name="Acme" size="xxl" role="img" aria-label="40px avatar" />+ </>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ for (const size of [32, 40]) {+ const avatar = canvas.getByRole('img', { name: `${size}px avatar` });++ await expect(avatar).toHaveStyle({+ width: `${size}px`,+ height: `${size}px`,+ fontSize: '16px',+ });+ }+ },+};++export const UploadButtonComposition: ButtonInteractionStory = {+ decorators: [ComponentDecorator],+ args: { onActivate: fn() },+ render: ({ onActivate }) => (+ <Avatar.Root+ size="xl"+ shape="circle"+ variant="outline"+ color={themeCssVariables.font.color.light}+ backgroundColor={themeCssVariables.background.transparent.lighter}+ borderColor={themeCssVariables.border.color.medium}+ render={+ <button+ type="button"+ aria-label="Upload profile picture"+ onClick={onActivate}+ />+ }+ >+ <Avatar.Image alt="" />+ <Avatar.Fallback+ aria-hidden+ render={<IconUserCircle size={UPLOAD_AVATAR_ICON_SIZE} />}+ />+ </Avatar.Root>+ ),+ play: async ({ canvasElement, args }) => {+ const avatar = within(canvasElement).getByRole('button', {+ name: 'Upload profile picture',+ });+ const fallbackIcon = avatar.querySelector('svg');++ await expect(avatar).toHaveAttribute('type', 'button');+ await expect(avatar).toHaveStyle({+ width: '32px',+ height: '32px',+ borderWidth: '1px',+ borderRadius: '50%',+ });+ await expect(fallbackIcon).toHaveAttribute('aria-hidden', 'true');+ await expect(fallbackIcon).toHaveStyle({+ width: `${UPLOAD_AVATAR_ICON_SIZE}px`,+ height: `${UPLOAD_AVATAR_ICON_SIZE}px`,+ });+ avatar.focus();+ await expect(avatar).toHaveFocus();+ await userEvent.keyboard('{Enter} ');+ await expect(args.onActivate).toHaveBeenCalledTimes(2);+ },+};+export const IconTile: Story = {decorators: [ComponentDecorator],args: {@@ -104,7 +181,7 @@ export const NoAvatarPictureSquared: Story = {export const Parts: Story = {decorators: [ComponentDecorator],render: () => (- <Avatar.Root name="Jane Doe" shape="circle" size="xl">+ <Avatar.Root name="Jane Doe" shape="circle" size="xxl"><Avatar.Image src={VALID_IMAGE} alt="Jane Doe" decoding="async" /><Avatar.Fallback role="img" aria-label="Jane Doe">JD@@ -179,7 +256,7 @@ export const ButtonComposition: Story = {args: {src: undefined,name: 'Jane',- size: 'xl',+ size: 'xxl',imageProps: { alt: '' },render: <button type="button" />,'aria-label': "Open Jane's profile",@@ -299,7 +376,7 @@ const ImageChangesExample = (props: AvatarProps) => {{...props}src={src}name="Jane"- size="xl"+ size="xxl"render={<a href="#jane" aria-label="Jane" />}aria-label="Jane"imageProps={{ ...props.imageProps, alt: '' }}@@ -380,7 +457,7 @@ const FallbackDelayExample = () => {<><Button onClick={() => setIsVisible(true)}>Show avatar</Button>{isVisible && (- <Avatar.Root name="Jane Doe" size="xl">+ <Avatar.Root name="Jane Doe" size="xxl"><Avatar.Fallbackdelay={300}render={<strong />}@@ -419,8 +496,8 @@ export const Catalog: CatalogStory<Story, typeof Avatar> = {dimensions: [{name: 'size',- values: ['xs', 'sm', 'md', 'lg', 'xl'],- props: (size: 'xs' | 'sm' | 'md' | 'lg' | 'xl') => ({ size }),+ values: ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'],+ props: (size: AvatarSize) => ({ size }),},{name: 'shape',@@ -449,8 +526,8 @@ export const VisualRegression: CatalogStory<Story, typeof Avatar> = {dimensions: [{name: 'size',- values: ['xs', 'sm', 'md', 'lg', 'xl'],- props: (size: 'xs' | 'sm' | 'md' | 'lg' | 'xl') => ({ size }),+ values: ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'],+ props: (size: AvatarSize) => ({ size }),},{name: 'shape',diff --git a/packages/twenty-ui/src/primitives/data-display/Avatar/constants/AvatarPropertiesBySize.ts b/packages/twenty-ui/src/primitives/data-display/Avatar/constants/AvatarPropertiesBySize.tsindex e44c170cc26..12a89537f47 100644--- a/packages/twenty-ui/src/primitives/data-display/Avatar/constants/AvatarPropertiesBySize.ts+++ b/packages/twenty-ui/src/primitives/data-display/Avatar/constants/AvatarPropertiesBySize.ts@@ -1,8 +1,12 @@export const AVATAR_PROPERTIES_BY_SIZE = {- xl: {+ xxl: {fontSize: '16px',width: '40px',},+ xl: {+ fontSize: '16px',+ width: '32px',+ },lg: {fontSize: '13px',width: '24px',diff --git a/packages/twenty-ui/src/primitives/data-display/Avatar/types/AvatarSize.ts b/packages/twenty-ui/src/primitives/data-display/Avatar/types/AvatarSize.tsindex db1915e1718..9f5d992c092 100644--- a/packages/twenty-ui/src/primitives/data-display/Avatar/types/AvatarSize.ts+++ b/packages/twenty-ui/src/primitives/data-display/Avatar/types/AvatarSize.ts@@ -1 +1 @@-export type AvatarSize = 'xl' | 'lg' | 'md' | 'sm' | 'xs';+export type AvatarSize = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';