The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Remove unused Twenty UI buttons (#26293)
Raphaël Bosi7357eb77eead
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-input-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-input-gallery.front-component.tsxindex e98a7e9b6ab..14546e433ac 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-input-gallery.front-component.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-input-gallery.front-component.tsx@@ -11,11 +11,8 @@ import { CodeEditorHeader } from 'twenty-ui/components/code-editor';import {Button,ButtonGroup,- ColorPickerButton,ColorSchemeCard,ColorSchemePicker,- FloatingButton,- FloatingButtonGroup,IconListViewGrip,SearchInput,SegmentedControl,@@ -68,10 +65,6 @@ const INPUT_ENTRIES: GalleryEntry[] = [name: 'CodeEditorHeader',node: <CodeEditorHeader title="Editor" />,},- {- name: 'ColorPickerButton',- node: <ColorPickerButton colorName="blue" onClick={() => {}} />,- },{name: 'ColorSchemeCard',node: <ColorSchemeCard variant="Light" />,@@ -88,21 +81,6 @@ const INPUT_ENTRIES: GalleryEntry[] = [/>),},- {- name: 'FloatingButton',- node: <FloatingButton title="Floating" />,- },- {- name: 'FloatingButtonGroup',- node: (- <FloatingButtonGroup>- {[- <FloatingButton key="a" title="A" />,- <FloatingButton key="b" title="B" />,- ]}- </FloatingButtonGroup>- ),- },{name: 'IconButton (elevated)',node: (diff --git a/packages/twenty-ui/src/primitives/input/ColorPickerButton/ColorPickerButton.module.scss b/packages/twenty-ui/src/primitives/input/ColorPickerButton/ColorPickerButton.module.scssdeleted file mode 100644index da2547f83f4..00000000000--- a/packages/twenty-ui/src/primitives/input/ColorPickerButton/ColorPickerButton.module.scss+++ /dev/null@@ -1,13 +0,0 @@-.wrapper[data-selected] {- --tw-color-picker-button-background: var(--t-background-transparent-medium);-}--.wrapper .button[data-variant='ghost'] {- --tw-button-background: var(--tw-color-picker-button-background, transparent);- --tw-button-hover: var(--tw-color-picker-button-background, transparent);- --tw-button-active: var(--tw-color-picker-button-background, transparent);-}--.button {- @include square-button;-}diff --git a/packages/twenty-ui/src/primitives/input/ColorPickerButton/ColorPickerButton.module.scss.d.ts b/packages/twenty-ui/src/primitives/input/ColorPickerButton/ColorPickerButton.module.scss.d.tsdeleted file mode 100644index 89244f29579..00000000000--- a/packages/twenty-ui/src/primitives/input/ColorPickerButton/ColorPickerButton.module.scss.d.ts+++ /dev/null@@ -1,5 +0,0 @@-declare const classNames: {- readonly button: 'button';- readonly wrapper: 'wrapper';-};-export default classNames;diff --git a/packages/twenty-ui/src/primitives/input/ColorPickerButton/ColorPickerButton.tsx b/packages/twenty-ui/src/primitives/input/ColorPickerButton/ColorPickerButton.tsxdeleted file mode 100644index d88be500a93..00000000000--- a/packages/twenty-ui/src/primitives/input/ColorPickerButton/ColorPickerButton.tsx+++ /dev/null@@ -1,32 +0,0 @@-import {- ColorSample,- type ColorSampleProps,-} from '@ui/primitives/data-display';-import { Button } from '@ui/primitives/input/Button/Button';-import { type ButtonProps } from '@ui/primitives/input/Button/types/ButtonProps';--import styles from './ColorPickerButton.module.scss';--type ColorPickerButtonProps = Pick<ColorSampleProps, 'colorName'> &- Pick<ButtonProps, 'onClick'> & {- isSelected?: boolean;- };--export const ColorPickerButton = ({- colorName,- isSelected,- onClick,-}: ColorPickerButtonProps) => {- return (- <div className={styles.wrapper} data-selected={isSelected || undefined}>- <Button- size="md"- variant="ghost"- className={styles.button}- startIcon={<ColorSample colorName={colorName} />}- aria-label={`Select ${colorName} color`}- onClick={onClick}- />- </div>- );-};diff --git a/packages/twenty-ui/src/primitives/input/ColorPickerButton/__stories__/ColorPickerButton.stories.tsx b/packages/twenty-ui/src/primitives/input/ColorPickerButton/__stories__/ColorPickerButton.stories.tsxdeleted file mode 100644index 4bc94602548..00000000000--- a/packages/twenty-ui/src/primitives/input/ColorPickerButton/__stories__/ColorPickerButton.stories.tsx+++ /dev/null@@ -1,33 +0,0 @@-import { expect, userEvent, waitFor, within } from 'storybook/test';-import { type Meta, type StoryObj } from '@storybook/react-vite';-import { ComponentDecorator } from '@ui/testing';-import { ColorPickerButton } from '@ui/primitives/input/ColorPickerButton/ColorPickerButton';--const meta: Meta<typeof ColorPickerButton> = {- title: 'UI/Input/Button/ColorPickerButton',- component: ColorPickerButton,- decorators: [ComponentDecorator],- args: { colorName: 'green' },-};--export default meta;-type Story = StoryObj<typeof ColorPickerButton>;--export const Default: Story = {};--export const Selected: Story = {- args: { isSelected: true },- play: async ({ canvasElement }) => {- const button = within(canvasElement).getByRole('button', {- name: 'Select green color',- });- const background = getComputedStyle(button).backgroundColor;- await expect(button.getBoundingClientRect().width).toBe(32);- await expect(background).not.toBe('rgba(0, 0, 0, 0)');- await userEvent.hover(button);- await waitFor(() => {- expect(button.getAnimations()).toHaveLength(0);- expect(getComputedStyle(button).backgroundColor).toBe(background);- });- },-};diff --git a/packages/twenty-ui/src/primitives/input/FloatingButton/FloatingButton.module.scss b/packages/twenty-ui/src/primitives/input/FloatingButton/FloatingButton.module.scssdeleted file mode 100644index 5d5f4dfb6d9..00000000000--- a/packages/twenty-ui/src/primitives/input/FloatingButton/FloatingButton.module.scss+++ /dev/null@@ -1,104 +0,0 @@-// State rules below only assign CSS custom properties; the actual-// declarations live on the flat .button class so twenty-front-// styled(FloatingButton) overrides keep beating them at (0,1,0) specificity,-// exactly like the legacy single Linaria class did.--.button {- align-items: center;- backdrop-filter: var(--floating-button-backdrop-filter, none);- background: var(--t-background-primary);- border: var(--floating-button-border, none);- border-radius: var(--floating-button-radius, var(--t-border-radius-md));- box-shadow: var(--floating-button-box-shadow, none);- color: var(--floating-button-color, var(--t-font-color-secondary));- cursor: pointer;- display: flex;- flex-direction: row;- font-family: var(--t-font-family);- font-weight: var(--t-font-weight-regular);- gap: var(--t-spacing-1);- padding: 0 var(--t-spacing-2);- text-decoration: none;- transition: background 0.1s ease;- white-space: nowrap;-- &:hover {- background: var(- --floating-button-hover-bg,- var(--t-background-transparent-lighter)- );- }-- &:active {- background: var(- --floating-button-active-bg,- var(--t-background-transparent-medium)- );- }-- &:focus {- outline: none;- }-- @include focus-ring;-- &[data-disabled] {- cursor: not-allowed;- }-}--.small {- height: 24px;-}--.medium {- height: 32px;-}--// position only reshapes the radius; standalone keeps the .button default.-.button[data-position='left'] {- --floating-button-radius: var(--t-border-radius-md) 0px 0px- var(--t-border-radius-md);-}--.button[data-position='middle'] {- --floating-button-radius: 0px;-}--.button[data-position='right'] {- --floating-button-radius: 0px var(--t-border-radius-md)- var(--t-border-radius-md) 0px;-}--.button[data-apply-blur] {- --floating-button-backdrop-filter: blur(20px);-}--// box-shadow matrix from the legacy nested ternary: shadow, focus, and-// shadow+focus — the combined rule comes last so it wins the cascade.-.button[data-apply-shadow] {- --floating-button-box-shadow:- 0px 2px 4px 0px var(--t-background-transparent-light),- 0px 0px 4px 0px var(--t-background-transparent-medium);-}--// focus is gated by !disabled in the component, like the legacy call-site.-.button[data-focus] {- --floating-button-border: 1px solid var(--t-color-blue);- --floating-button-box-shadow: 0 0 0 3px var(--t-color-blue3);- --floating-button-color: var(--t-color-blue);-}--.button[data-apply-shadow][data-focus] {- --floating-button-box-shadow:- 0px 2px 4px 0px var(--t-background-transparent-light),- 0px 0px 4px 0px var(--t-background-transparent-medium),- 0 0 0 3px var(--t-color-blue3);-}--// disabled comes last: it beats focus in the legacy color ternary.-.button[data-disabled] {- --floating-button-color: var(--t-font-color-extra-light);- --floating-button-hover-bg: transparent;- --floating-button-active-bg: transparent;-}diff --git a/packages/twenty-ui/src/primitives/input/FloatingButton/FloatingButton.module.scss.d.ts b/packages/twenty-ui/src/primitives/input/FloatingButton/FloatingButton.module.scss.d.tsdeleted file mode 100644index de85059fc80..00000000000--- a/packages/twenty-ui/src/primitives/input/FloatingButton/FloatingButton.module.scss.d.ts+++ /dev/null@@ -1,6 +0,0 @@-declare const classNames: {- readonly button: 'button';- readonly small: 'small';- readonly medium: 'medium';-};-export default classNames;diff --git a/packages/twenty-ui/src/primitives/input/FloatingButton/FloatingButton.tsx b/packages/twenty-ui/src/primitives/input/FloatingButton/FloatingButton.tsxdeleted file mode 100644index e3fe82c9f1d..00000000000--- a/packages/twenty-ui/src/primitives/input/FloatingButton/FloatingButton.tsx+++ /dev/null@@ -1,63 +0,0 @@-import { clsx } from 'clsx';-import { Link } from 'react-router-dom';--import { type IconComponent } from '@ui/icon';-import { useTheme } from '@ui/theme-constants';--import styles from './FloatingButton.module.scss';--export type FloatingButtonSize = 'small' | 'medium';-export type FloatingButtonPosition = 'standalone' | 'left' | 'middle' | 'right';--export type FloatingButtonProps = {- className?: string;- Icon?: IconComponent;- title?: string;- ariaLabel?: string;- size?: FloatingButtonSize;- position?: FloatingButtonPosition;- applyShadow?: boolean;- applyBlur?: boolean;- disabled?: boolean;- focus?: boolean;- to?: string;-};--export const FloatingButton = ({- className,- Icon,- title,- ariaLabel,- size = 'small',- position = 'standalone',- applyBlur = true,- applyShadow = true,- disabled = false,- focus = false,- to,-}: FloatingButtonProps) => {- const theme = useTheme();-- // Replaces the legacy Linaria `as` polymorphism: react-router Link when a- // `to` is provided, a native button otherwise. Typed as any to forward all- // props untyped, exactly like the legacy `as` prop did.- // eslint-disable-next-line @typescript-eslint/no-explicit-any- const ButtonComponent: any = to ? Link : 'button';-- return (- <ButtonComponent- disabled={disabled}- aria-label={ariaLabel}- className={clsx(styles.button, styles[size], className)}- data-position={position}- data-apply-blur={applyBlur || undefined}- data-apply-shadow={applyShadow || undefined}- data-disabled={disabled || undefined}- data-focus={(focus && !disabled) || undefined}- to={to}- >- {Icon && <Icon size={theme.icon.size.sm} aria-hidden />}- {title}- </ButtonComponent>- );-};diff --git a/packages/twenty-ui/src/primitives/input/FloatingButton/__stories__/FloatingButton.stories.tsx b/packages/twenty-ui/src/primitives/input/FloatingButton/__stories__/FloatingButton.stories.tsxdeleted file mode 100644index bd6d8048366..00000000000--- a/packages/twenty-ui/src/primitives/input/FloatingButton/__stories__/FloatingButton.stories.tsx+++ /dev/null@@ -1,89 +0,0 @@-import { type Meta, type StoryObj } from '@storybook/react-vite';-import { IconSearch } from '@ui/icon';-import {- A11Y_DEFER_COLOR_CONTRAST,- CatalogDecorator,- type CatalogStory,- ComponentDecorator,-} from '@ui/testing';-import {- FloatingButton,- type FloatingButtonSize,-} from '@ui/primitives/input/FloatingButton/FloatingButton';--const meta: Meta<typeof FloatingButton> = {- title: 'UI/Input/Button/FloatingButton',- component: FloatingButton,-};--export default meta;-type Story = StoryObj<typeof FloatingButton>;--export const Default: Story = {- args: {- title: 'Filter',- size: 'small',- disabled: false,- focus: false,- applyBlur: true,- applyShadow: true,- position: 'standalone',- Icon: IconSearch,- },- argTypes: {- Icon: { control: false },- },- decorators: [ComponentDecorator],-};--export const Catalog: CatalogStory<Story, typeof FloatingButton> = {- args: { title: 'Filter', Icon: IconSearch },- argTypes: {- size: { control: false },- disabled: { control: false },- position: { control: false },- focus: { control: false },- },- parameters: {- a11y: A11Y_DEFER_COLOR_CONTRAST,- pseudo: { hover: ['.hover'], active: ['.pressed'] },- catalog: {- dimensions: [- {- name: 'sizes',- values: ['small', 'medium'] satisfies FloatingButtonSize[],- props: (size: FloatingButtonSize) => ({ size }),- },- {- name: 'states',- values: [- 'default',- 'hover',- 'pressed',- 'disabled',- 'focus',- 'disabled+focus',- ],- props: (state: string) => {- switch (state) {- case 'default':- return {};- case 'hover':- case 'pressed':- return { className: state };- case 'focus':- return { focus: true };- case 'disabled':- return { disabled: true };- case 'disabled+focus':- return { disabled: true, focus: true };- default:- return {};- }- },- },- ],- },- },- decorators: [CatalogDecorator],-};diff --git a/packages/twenty-ui/src/primitives/input/FloatingButtonGroup/FloatingButtonGroup.module.scss b/packages/twenty-ui/src/primitives/input/FloatingButtonGroup/FloatingButtonGroup.module.scssdeleted file mode 100644index b39194ee883..00000000000--- a/packages/twenty-ui/src/primitives/input/FloatingButtonGroup/FloatingButtonGroup.module.scss+++ /dev/null@@ -1,8 +0,0 @@-.container {- backdrop-filter: blur(20px);- border-radius: var(--t-border-radius-md);- box-shadow:- 0px 2px 4px 0px var(--t-background-transparent-light),- 0px 0px 4px 0px var(--t-background-transparent-medium);- display: inline-flex;-}diff --git a/packages/twenty-ui/src/primitives/input/FloatingButtonGroup/FloatingButtonGroup.module.scss.d.ts b/packages/twenty-ui/src/primitives/input/FloatingButtonGroup/FloatingButtonGroup.module.scss.d.tsdeleted file mode 100644index 8df71b4dead..00000000000--- a/packages/twenty-ui/src/primitives/input/FloatingButtonGroup/FloatingButtonGroup.module.scss.d.ts+++ /dev/null@@ -1,4 +0,0 @@-declare const classNames: {- readonly container: 'container';-};-export default classNames;diff --git a/packages/twenty-ui/src/primitives/input/FloatingButtonGroup/FloatingButtonGroup.tsx b/packages/twenty-ui/src/primitives/input/FloatingButtonGroup/FloatingButtonGroup.tsxdeleted file mode 100644index 3a8616954d1..00000000000--- a/packages/twenty-ui/src/primitives/input/FloatingButtonGroup/FloatingButtonGroup.tsx+++ /dev/null@@ -1,51 +0,0 @@-import { clsx } from 'clsx';-import React from 'react';-import { isDefined } from '@ui/utilities/utils/isDefined';--import {- type FloatingButtonPosition,- type FloatingButtonProps,-} from '@ui/primitives/input/FloatingButton/FloatingButton';--import styles from './FloatingButtonGroup.module.scss';--export type FloatingButtonGroupProps = Pick<FloatingButtonProps, 'size'> & {- children: React.ReactElement[];- className?: string;-};--export const FloatingButtonGroup = ({- children,- size,- className,-}: FloatingButtonGroupProps) => {- return (- <div className={clsx(styles.container, className)}>- {React.Children.map(children, (child, index) => {- let position: FloatingButtonPosition;-- if (index === 0) {- position = 'left';- } else if (index === children.length - 1) {- position = 'right';- } else {- position = 'middle';- }-- // eslint-disable-next-line @typescript-eslint/no-explicit-any- const additionalProps: any = {- position,- size,- applyShadow: false,- applyBlur: false,- };-- if (isDefined(size)) {- additionalProps.size = size;- }-- return React.cloneElement(child, additionalProps);- })}- </div>- );-};diff --git a/packages/twenty-ui/src/primitives/input/FloatingButtonGroup/__stories__/FloatingButtonGroup.stories.tsx b/packages/twenty-ui/src/primitives/input/FloatingButtonGroup/__stories__/FloatingButtonGroup.stories.tsxdeleted file mode 100644index 808a333b7d6..00000000000--- a/packages/twenty-ui/src/primitives/input/FloatingButtonGroup/__stories__/FloatingButtonGroup.stories.tsx+++ /dev/null@@ -1,72 +0,0 @@-import { type Meta, type StoryObj } from '@storybook/react-vite';-import { IconCheckbox, IconNotes, IconTimelineEvent } from '@ui/icon';-import {- A11Y_DEFER_COLOR_CONTRAST,- CatalogDecorator,- type CatalogStory,- ComponentDecorator,-} from '@ui/testing';-import {- FloatingButton,- type FloatingButtonSize,-} from '@ui/primitives/input/FloatingButton/FloatingButton';-import { FloatingButtonGroup } from '@ui/primitives/input/FloatingButtonGroup/FloatingButtonGroup';--const meta: Meta<typeof FloatingButtonGroup> = {- title: 'UI/Input/Button/FloatingButtonGroup',- component: FloatingButtonGroup,-};--export default meta;-type Story = StoryObj<typeof FloatingButtonGroup>;--export const Default: Story = {- args: {- size: 'small',- children: [- <FloatingButton key="notes" Icon={IconNotes} ariaLabel="Notes" />,- <FloatingButton key="checkbox" Icon={IconCheckbox} ariaLabel="Tasks" />,- <FloatingButton- key="timeline"- Icon={IconTimelineEvent}- ariaLabel="Timeline"- />,- ],- },- argTypes: {- children: { control: false },- },- decorators: [ComponentDecorator],-};--export const Catalog: CatalogStory<Story, typeof FloatingButtonGroup> = {- args: {- children: [- <FloatingButton key="notes" Icon={IconNotes} ariaLabel="Notes" />,- <FloatingButton key="checkbox" Icon={IconCheckbox} ariaLabel="Tasks" />,- <FloatingButton- key="timeline"- Icon={IconTimelineEvent}- ariaLabel="Timeline"- />,- ],- },- argTypes: {- size: { control: false },- children: { control: false },- },- parameters: {- a11y: A11Y_DEFER_COLOR_CONTRAST,- pseudo: { hover: ['.hover'], active: ['.pressed'], focus: ['.focus'] },- catalog: {- dimensions: [- {- name: 'sizes',- values: ['small', 'medium'] satisfies FloatingButtonSize[],- props: (size: FloatingButtonSize) => ({ size }),- },- ],- },- },- decorators: [CatalogDecorator],-};diff --git a/packages/twenty-ui/src/primitives/input/index.ts b/packages/twenty-ui/src/primitives/input/index.tsindex 9d21c6eff3e..1f732215cfb 100644--- a/packages/twenty-ui/src/primitives/input/index.ts+++ b/packages/twenty-ui/src/primitives/input/index.ts@@ -22,7 +22,6 @@ export type { CheckboxProps } from './Checkbox/types/CheckboxProps';export type { CheckboxShape } from './Checkbox/types/CheckboxShape';export type { CheckboxSize } from './Checkbox/types/CheckboxSize';export type { CheckboxVariant } from './Checkbox/types/CheckboxVariant';-export { ColorPickerButton } from './ColorPickerButton/ColorPickerButton';export type {ColorSchemeSegmentProps,ColorSchemeCardProps,@@ -31,14 +30,6 @@ export { ColorSchemeCard } from './ColorSchemeCard/ColorSchemeCard';export type { ColorSchemePickerProps } from './ColorSchemePicker/ColorSchemePicker';export { ColorSchemePicker } from './ColorSchemePicker/ColorSchemePicker';export { Field } from './Field/Field';-export type {- FloatingButtonSize,- FloatingButtonPosition,- FloatingButtonProps,-} from './FloatingButton/FloatingButton';-export { FloatingButton } from './FloatingButton/FloatingButton';-export type { FloatingButtonGroupProps } from './FloatingButtonGroup/FloatingButtonGroup';-export { FloatingButtonGroup } from './FloatingButtonGroup/FloatingButtonGroup';export { IconListViewGrip } from './IconListViewGrip/IconListViewGrip';export { Input } from './Input/Input';export type { InputProps } from './Input/types/InputProps';