The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
feat(twenty-front/Button): add loading state on Button (#10536)
Antoine Moreaux51c34b77d9cc
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/Dropdown.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/Dropdown.tsxindex 014d96c1d12..66432de58fb 100644--- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/Dropdown.tsx+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/Dropdown.tsx@@ -17,12 +17,12 @@ import {useFloating,} from '@floating-ui/react';import { MouseEvent, ReactNode } from 'react';-import { flushSync } from 'react-dom';import { Keys } from 'react-hotkeys-hook';import { useRecoilCallback } from 'recoil';import { isDefined } from 'twenty-shared';import { sleep } from '~/utils/sleep';import { useDropdown } from '../hooks/useDropdown';+import { flushSync } from 'react-dom';const StyledDropdownFallbackAnchor = styled.div`left: 0;diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/DropdownMenu.stories.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/DropdownMenu.stories.tsxindex a654d10aad9..e24ef3556e6 100644--- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/DropdownMenu.stories.tsx+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/DropdownMenu.stories.tsx@@ -82,9 +82,7 @@ export const Empty: Story = {play: async () => {const canvas = within(document.body);- const buttons = await canvas.findAllByRole('button', {- name: 'Open Dropdown',- });+ const buttons = await canvas.findAllByRole('button');userEvent.click(buttons[0]);await waitFor(async () => {@@ -225,16 +223,16 @@ export const WithHeaders: Story = {<StyledDropdownMenuSubheader>Subheader 1</StyledDropdownMenuSubheader><DropdownMenuItemsContainer hasMaxHeight><>- {optionsMock.slice(0, 3).map(({ name }) => (- <MenuItem text={name} />+ {optionsMock.slice(0, 3).map((item) => (+ <MenuItem key={item.id} text={item.name} />))}</></DropdownMenuItemsContainer><DropdownMenuSeparator /><StyledDropdownMenuSubheader>Subheader 2</StyledDropdownMenuSubheader><DropdownMenuItemsContainer>- {optionsMock.slice(3).map(({ name }) => (- <MenuItem text={name} />+ {optionsMock.slice(3).map((item) => (+ <MenuItem key={item.id} text={item.name} />))}</DropdownMenuItemsContainer></>@@ -282,7 +280,7 @@ export const WithInput: Story = {<DropdownMenuSeparator /><DropdownMenuItemsContainer hasMaxHeight>{optionsMock.map(({ name }) => (- <MenuItem text={name} />+ <MenuItem key={name} text={name} />))}</DropdownMenuItemsContainer></>diff --git a/packages/twenty-front/src/pages/settings/__stories__/SettingsBilling.stories.tsx b/packages/twenty-front/src/pages/settings/__stories__/SettingsBilling.stories.tsxindex 521a691035b..40f84d41c28 100644--- a/packages/twenty-front/src/pages/settings/__stories__/SettingsBilling.stories.tsx+++ b/packages/twenty-front/src/pages/settings/__stories__/SettingsBilling.stories.tsx@@ -1,3 +1,4 @@+import { expect } from '@storybook/jest';import { Meta, StoryObj } from '@storybook/react';import { within } from '@storybook/test';@@ -31,6 +32,12 @@ export const Default: Story = {const canvas = within(canvasElement);sleep(1000);- await canvas.findByRole('button', { name: 'View billing details' });+ const buttons = await canvas.findAllByRole('button');++ expect(+ buttons.findIndex((button) =>+ button.outerHTML.includes('View billing details'),+ ),+ ).toBeGreaterThan(-1);},};diff --git a/packages/twenty-front/src/pages/settings/__stories__/SettingsWorkspaceMembers.stories.tsx b/packages/twenty-front/src/pages/settings/__stories__/SettingsWorkspaceMembers.stories.tsxindex c8a0172c41a..e03563b5294 100644--- a/packages/twenty-front/src/pages/settings/__stories__/SettingsWorkspaceMembers.stories.tsx+++ b/packages/twenty-front/src/pages/settings/__stories__/SettingsWorkspaceMembers.stories.tsx@@ -1,3 +1,4 @@+import { expect } from '@storybook/jest';import { Meta, StoryObj } from '@storybook/react';import { within } from '@storybook/test';@@ -30,6 +31,10 @@ export const Default: Story = {await sleep(1000);- await canvas.getByRole('button', { name: 'Copy link' });+ const buttons = await canvas.getAllByRole('button');++ expect(+ buttons.findIndex((button) => button.outerHTML.includes('Copy link')),+ ).toBeGreaterThan(-1);},};diff --git a/packages/twenty-front/src/utils/string/__tests__/formatDateString.test.ts b/packages/twenty-front/src/utils/string/__tests__/formatDateString.test.tsindex 56a48dc4424..aa129bea54a 100644--- a/packages/twenty-front/src/utils/string/__tests__/formatDateString.test.ts+++ b/packages/twenty-front/src/utils/string/__tests__/formatDateString.test.ts@@ -28,7 +28,7 @@ describe('formatDateString', () => {it('should format date as relative when displayAsRelativeDate is true', () => {const mockDate = DateTime.now().minus({ months: 2 }).toISO();- const mockRelativeDate = '2 months ago';+ const mockRelativeDate = 'about 2 months ago';jest.mock('@/localization/utils/formatDateISOStringToRelativeDate', () => ({formatDateISOStringToRelativeDate: jestdiff --git a/packages/twenty-front/src/utils/string/__tests__/formatDateTimeString.test.ts b/packages/twenty-front/src/utils/string/__tests__/formatDateTimeString.test.tsindex 6cbf77a2521..602c4add481 100644--- a/packages/twenty-front/src/utils/string/__tests__/formatDateTimeString.test.ts+++ b/packages/twenty-front/src/utils/string/__tests__/formatDateTimeString.test.ts@@ -30,7 +30,7 @@ describe('formatDateTimeString', () => {it('should format date as relative when displayAsRelativeDate is true', () => {const mockDate = DateTime.now().minus({ months: 2 }).toISO();- const mockRelativeDate = '2 months ago';+ const mockRelativeDate = 'about 2 months ago';jest.mock('@/localization/utils/formatDateISOStringToRelativeDate', () => ({formatDateISOStringToRelativeDate: jestdiff --git a/packages/twenty-ui/src/display/info/components/Info.tsx b/packages/twenty-ui/src/display/info/components/Info.tsxindex d865c7b632f..21db5622270 100644--- a/packages/twenty-ui/src/display/info/components/Info.tsx+++ b/packages/twenty-ui/src/display/info/components/Info.tsx@@ -2,7 +2,7 @@ import { css, useTheme } from '@emotion/react';import styled from '@emotion/styled';import { IconInfoCircle } from '@ui/display/icon/components/TablerIcons';-import { Button } from '@ui/input/button/components/Button';+import { Button } from '@ui/input/button/components/Button/Button';import React from 'react';import { Link } from 'react-router-dom';diff --git a/packages/twenty-ui/src/input/button/components/AnimatedButton.tsx b/packages/twenty-ui/src/input/button/components/AnimatedButton.tsxindex d0ee7e7f174..2d1ee0ce11d 100644--- a/packages/twenty-ui/src/input/button/components/AnimatedButton.tsx+++ b/packages/twenty-ui/src/input/button/components/AnimatedButton.tsx@@ -6,7 +6,12 @@ import { getOsShortcutSeparator } from '@ui/utilities/device/getOsShortcutSeparaimport { MotionProps, motion } from 'framer-motion';import { Link } from 'react-router-dom';-import { ButtonAccent, ButtonProps, ButtonSize, ButtonVariant } from './Button';+import {+ ButtonAccent,+ ButtonProps,+ ButtonSize,+ ButtonVariant,+} from './Button/Button';export type AnimatedButtonProps = ButtonProps &Pick<MotionProps, 'animate' | 'transition'> & {diff --git a/packages/twenty-ui/src/input/button/components/Button.tsx b/packages/twenty-ui/src/input/button/components/Button/Button.tsxsimilarity index 78%rename from packages/twenty-ui/src/input/button/components/Button.tsxrename to packages/twenty-ui/src/input/button/components/Button/Button.tsxindex 536977168f7..f107f0cd581 100644--- a/packages/twenty-ui/src/input/button/components/Button.tsx+++ b/packages/twenty-ui/src/input/button/components/Button/Button.tsx@@ -1,12 +1,14 @@import isPropValid from '@emotion/is-prop-valid';-import { css, useTheme } from '@emotion/react';+import { css } from '@emotion/react';import styled from '@emotion/styled';-import { Pill } from '@ui/components/Pill/Pill';import { IconComponent } from '@ui/display/icon/types/IconComponent';import { useIsMobile } from '@ui/utilities';-import { getOsShortcutSeparator } from '@ui/utilities/device/getOsShortcutSeparator';-import React from 'react';+import React, { useState } from 'react';import { Link } from 'react-router-dom';+import { ButtonText } from './internal/ButtonText';+import { ButtonIcon } from '@ui/input/button/components/Button/internal/ButtonIcon';+import { ButtonSoon } from '@ui/input/button/components/Button/internal/ButtonSoon';+import { ButtonHotkeys } from '@ui/input/button/components/Button/internal/ButtonHotKeys';export type ButtonSize = 'medium' | 'small';export type ButtonPosition = 'standalone' | 'left' | 'middle' | 'right';@@ -33,6 +35,7 @@ export type ButtonProps = {dataTestId?: string;hotkeys?: string[];ariaLabel?: string;+ loading?: boolean;} & React.ComponentProps<'button'>;const StyledButton = styled('button', {@@ -51,7 +54,8 @@ const StyledButton = styled('button', {| 'justify'| 'to'| 'target'- >+ | 'loading'+ > & { hasIcon: boolean }>`align-items: center;${({ theme, variant, inverted, accent, disabled, focus }) => {@@ -337,8 +341,10 @@ const StyledButton = styled('button', {gap: ${({ theme }) => theme.spacing(1)};height: ${({ size }) => (size === 'small' ? '24px' : '32px')};justify-content: ${({ justify }) => justify};- padding: ${({ theme }) => {- return `0 ${theme.spacing(2)}`;+ padding: ${({ theme, hasIcon }) => {+ return `0 ${theme.spacing(2)} 0 ${+ hasIcon ? theme.spacing(7) : theme.spacing(2)+ }`;}};transition: background 0.1s ease;@@ -352,47 +358,56 @@ const StyledButton = styled('button', {}`;-const StyledSoonPill = styled(Pill)`- margin-left: auto;-`;--const StyledSeparator = styled.div<{- buttonSize: ButtonSize;- accent: ButtonAccent;-}>`- background: ${({ theme, accent }) => {- switch (accent) {- case 'blue':- return theme.border.color.blue;- case 'danger':- return theme.border.color.danger;- default:- return theme.font.color.light;- }- }};- height: ${({ theme, buttonSize }) =>- theme.spacing(buttonSize === 'small' ? 2 : 4)};- margin: 0;- width: 1px;-`;+const StyledButtonWrapper = styled.div<+ Pick<ButtonProps, 'loading' | 'variant' | 'accent' | 'inverted' | 'disabled'>+>`+ ${({ theme, variant, accent, inverted, disabled }) => css`+ --tw-button-color: ${(() => {+ switch (variant) {+ case 'primary':+ switch (accent) {+ case 'default':+ return !inverted+ ? !disabled+ ? theme.font.color.secondary+ : theme.font.color.extraLight+ : theme.font.color.secondary;+ case 'blue':+ return !inverted ? theme.grayScale.gray0 : theme.color.blue;+ case 'danger':+ return !inverted ? theme.background.primary : theme.color.red;+ }+ break;+ case 'secondary':+ case 'tertiary':+ switch (accent) {+ case 'default':+ return !inverted+ ? !disabled+ ? theme.font.color.secondary+ : theme.font.color.extraLight+ : theme.font.color.inverted;+ case 'blue':+ return !inverted+ ? !disabled+ ? theme.color.blue+ : theme.accent.accent4060+ : theme.font.color.inverted;+ case 'danger':+ return !inverted+ ? theme.font.color.danger+ : theme.font.color.inverted;+ }+ break;+ }+ return theme.font.color.secondary; // Valeur par défaut+ })()};+ `}-const StyledShortcutLabel = styled.div<{- variant: ButtonVariant;- accent: ButtonAccent;-}>`- color: ${({ theme, variant, accent }) => {- switch (accent) {- case 'blue':- return theme.border.color.blue;- case 'danger':- return variant === 'primary'- ? theme.border.color.danger- : theme.color.red40;- default:- return theme.font.color.light;- }- }};- font-weight: ${({ theme }) => theme.font.weight.medium};+ height: 100%;+ max-width: ${({ loading, theme }) =>+ loading ? `calc(100% - ${theme.spacing(8)})` : 'none'};+ position: relative;`;export const Button = ({@@ -416,46 +431,53 @@ export const Button = ({hotkeys,ariaLabel,type,+ loading,}: ButtonProps) => {- const theme = useTheme();-const isMobile = useIsMobile();- const [isFocused, setIsFocused] = React.useState(propFocus);+ const [isFocused, setIsFocused] = useState(propFocus);return (- <StyledButton- fullWidth={fullWidth}+ <StyledButtonWrapper+ loading={loading}variant={variant}inverted={inverted}- size={size}- position={position}disabled={soon || disabled}- focus={isFocused}- justify={justify}- accent={accent}- className={className}- onClick={onClick}- to={to}- as={to ? Link : 'button'}- target={target}- data-testid={dataTestId}- aria-label={ariaLabel}- type={type}- onFocus={() => setIsFocused(true)}- onBlur={() => setIsFocused(false)}>- {Icon && <Icon size={theme.icon.size.sm} />}- {title}- {hotkeys && !isMobile && (- <>- <StyledSeparator buttonSize={size} accent={accent} />- <StyledShortcutLabel variant={variant} accent={accent}>- {hotkeys.join(getOsShortcutSeparator())}- </StyledShortcutLabel>- </>- )}- {soon && <StyledSoonPill label="Soon" />}- </StyledButton>+ {(loading || Icon) && <ButtonIcon Icon={Icon} loading={loading} />}+ <StyledButton+ fullWidth={fullWidth}+ variant={variant}+ inverted={inverted}+ position={position}+ disabled={soon || disabled}+ hasIcon={!!Icon}+ focus={isFocused}+ justify={justify}+ accent={accent}+ className={className}+ onClick={onClick}+ to={to}+ as={to ? Link : 'button'}+ target={target}+ data-testid={dataTestId}+ aria-label={ariaLabel}+ type={type}+ loading={loading}+ onFocus={() => setIsFocused(true)}+ onBlur={() => setIsFocused(false)}+ >+ <ButtonText hasIcon={!!Icon} title={title} loading={loading} />+ {hotkeys && !isMobile && (+ <ButtonHotkeys+ hotkeys={hotkeys}+ variant={variant}+ accent={accent}+ size={size}+ />+ )}+ {soon && <ButtonSoon />}+ </StyledButton>+ </StyledButtonWrapper>);};diff --git a/packages/twenty-ui/src/input/button/components/Button/constant.ts b/packages/twenty-ui/src/input/button/components/Button/constant.tsnew file mode 100644index 00000000000..62b9b9e064f--- /dev/null+++ b/packages/twenty-ui/src/input/button/components/Button/constant.ts@@ -0,0 +1 @@+export const baseTransitionTiming = 300;diff --git a/packages/twenty-ui/src/input/button/components/Button/internal/ButtonHotKeys.tsx b/packages/twenty-ui/src/input/button/components/Button/internal/ButtonHotKeys.tsxnew file mode 100644index 00000000000..87b4360058a--- /dev/null+++ b/packages/twenty-ui/src/input/button/components/Button/internal/ButtonHotKeys.tsx@@ -0,0 +1,61 @@+import { getOsShortcutSeparator } from '@ui/utilities';+import { ButtonAccent, ButtonSize, ButtonVariant } from '@ui/input';+import styled from '@emotion/styled';++const StyledSeparator = styled.div<{+ buttonSize: ButtonSize;+ accent: ButtonAccent;+}>`+ background: ${({ theme, accent }) => {+ switch (accent) {+ case 'blue':+ return theme.border.color.blue;+ case 'danger':+ return theme.border.color.danger;+ default:+ return theme.font.color.light;+ }+ }};+ height: ${({ theme, buttonSize }) =>+ theme.spacing(buttonSize === 'small' ? 2 : 4)};+ margin: 0;+ width: 1px;+`;++const StyledShortcutLabel = styled.div<{+ variant: ButtonVariant;+ accent: ButtonAccent;+}>`+ color: ${({ theme, variant, accent }) => {+ switch (accent) {+ case 'blue':+ return theme.border.color.blue;+ case 'danger':+ return variant === 'primary'+ ? theme.border.color.danger+ : theme.color.red40;+ default:+ return theme.font.color.light;+ }+ }};+ font-weight: ${({ theme }) => theme.font.weight.medium};+`;++export const ButtonHotkeys = ({+ size,+ accent,+ variant,+ hotkeys,+}: {+ size: ButtonSize;+ accent: ButtonAccent;+ variant: ButtonVariant;+ hotkeys: string[];+}) => (+ <>+ <StyledSeparator buttonSize={size} accent={accent} />+ <StyledShortcutLabel variant={variant} accent={accent}>+ {hotkeys.join(getOsShortcutSeparator())}+ </StyledShortcutLabel>+ </>+);diff --git a/packages/twenty-ui/src/input/button/components/Button/internal/ButtonIcon.tsx b/packages/twenty-ui/src/input/button/components/Button/internal/ButtonIcon.tsxnew file mode 100644index 00000000000..41ae8fe4ee6--- /dev/null+++ b/packages/twenty-ui/src/input/button/components/Button/internal/ButtonIcon.tsx@@ -0,0 +1,69 @@+import { Loader } from '@ui/feedback';+import { baseTransitionTiming } from '@ui/input/button/components/Button/constant';+import { IconComponent } from '@ui/display';+import { useTheme } from '@emotion/react';+import styled from '@emotion/styled';+import { isDefined } from 'twenty-shared';++const StyledIcon = styled.div<{+ loading?: boolean;+}>`+ align-items: center;+ display: flex;+ height: 100%;+ color: var(--tw-button-color);++ padding: 8px;++ opacity: ${({ loading }) => (loading ? 0 : 1)};+ transition: opacity ${baseTransitionTiming / 2}ms ease;+ transition-delay: ${({ loading }) =>+ loading ? '0ms' : `${baseTransitionTiming / 2}ms`};+`;++const StyledIconWrapper = styled.div<{ loading?: boolean }>`+ align-items: center;+ display: flex;+ height: 100%;++ position: absolute;+ top: 50%;+ transform: translateY(-50%);++ width: ${({ loading }) => (loading ? 0 : '100%')};+`;++const StyledLoader = styled.div<{ loading?: boolean }>`+ left: ${({ theme }) => theme.spacing(2)};+ opacity: ${({ loading }) => (loading ? 1 : 0)};+ position: absolute;++ transition: opacity ${baseTransitionTiming / 2}ms ease;+ transition-delay: ${({ loading }) =>+ loading ? `${baseTransitionTiming / 2}ms` : '0ms'};+ width: ${({ theme }) => theme.spacing(6)};+`;++export const ButtonIcon = ({+ Icon,+ loading,+}: {+ Icon?: IconComponent;+ loading?: boolean;+}) => {+ const theme = useTheme();+ return (+ <StyledIconWrapper loading={loading}>+ {isDefined(loading) && (+ <StyledLoader loading={loading}>+ <Loader />+ </StyledLoader>+ )}+ {Icon && (+ <StyledIcon loading={loading}>+ <Icon size={theme.icon.size.sm} />+ </StyledIcon>+ )}+ </StyledIconWrapper>+ );+};diff --git a/packages/twenty-ui/src/input/button/components/Button/internal/ButtonSoon.tsx b/packages/twenty-ui/src/input/button/components/Button/internal/ButtonSoon.tsxnew file mode 100644index 00000000000..a9533c00ad8--- /dev/null+++ b/packages/twenty-ui/src/input/button/components/Button/internal/ButtonSoon.tsx@@ -0,0 +1,8 @@+import styled from '@emotion/styled';+import { Pill } from '@ui/components';++const StyledSoonPill = styled(Pill)`+ margin-left: auto;+`;++export const ButtonSoon = () => <StyledSoonPill label="Soon" />;diff --git a/packages/twenty-ui/src/input/button/components/Button/internal/ButtonText.tsx b/packages/twenty-ui/src/input/button/components/Button/internal/ButtonText.tsxnew file mode 100644index 00000000000..25d8ce0a2a3--- /dev/null+++ b/packages/twenty-ui/src/input/button/components/Button/internal/ButtonText.tsx@@ -0,0 +1,59 @@+import styled from '@emotion/styled';+import { baseTransitionTiming } from '@ui/input/button/components/Button/constant';++const StyledEllipsis = styled.div<{ loading?: boolean }>`+ right: 0;+ clip-path: ${({ theme, loading }) =>+ loading ? `inset(0 0 0 0)` : `inset(0 0 0 ${theme.spacing(6)})`};+ overflow: hidden;+ position: absolute;++ transition: clip-path ${baseTransitionTiming}ms ease;+`;++const StyledTextWrapper = styled.div`+ align-items: center;+ display: flex;+ height: 100%;+ justify-content: center;+ position: relative;+`;++const StyledText = styled.div<{ loading?: boolean; hasIcon: boolean }>`+ clip-path: ${({ loading, theme, hasIcon }) =>+ loading+ ? ` inset(0 ${!hasIcon ? theme.spacing(12) : theme.spacing(6)} 0 0)`+ : ' inset(0 0 0 0)'};++ overflow: hidden;++ transform: ${({ theme, loading, hasIcon }) =>+ loading+ ? `translateX(${!hasIcon ? theme.spacing(7) : theme.spacing(3)})`+ : 'none'};++ transition:+ transform ${baseTransitionTiming}ms ease,+ clip-path ${baseTransitionTiming}ms ease;++ transition-delay: ${({ loading }) =>+ loading ? '0ms' : `${baseTransitionTiming / 4}ms`};+ white-space: nowrap;+`;++export const ButtonText = ({+ hasIcon = false,+ loading,+ title,+}: {+ loading?: boolean;+ hasIcon: boolean;+ title?: string;+}) => (+ <StyledTextWrapper>+ <StyledText loading={loading} hasIcon={hasIcon}>+ {title}+ </StyledText>+ <StyledEllipsis loading={loading}>...</StyledEllipsis>+ </StyledTextWrapper>+);diff --git a/packages/twenty-ui/src/input/button/components/ButtonGroup.tsx b/packages/twenty-ui/src/input/button/components/ButtonGroup.tsxindex 9735685b39a..f71a98133fa 100644--- a/packages/twenty-ui/src/input/button/components/ButtonGroup.tsx+++ b/packages/twenty-ui/src/input/button/components/ButtonGroup.tsx@@ -3,7 +3,7 @@ import React, { ReactNode } from 'react';import { isDefined } from 'twenty-shared';-import { ButtonPosition, ButtonProps } from './Button';+import { ButtonPosition, ButtonProps } from './Button/Button';const StyledButtonGroupContainer = styled.div`border-radius: ${({ theme }) => theme.border.radius.md};diff --git a/packages/twenty-ui/src/input/button/components/__stories__/Button.stories.tsx b/packages/twenty-ui/src/input/button/components/__stories__/Button.stories.tsxindex a52510fd5c7..cb595035599 100644--- a/packages/twenty-ui/src/input/button/components/__stories__/Button.stories.tsx+++ b/packages/twenty-ui/src/input/button/components/__stories__/Button.stories.tsx@@ -1,5 +1,5 @@import { Meta, StoryObj } from '@storybook/react';-import { IconSearch } from '@ui/display';+import { IconReload, IconSearch } from '@ui/display';import {CatalogDecorator,CatalogStory,@@ -11,7 +11,7 @@ import {ButtonPosition,ButtonSize,ButtonVariant,-} from '../Button';+} from '../Button/Button';const meta: Meta<typeof Button> = {title: 'UI/Input/Button/Button',@@ -39,6 +39,7 @@ export const Default: Story = {position: 'standalone',Icon: IconSearch,className: '',+ loading: false,},decorators: [ComponentDecorator],};@@ -55,6 +56,7 @@ export const Catalog: CatalogStory<Story, typeof Button> = {soon: { control: false },position: { control: false },className: { control: false },+ loading: { control: false },},parameters: {pseudo: { hover: ['.hover'], active: ['.pressed'], focus: ['.focus'] },@@ -322,3 +324,35 @@ export const FullWidth: Story = {},decorators: [ComponentDecorator],};++export const LoadingButton: Story = {+ args: {+ title: 'Reload',+ Icon: IconReload,+ loading: true,+ },+ argTypes: {+ size: { control: false },+ variant: { control: false },+ accent: { control: false },+ focus: { control: false },+ disabled: { control: false },+ fullWidth: { control: false },+ soon: { control: false },+ position: { control: false },+ className: { control: false },+ loading: { control: 'boolean' },+ },+ parameters: {+ catalog: {+ loading: [+ {+ name: 'loading',+ values: [true, false] satisfies boolean[],+ props: (value: boolean) => ({ loading: value }),+ },+ ],+ },+ },+ decorators: [ComponentDecorator],+};diff --git a/packages/twenty-ui/src/input/button/components/__stories__/ButtonGroup.stories.tsx b/packages/twenty-ui/src/input/button/components/__stories__/ButtonGroup.stories.tsxindex ec4e492c7fb..ce03eb7e828 100644--- a/packages/twenty-ui/src/input/button/components/__stories__/ButtonGroup.stories.tsx+++ b/packages/twenty-ui/src/input/button/components/__stories__/ButtonGroup.stories.tsx@@ -5,7 +5,12 @@ import {CatalogStory,ComponentDecorator,} from '@ui/testing';-import { Button, ButtonAccent, ButtonSize, ButtonVariant } from '../Button';+import {+ Button,+ ButtonAccent,+ ButtonSize,+ ButtonVariant,+} from '../Button/Button';import { ButtonGroup } from '../ButtonGroup';const meta: Meta<typeof ButtonGroup> = {diff --git a/packages/twenty-ui/src/input/button/components/index.ts b/packages/twenty-ui/src/input/button/components/index.tsdeleted file mode 100644index e69de29bb2d..00000000000diff --git a/packages/twenty-ui/src/input/index.ts b/packages/twenty-ui/src/input/index.tsindex 6553c8b19ad..f895f42736c 100644--- a/packages/twenty-ui/src/input/index.ts+++ b/packages/twenty-ui/src/input/index.ts@@ -1,6 +1,7 @@export * from './button/components/AnimatedButton';export * from './button/components/AnimatedLightIconButton';-export * from './button/components/Button';+export * from './button/components/Button/Button';+export * from './button/components/Button/constant';export * from './button/components/ButtonGroup';export * from './button/components/ColorPickerButton';export * from './button/components/FloatingButton';