The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Migrate twenty-ui Checkbox to the shared form-control API (#25712)
Raphaël Bosibbd9b444df3c
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 c0927731c24..4f906ece204 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@@ -77,7 +77,13 @@ const INPUT_ENTRIES: GalleryEntry[] = [},{name: 'Checkbox',- node: <Checkbox checked={false} onChange={() => {}} />,+ node: (+ <Checkbox+ aria-label="Checkbox"+ checked={false}+ onCheckedChange={() => {}}+ />+ ),},{name: 'CoreEditorHeader',diff --git a/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx b/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsxindex 05e5d11e34f..74da123d32d 100644--- a/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx+++ b/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx@@ -19,7 +19,7 @@ import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFiimport { useContext } from 'react';import { IconCalendar } from 'twenty-ui/icon';import { OverflowingTextWithTooltip } from 'twenty-ui/surfaces';-import { Checkbox, CheckboxShape } from 'twenty-ui/input';+import { Checkbox } from 'twenty-ui/input';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { useCompleteTask } from '@/activities/tasks/hooks/useCompleteTask';@@ -125,7 +125,7 @@ export const TaskRow = ({ task }: { task: Task }) => {><Checkboxchecked={task.status === 'DONE'}- shape={CheckboxShape.Rounded}+ shape={'round'}onCheckedChange={completeTask}/></StyledCheckboxContainer>diff --git a/packages/twenty-front/src/modules/ai/components/SettingsAgentModelCapabilities.tsx b/packages/twenty-front/src/modules/ai/components/SettingsAgentModelCapabilities.tsxindex 996fc6211c9..17369d59315 100644--- a/packages/twenty-front/src/modules/ai/components/SettingsAgentModelCapabilities.tsx+++ b/packages/twenty-front/src/modules/ai/components/SettingsAgentModelCapabilities.tsx@@ -132,12 +132,13 @@ export const SettingsAgentModelCapabilities = ({<span>{capability.label}</span></StyledCheckboxLabel><Checkbox+ aria-label={capability.label}checked={capability.enabled}- onChange={(event) => {- event.stopPropagation();- handleCapabilityToggle(capability.key, event.target.checked);+ onCheckedChange={(isChecked) => {+ handleCapabilityToggle(capability.key, isChecked);}}disabled={disabled}+ onClick={(event) => event.stopPropagation()}/></StyledCheckboxContainer>))}diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsxindex 26f7eccaff5..d0f3e181e18 100644--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsx+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsx@@ -23,7 +23,7 @@ import { themeCssVariables } from 'twenty-ui/theme-constants';import { isDefined } from 'twenty-shared/utils';import { ChipVariant } from 'twenty-ui/data-display';import { IconEye, IconEyeOff } from 'twenty-ui/icon';-import { Checkbox, CheckboxVariant, LightIconButton } from 'twenty-ui/input';+import { Checkbox, LightIconButton } from 'twenty-ui/input';import { useIsMobile, useIsTouchDevice } from 'twenty-ui/utilities';const StyledCompactIconContainer = styled.div`@@ -120,11 +120,11 @@ export const RecordBoardCardHeader = () => {<Checkboxhoverablechecked={isRecordBoardCardSelected}- onChange={(value) => {- setIsRecordBoardCardSelected(value.target.checked);+ onCheckedChange={(isChecked) => {+ setIsRecordBoardCardSelected(isChecked);checkIfLastUnselectAndCloseDropdown();}}- variant={CheckboxVariant.Secondary}+ variant={'outline'}/></StopPropagationContainer></StyledCheckboxContainer>diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardHeader.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardHeader.tsxindex 752bd2e22cb..a8788e46adc 100644--- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardHeader.tsx+++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardHeader.tsx@@ -12,7 +12,7 @@ import { styled } from '@linaria/react';import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';import { isDefined } from 'twenty-shared/utils';import { ChipVariant } from 'twenty-ui/data-display';-import { Checkbox, CheckboxVariant } from 'twenty-ui/input';+import { Checkbox } from 'twenty-ui/input';import { isRecordCalendarCardSelectedComponentFamilyState } from '@/object-record/record-calendar/record-calendar-card/states/isRecordCalendarCardSelectedComponentFamilyState';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -96,10 +96,10 @@ export const RecordCalendarCardHeader = ({<Checkboxhoverablechecked={isRecordCalendarCardSelected}- onChange={(value) => {- setIsRecordCalendarCardSelected(value.target.checked);+ onCheckedChange={(isChecked) => {+ setIsRecordCalendarCardSelected(isChecked);}}- variant={CheckboxVariant.Secondary}+ variant={'outline'}/></StopPropagationContainer></StyledCheckboxContainer>diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderCheckboxColumn.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderCheckboxColumn.tsxindex 7444d0d768a..4237dfc99a8 100644--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderCheckboxColumn.tsx+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderCheckboxColumn.tsx@@ -87,7 +87,7 @@ export const RecordTableHeaderCheckboxColumn = () => {<Checkboxhoverablechecked={checked}- onChange={onChange}+ onCheckedChange={() => onChange()}indeterminate={indeterminate}disabled={recordTableIsEmpty}aria-label={t`Select all rows`}diff --git a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsxindex ff144dd1dba..8bc2ca6f6f1 100644--- a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx+++ b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx@@ -17,7 +17,7 @@ import { useLingui } from '@lingui/react/macro';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useMemo, useState } from 'react';import { Label } from 'twenty-ui/typography';-import { Checkbox, CheckboxSize } from 'twenty-ui/input';+import { Checkbox } from 'twenty-ui/input';import { Section } from 'twenty-ui/layout';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -158,8 +158,8 @@ export const SettingsAccountsMessageFoldersCard = () => {><Checkboxchecked={allSynced}- onChange={handleToggleAllFolders}- size={CheckboxSize.Small}+ onCheckedChange={() => handleToggleAllFolders()}+ size={'sm'}/></TableCell></StyledSectionHeader>diff --git a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersTreeItem.tsx b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersTreeItem.tsxindex 8baa91c6a59..438ac094292 100644--- a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersTreeItem.tsx+++ b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersTreeItem.tsx@@ -11,7 +11,7 @@ import { useState } from 'react';import { MessageFolderPendingSyncAction } from 'twenty-shared/types';import { Status } from 'twenty-ui/data-display';import { IconChevronDown, IconChevronUp } from 'twenty-ui/icon';-import { Checkbox, CheckboxSize } from 'twenty-ui/input';+import { Checkbox } from 'twenty-ui/input';import { themeCssVariables } from 'twenty-ui/theme-constants';type SettingsMessageFoldersTreeItemProps = {@@ -207,8 +207,8 @@ export const SettingsMessageFoldersTreeItem = ({<Checkboxchecked={folder.isSynced}indeterminate={isIndeterminate}- onChange={() => onToggleFolder(folder)}- size={CheckboxSize.Small}+ onCheckedChange={() => onToggleFolder(folder)}+ size={'sm'}/></StyledCheckboxWrapper></StyledRightSection>diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminQueueJobsTable.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminQueueJobsTable.tsxindex e1ff9fa8b3f..3caad321733 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminQueueJobsTable.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminQueueJobsTable.tsx@@ -276,7 +276,7 @@ export const SettingsAdminQueueJobsTable = ({<Checkboxchecked={allJobsSelected}indeterminate={someJobsSelected}- onChange={handleToggleAll}+ onCheckedChange={() => handleToggleAll()}/>)}</TableHeader>diff --git a/packages/twenty-front/src/modules/settings/ai/components/SettingsAiModelsTable.tsx b/packages/twenty-front/src/modules/settings/ai/components/SettingsAiModelsTable.tsxindex 5095771fa4e..1ae7057c213 100644--- a/packages/twenty-front/src/modules/settings/ai/components/SettingsAiModelsTable.tsx+++ b/packages/twenty-front/src/modules/settings/ai/components/SettingsAiModelsTable.tsx@@ -114,7 +114,7 @@ export const SettingsAiModelsTable = <TModel extends AiModelSummary>({<Checkboxchecked={allChecked}indeterminate={!allChecked && !noneChecked}- onChange={() => onToggleAll(!allChecked)}+ onCheckedChange={() => onToggleAll(!allChecked)}/>)}</TableHeader>@@ -187,7 +187,7 @@ export const SettingsAiModelsTable = <TModel extends AiModelSummary>({<Checkboxchecked={checked}disabled={disabled}- onChange={() => onToggle(model.modelId, checked)}+ onCheckedChange={() => onToggle(model.modelId, checked)}/></TableCell>{hasRemove && (diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/OverridableCheckbox.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/OverridableCheckbox.tsxindex 46dcd3cbb78..242567171e3 100644--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/OverridableCheckbox.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/OverridableCheckbox.tsx@@ -99,7 +99,7 @@ export const OverridableCheckbox = ({<Checkboxchecked={checked}disabled={disabled}- onChange={onChange}+ onCheckedChange={() => onChange()}/></AnimatedRotate></StyledOverridableCheckboxContainerItem>diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableHeader.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableHeader.tsxindex 1e871f2809f..182135c4dcc 100644--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableHeader.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableHeader.tsx@@ -49,7 +49,7 @@ export const SettingsRolePermissionsObjectsTableHeader = ({indeterminate={somePermissionsEnabled && !allPermissionsEnabled}disabled={!isEditable}aria-label={t`Toggle all object permissions`}- onChange={() => {+ onCheckedChange={() => {const newValue = !allPermissionsEnabled;setSettingsDraftRole({diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableRow.tsxindex 15685e9f96e..8221a28fc89 100644--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableRow.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableRow.tsx@@ -5,7 +5,7 @@ import { TableCell } from '@/ui/layout/table/components/TableCell';import { TableRow } from '@/ui/layout/table/components/TableRow';import { styled } from '@linaria/react';import { plural } from '@lingui/core/macro';-import { Checkbox, CheckboxAccent } from 'twenty-ui/input';+import { Checkbox } from 'twenty-ui/input';import { themeCssVariables } from 'twenty-ui/theme-constants';const StyledPermissionContent = styled.div`@@ -89,9 +89,9 @@ export const SettingsRolePermissionsObjectsTableRow = ({><Checkboxchecked={permission.value ?? false}- onChange={() => permission.setValue(!permission.value)}+ onCheckedChange={() => permission.setValue(!permission.value)}disabled={isDisabled}- accent={isRevoked ? CheckboxAccent.Orange : CheckboxAccent.Blue}+ color={isRevoked ? 'warning' : 'accent'}/></TableCell></TableRow>diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableHeader.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableHeader.tsxindex b249618f37d..de90a79d833 100644--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableHeader.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableHeader.tsx@@ -59,7 +59,7 @@ export const SettingsRolePermissionsSettingsTableHeader = ({}disabled={!isEditable}aria-label={t`Toggle all settings permissions`}- onChange={() => {+ onCheckedChange={() => {const newValue = !allSettingsPermissionsEnabled;setSettingsDraftRole({diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow.tsxindex 5228a82b2a3..874494e09d6 100644--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow.tsx@@ -121,7 +121,7 @@ export const SettingsRolePermissionsSettingsTableRow = ({<Checkboxchecked={isChecked}disabled={isDisabled}- onChange={(event) => handleChange(event.target.checked)}+ onCheckedChange={(isChecked) => handleChange(isChecked)}/></TableCell></TableRow>diff --git a/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleApplicability.tsx b/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleApplicability.tsxindex 092c1eb3efd..334ad621bd6 100644--- a/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleApplicability.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleApplicability.tsx@@ -89,12 +89,13 @@ export const SettingsRoleApplicability = ({<span>{option.label}</span></StyledCheckboxLabel><Checkbox+ aria-label={option.label}checked={values[option.key]}- onChange={(event) => {- event.stopPropagation();- onApplicabilityChange(option.key, event.target.checked);+ onCheckedChange={(isChecked) => {+ onApplicabilityChange(option.key, isChecked);}}disabled={!isEditable}+ onClick={(event) => event.stopPropagation()}/></StyledCheckboxContainer>))}diff --git a/packages/twenty-front/src/modules/settings/roles/role-settings/components/__stories__/SettingsRoleApplicability.stories.tsx b/packages/twenty-front/src/modules/settings/roles/role-settings/components/__stories__/SettingsRoleApplicability.stories.tsxnew file mode 100644index 00000000000..b581db2ae30--- /dev/null+++ b/packages/twenty-front/src/modules/settings/roles/role-settings/components/__stories__/SettingsRoleApplicability.stories.tsx@@ -0,0 +1,62 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { expect, fn, userEvent, within } from 'storybook/test';+import { ComponentDecorator } from 'twenty-ui/testing';++import { SettingsRoleApplicability } from '@/settings/roles/role-settings/components/SettingsRoleApplicability';++const meta: Meta<typeof SettingsRoleApplicability> = {+ title: 'Modules/Settings/Roles/SettingsRoleApplicability',+ component: SettingsRoleApplicability,+ args: {+ values: {+ canBeAssignedToUsers: false,+ canBeAssignedToAgents: false,+ canBeAssignedToApiKeys: false,+ },+ isEditable: true,+ onApplicabilityChange: fn(),+ },+ decorators: [ComponentDecorator],+};++export default meta;+type Story = StoryObj<typeof SettingsRoleApplicability>;++export const Selection: Story = {+ play: async ({ canvasElement, args }) => {+ const canvas = within(canvasElement);+ const checkbox = canvas.getByRole('checkbox', {+ name: 'Assignable to Agents',+ });+ await userEvent.click(checkbox);+ await expect(args.onApplicabilityChange).toHaveBeenCalledTimes(1);+ await expect(args.onApplicabilityChange).toHaveBeenLastCalledWith(+ 'canBeAssignedToAgents',+ true,+ );+ await userEvent.keyboard('[Space]');+ await expect(args.onApplicabilityChange).toHaveBeenCalledTimes(2);+ await expect(args.onApplicabilityChange).toHaveBeenLastCalledWith(+ 'canBeAssignedToAgents',+ true,+ );+ await userEvent.click(canvas.getByText('Assignable to Agents'));+ await expect(args.onApplicabilityChange).toHaveBeenCalledTimes(3);+ await expect(args.onApplicabilityChange).toHaveBeenLastCalledWith(+ 'canBeAssignedToAgents',+ true,+ );+ },+};++export const Disabled: Story = {+ args: { isEditable: false },+ play: async ({ canvasElement, args }) => {+ const canvas = within(canvasElement);+ await userEvent.click(+ canvas.getByRole('checkbox', { name: 'Assignable to Agents' }),+ );+ await userEvent.click(canvas.getByText('Assignable to Agents'));+ await expect(args.onApplicabilityChange).not.toHaveBeenCalled();+ },+};diff --git a/packages/twenty-front/src/modules/settings/unsubscribers/components/SettingsUnsubscribePreview.tsx b/packages/twenty-front/src/modules/settings/unsubscribers/components/SettingsUnsubscribePreview.tsxindex cb4db518b3b..ace720ff178 100644--- a/packages/twenty-front/src/modules/settings/unsubscribers/components/SettingsUnsubscribePreview.tsx+++ b/packages/twenty-front/src/modules/settings/unsubscribers/components/SettingsUnsubscribePreview.tsx@@ -92,7 +92,7 @@ export const SettingsUnsubscribePreview = () => {<StyledTopicRow key={topic.id}><Checkboxchecked- onChange={() => {}}+ onCheckedChange={() => {}}aria-label={topic.name ?? t`Untitled topic`}/>{topic.name ?? t`Untitled topic`}diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/components/columns.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/components/columns.tsxindex 8123d23ba5a..dd0f693a646 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/components/columns.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/components/columns.tsx@@ -13,7 +13,7 @@ import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import camelCase from 'lodash.camelcase';import { isDefined } from 'twenty-shared/utils';import { AppTooltip, TooltipDelay } from 'twenty-ui/surfaces';-import { Checkbox, CheckboxVariant, Switch } from 'twenty-ui/input';+import { Checkbox, Switch } from 'twenty-ui/input';import { type ImportedStructuredRowMetadata } from '@/spreadsheet-import/steps/components/ValidationStep/types';const StyledHeaderContainer = styled.div`@@ -99,12 +99,14 @@ export const generateColumns = (<Checkboxaria-label={t`Select`}checked={isRowSelected}- variant={CheckboxVariant.Tertiary}- onChange={(event) => {+ variant={'soft'}+ onCheckedChange={(isChecked, eventDetails) => {onRowSelectionChange({row: props.row,- checked: event.target.checked,- isShiftClick: (event.nativeEvent as MouseEvent).shiftKey,+ checked: isChecked,+ isShiftClick:+ 'shiftKey' in eventDetails.event &&+ eventDetails.event.shiftKey === true,});}}/>diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiModel.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiModel.tsxindex 4b40a5f6d32..8e5c4624181 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiModel.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiModel.tsx@@ -573,10 +573,10 @@ export const SettingsAdminNewAiModel = () => {}}><Checkbox+ aria-label={option.label}checked={isChecked}- onChange={(event) => {- event.stopPropagation();- const updated = event.target.checked+ onCheckedChange={(isChecked) => {+ const updated = isChecked? [...value, option.value]: value.filter((modality) => modality !== option.value,@@ -584,6 +584,7 @@ export const SettingsAdminNewAiModel = () => {onChange(updated);}}+ onClick={(event) => event.stopPropagation()}/><span>{option.label}</span></StyledCheckboxRow>diff --git a/packages/twenty-ui/src/input/Checkbox/Checkbox.module.scss b/packages/twenty-ui/src/input/Checkbox/Checkbox.module.scssindex 0ed80b91881..c47fd2eebcb 100644--- a/packages/twenty-ui/src/input/Checkbox/Checkbox.module.scss+++ b/packages/twenty-ui/src/input/Checkbox/Checkbox.module.scss@@ -1,90 +1,101 @@.root {- --checkbox-box-size: 12px;- --checkbox-icon-size: 14px;- --checkbox-border-width: 1px;- --checkbox-bg: transparent;- --checkbox-border-color: var(--t-border-color-secondary-inverted);- --checkbox-box-radius: var(--t-border-radius-sm-round);+ @include focus-ring;++ --tw-checkbox-box-size: 12px;+ --tw-checkbox-icon-size: 14px;+ --tw-checkbox-border-width: 1px;+ --tw-checkbox-bg: transparent;+ --tw-checkbox-border-color: var(--t-border-color-secondary-inverted);+ --tw-checkbox-box-radius: var(--t-border-radius-sm-round);align-items: center;border-radius: var(--t-border-radius-md-round);corner-shape: round;cursor: pointer;- display: flex;+ display: inline-flex;+ flex-shrink: 0;padding: 0;position: relative;}-.primary {- --checkbox-border-color: var(--t-border-color-inverted);+.solid {+ --tw-checkbox-border-color: var(--t-border-color-inverted);}-.secondary {- --checkbox-border-color: var(--t-border-color-secondary-inverted);+.outline {+ --tw-checkbox-border-color: var(--t-border-color-secondary-inverted);}-.tertiary {- --checkbox-border-color: var(--t-border-color-medium);- --checkbox-border-width: 1.43px;+.soft {+ --tw-checkbox-border-color: var(--t-border-color-medium);+ --tw-checkbox-border-width: 1.43px;}-.small {- --checkbox-box-size: 12px;- --checkbox-icon-size: 14px;+.sm {+ --tw-checkbox-box-size: 12px;+ --tw-checkbox-icon-size: 14px;}-.large {- --checkbox-box-size: 18px;- --checkbox-icon-size: 20px;- --checkbox-border-width: 1.43px;+.md {+ --tw-checkbox-box-size: 18px;+ --tw-checkbox-icon-size: 20px;+ --tw-checkbox-border-width: 1.43px;}-.squared {- --checkbox-box-radius: var(--t-border-radius-sm-round);+.square {+ --tw-checkbox-box-radius: var(--t-border-radius-sm-round);border-radius: var(--t-border-radius-md-round);}-.rounded {- --checkbox-box-radius: var(--t-border-radius-rounded);+.round {+ --tw-checkbox-box-radius: var(--t-border-radius-rounded);border-radius: var(--t-border-radius-rounded);corner-shape: round;}-.blue {- --checkbox-accent: var(--t-color-blue);- --checkbox-accent-disabled: var(--t-color-blue7);- --checkbox-accent-hover: var(--t-background-transparent-blue);+.accent {+ --tw-checkbox-accent: var(--t-color-blue);+ --tw-checkbox-accent-disabled: var(--t-color-blue7);+ --tw-checkbox-accent-hover: var(--t-background-transparent-blue);+}++.success {+ --tw-checkbox-accent: var(--t-color-green);+ --tw-checkbox-accent-disabled: var(--t-color-green7);+ --tw-checkbox-accent-hover: var(--t-background-transparent-green);}-.orange {- --checkbox-accent: var(--t-color-orange);- --checkbox-accent-disabled: var(--t-color-orange7);- --checkbox-accent-hover: var(--t-background-transparent-orange);+.warning {+ --tw-checkbox-accent: var(--t-color-orange);+ --tw-checkbox-accent-disabled: var(--t-color-orange7);+ --tw-checkbox-accent-hover: var(--t-background-transparent-orange);}.hoverable {padding: 5px;}-.hoverable.large {+.hoverable.md {padding: 6px;}-.hoverable:hover {- background-color: var(--t-background-transparent-light);-}+@include hover-capable {+ .hoverable:hover {+ background-color: var(--t-background-transparent-light);+ }-.hoverable[data-checked]:hover,-.hoverable[data-indeterminate]:hover {- background-color: var(--checkbox-accent-hover);+ .hoverable[data-checked]:hover,+ .hoverable[data-indeterminate]:hover {+ background-color: var(--tw-checkbox-accent-hover);+ }}// Disabled border falls back to the strong border color unless checked (see below)..root[data-disabled] {- --checkbox-border-color: var(--t-border-color-strong);+ --tw-checkbox-border-color: var(--t-border-color-strong);cursor: not-allowed;}@@ -92,14 +103,14 @@// Checked/indeterminate accent wins over the variant and disabled border colors..root[data-checked],.root[data-indeterminate] {- --checkbox-bg: var(--checkbox-accent);- --checkbox-border-color: var(--checkbox-accent);+ --tw-checkbox-bg: var(--tw-checkbox-accent);+ --tw-checkbox-border-color: var(--tw-checkbox-accent);}.root[data-disabled][data-checked],.root[data-disabled][data-indeterminate] {- --checkbox-bg: var(--checkbox-accent-disabled);- --checkbox-border-color: var(--checkbox-accent-disabled);+ --tw-checkbox-bg: var(--tw-checkbox-accent-disabled);+ --tw-checkbox-border-color: var(--tw-checkbox-accent-disabled);}.hoverable[data-disabled]:hover {@@ -107,39 +118,44 @@}.box {- height: calc(var(--checkbox-box-size) + 2px);+ block-size: calc(var(--tw-checkbox-box-size) + 2px);padding: 0;position: relative;- width: calc(var(--checkbox-box-size) + 2px);+ inline-size: calc(var(--tw-checkbox-box-size) + 2px);}.box::before {- background: var(--checkbox-bg);- border-color: var(--checkbox-border-color);- border-radius: var(--checkbox-box-radius);+ background: var(--tw-checkbox-bg);+ border-color: var(--tw-checkbox-border-color);+ border-radius: var(--tw-checkbox-box-radius);corner-shape: round;border-style: solid;- border-width: var(--checkbox-border-width);+ border-width: var(--tw-checkbox-border-width);// The border sits outside the declared box size, so size against the content box.box-sizing: content-box;content: '';display: inline-block;- height: var(--checkbox-box-size);- width: var(--checkbox-box-size);+ block-size: var(--tw-checkbox-box-size);+ inline-size: var(--tw-checkbox-box-size);}.indicator {display: block;- height: var(--checkbox-icon-size);- left: 0;+ block-size: var(--tw-checkbox-icon-size);+ inset-inline-start: 0;position: absolute;- top: 0;- width: var(--checkbox-icon-size);+ inset-block-start: 0;+ inline-size: var(--tw-checkbox-icon-size);}.indicator svg {display: block;- height: 100%;+ block-size: 100%;stroke: var(--t-font-color-inverted);- width: 100%;+ inline-size: 100%;+}++.indicator[data-indeterminate] .check,+.indicator:not([data-indeterminate]) .minus {+ display: none;}diff --git a/packages/twenty-ui/src/input/Checkbox/Checkbox.module.scss.d.ts b/packages/twenty-ui/src/input/Checkbox/Checkbox.module.scss.d.tsindex 1cd971bc6b1..98c3a0cfa92 100644--- a/packages/twenty-ui/src/input/Checkbox/Checkbox.module.scss.d.ts+++ b/packages/twenty-ui/src/input/Checkbox/Checkbox.module.scss.d.ts@@ -1,16 +1,19 @@declare const classNames: {readonly root: 'root';- readonly primary: 'primary';- readonly secondary: 'secondary';- readonly tertiary: 'tertiary';- readonly small: 'small';- readonly large: 'large';- readonly squared: 'squared';- readonly rounded: 'rounded';- readonly blue: 'blue';- readonly orange: 'orange';+ readonly solid: 'solid';+ readonly outline: 'outline';+ readonly soft: 'soft';+ readonly sm: 'sm';+ readonly md: 'md';+ readonly square: 'square';+ readonly round: 'round';+ readonly accent: 'accent';+ readonly success: 'success';+ readonly warning: 'warning';readonly hoverable: 'hoverable';readonly box: 'box';readonly indicator: 'indicator';+ readonly check: 'check';+ readonly minus: 'minus';};export default classNames;diff --git a/packages/twenty-ui/src/input/Checkbox/Checkbox.tsx b/packages/twenty-ui/src/input/Checkbox/Checkbox.tsxindex aa87a00f8bf..c43b583223f 100644--- a/packages/twenty-ui/src/input/Checkbox/Checkbox.tsx+++ b/packages/twenty-ui/src/input/Checkbox/Checkbox.tsx@@ -1,100 +1,42 @@import { Checkbox as CheckboxPrimitive } from '@base-ui/react/checkbox';import { clsx } from 'clsx';-import { type ChangeEvent } from 'react';-import { IconCheck, IconMinus } from '@ui/icon/components/TablerIcons';+import { IconCheck, IconMinus } from '@ui/icon';+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';import styles from './Checkbox.module.scss';--export enum CheckboxVariant {- Primary = 'primary',- Secondary = 'secondary',- Tertiary = 'tertiary',-}--export enum CheckboxShape {- Squared = 'squared',- Rounded = 'rounded',-}--export enum CheckboxSize {- Large = 'large',- Small = 'small',-}--export enum CheckboxAccent {- Blue = 'blue',- Orange = 'orange',-}--type CheckboxProps = {- checked: boolean;- indeterminate?: boolean;- hoverable?: boolean;- onChange?: (event: ChangeEvent<HTMLInputElement>) => void;- onCheckedChange?: (value: boolean) => void;- variant?: CheckboxVariant;- size?: CheckboxSize;- shape?: CheckboxShape;- className?: string;- disabled?: boolean;- accent?: CheckboxAccent;- id?: string;- 'aria-label'?: string;- 'aria-labelledby'?: string;-};+import { type CheckboxProps } from './types/CheckboxProps';export const Checkbox = ({- checked,- onChange,- onCheckedChange,- indeterminate,- variant = CheckboxVariant.Primary,- size = CheckboxSize.Small,- shape = CheckboxShape.Squared,+ size = 'sm',+ variant = 'solid',+ shape = 'square',+ color = 'accent',hoverable = true,className,- disabled = false,- accent = CheckboxAccent.Blue,- id,- 'aria-label': ariaLabel,- 'aria-labelledby': ariaLabelledby,-}: CheckboxProps) => {- return (- <CheckboxPrimitive.Root- checked={checked}- indeterminate={indeterminate}- disabled={disabled}- id={id}- name="styled-checkbox"- aria-label={ariaLabel}- aria-labelledby={ariaLabelledby}- data-testid="input-checkbox"- onCheckedChange={(value, eventDetails) => {- onChange?.(- eventDetails.event as unknown as ChangeEvent<HTMLInputElement>,- );- onCheckedChange?.(value);- }}- className={clsx(+ children,+ ...props+}: CheckboxProps) => (+ <CheckboxPrimitive.Root+ {...props}+ className={mergeClassNames(+ clsx(styles.root,- styles[variant],styles[size],+ styles[variant],styles[shape],- styles[accent],+ styles[color],hoverable && styles.hoverable,- className,- )}- >- <span className={styles.box}>- <CheckboxPrimitive.Indicator className={styles.indicator}>- {indeterminate ? (- <IconMinus aria-hidden />- ) : (- <IconCheck aria-hidden />- )}- </CheckboxPrimitive.Indicator>- </span>- </CheckboxPrimitive.Root>- );-};+ ),+ className,+ )}+ >+ <span className={styles.box}>+ <CheckboxPrimitive.Indicator className={styles.indicator}>+ <IconCheck className={styles.check} aria-hidden />+ <IconMinus className={styles.minus} aria-hidden />+ </CheckboxPrimitive.Indicator>+ </span>+ {children}+ </CheckboxPrimitive.Root>+);diff --git a/packages/twenty-ui/src/input/Checkbox/__stories__/Checkbox.forms.stories.tsx b/packages/twenty-ui/src/input/Checkbox/__stories__/Checkbox.forms.stories.tsxnew file mode 100644index 00000000000..c9976da060f--- /dev/null+++ b/packages/twenty-ui/src/input/Checkbox/__stories__/Checkbox.forms.stories.tsx@@ -0,0 +1,209 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { useState } from 'react';+import { expect, fn, userEvent, within } from 'storybook/test';++import { Checkbox } from '@ui/input/Checkbox/Checkbox';+import { Field } from '@ui/input/Field/Field';+import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';++const meta: Meta<typeof Checkbox> = {+ title: 'UI/Input/Checkbox/Forms',+ component: Checkbox,+};++export default meta;+type Story = StoryObj<typeof Checkbox>;++export const WrappingLabel: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <label htmlFor="checkbox-terms">+ <Checkbox id="checkbox-terms" />+ Accept terms+ </label>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(canvas.getByText('Accept terms'));+ await expect(+ canvas.getByRole('checkbox', { name: 'Accept terms' }),+ ).toBeChecked();+ },+};++export const SiblingLabel: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <div>+ <Checkbox id="checkbox-notifications" nativeButton render={<button />} />+ <label htmlFor="checkbox-notifications">Receive notifications</label>+ </div>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(canvas.getByText('Receive notifications'));+ await expect(+ canvas.getByRole('checkbox', { name: 'Receive notifications' }),+ ).toBeChecked();+ },+};++export const FieldLabel: Story = {+ parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },+ decorators: [ComponentDecorator],+ render: () => (+ <Field.Root name="reminders">+ <Field.Label>+ <Checkbox />+ Send reminders+ </Field.Label>+ </Field.Root>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(canvas.getByText('Send reminders'));+ await expect(+ canvas.getByRole('checkbox', { name: 'Send reminders' }),+ ).toBeChecked();+ },+};++const FormExample = () => {+ const [checked, setChecked] = useState(false);+ const [submittedValue, setSubmittedValue] = useState('Not submitted');+ return (+ <form+ onReset={() => setChecked(false)}+ onSubmit={(event) => {+ event.preventDefault();+ setSubmittedValue(+ String(new FormData(event.currentTarget).get('terms')),+ );+ }}+ >+ <label htmlFor="checkbox-form-terms">+ <Checkbox+ id="checkbox-form-terms"+ checked={checked}+ onCheckedChange={setChecked}+ name="terms"+ value="accepted"+ required+ />+ Accept terms+ </label>+ <button type="submit">Submit</button>+ <button type="reset">Reset</button>+ <output aria-label="Submitted value">{submittedValue}</output>+ </form>+ );+};++export const FormSubmissionAndReset: Story = {+ decorators: [ComponentDecorator],+ render: () => <FormExample />,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const checkbox = canvas.getByRole('checkbox', { name: 'Accept terms' });+ await userEvent.click(canvas.getByRole('button', { name: 'Submit' }));+ await expect(canvas.getByRole('status')).toHaveTextContent('Not submitted');+ await userEvent.click(checkbox);+ await userEvent.click(canvas.getByRole('button', { name: 'Submit' }));+ await expect(canvas.getByRole('status')).toHaveTextContent('accepted');+ await userEvent.click(canvas.getByRole('button', { name: 'Reset' }));+ await expect(checkbox).not.toBeChecked();+ },+};++const UncheckedValueExample = () => {+ const [submittedValue, setSubmittedValue] = useState('Not submitted');+ return (+ <form+ id="checkbox-external-form"+ onSubmit={(event) => {+ event.preventDefault();+ const formData = new FormData(event.currentTarget);+ setSubmittedValue(+ `${formData.get('notifications')}/${formData.has('disabled')}/${formData.has('styled-checkbox')}`,+ );+ }}+ >+ <Checkbox+ name="notifications"+ value="yes"+ uncheckedValue="no"+ aria-label="Notifications"+ />+ <Checkbox name="disabled" disabled defaultChecked aria-label="Disabled" />+ <Checkbox defaultChecked aria-label="Unnamed" />+ <button type="submit">Submit</button>+ <output>{submittedValue}</output>+ </form>+ );+};++export const NativeFormValues: Story = {+ decorators: [ComponentDecorator],+ render: () => <UncheckedValueExample />,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(canvas.getByRole('button', { name: 'Submit' }));+ await expect(canvas.getByRole('status')).toHaveTextContent(+ 'no/false/false',+ );+ await userEvent.click(+ canvas.getByRole('checkbox', { name: 'Notifications' }),+ );+ await userEvent.click(canvas.getByRole('button', { name: 'Submit' }));+ await expect(canvas.getByRole('status')).toHaveTextContent(+ 'yes/false/false',+ );+ },+};++const ClickableRowExample = ({+ onCheckedChange,+}: {+ onCheckedChange: (checked: boolean) => void;+}) => {+ const [checked, setChecked] = useState(false);+ const select = (value: boolean) => {+ setChecked(value);+ onCheckedChange(value);+ };+ return (+ // oxlint-disable-next-line jsx-a11y/click-events-have-key-events+ <div+ onClick={() => select(!checked)}+ role="group"+ aria-label="Selection row"+ >+ <span>Row label</span>+ <Checkbox+ aria-label="Select row"+ checked={checked}+ onCheckedChange={select}+ onClick={(event) => event.stopPropagation()}+ />+ </div>+ );+};++export const ClickableRow: StoryObj<typeof ClickableRowExample> = {+ args: { onCheckedChange: fn() },+ decorators: [ComponentDecorator],+ render: (args) => <ClickableRowExample {...args} />,+ play: async ({ canvasElement, args }) => {+ const canvas = within(canvasElement);+ const checkbox = canvas.getByRole('checkbox', { name: 'Select row' });+ await userEvent.click(checkbox);+ await expect(checkbox).toBeChecked();+ await expect(args.onCheckedChange).toHaveBeenCalledTimes(1);+ await userEvent.keyboard('[Space]');+ await expect(checkbox).not.toBeChecked();+ await expect(args.onCheckedChange).toHaveBeenCalledTimes(2);+ await userEvent.click(canvas.getByText('Row label'));+ await expect(checkbox).toBeChecked();+ await expect(args.onCheckedChange).toHaveBeenCalledTimes(3);+ },+};diff --git a/packages/twenty-ui/src/input/Checkbox/__stories__/Checkbox.interactions.stories.tsx b/packages/twenty-ui/src/input/Checkbox/__stories__/Checkbox.interactions.stories.tsxnew file mode 100644index 00000000000..4a82d422d66--- /dev/null+++ b/packages/twenty-ui/src/input/Checkbox/__stories__/Checkbox.interactions.stories.tsx@@ -0,0 +1,213 @@+import { CheckboxGroup } from '@base-ui/react/checkbox-group';+import { DirectionProvider } from '@base-ui/react/direction-provider';+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { useState } from 'react';+import { expect, fn, userEvent, within } from 'storybook/test';++import { Checkbox } from '@ui/input/Checkbox/Checkbox';+import { type CheckboxProps } from '@ui/input/Checkbox/types/CheckboxProps';+import { ComponentDecorator } from '@ui/testing';++const meta: Meta<typeof Checkbox> = {+ title: 'UI/Input/Checkbox/Interactions',+ component: Checkbox,+ args: { 'aria-label': 'Select item', onCheckedChange: fn() },+};++export default meta;+type Story = StoryObj<typeof Checkbox>;++export const Uncontrolled: Story = {+ args: { defaultChecked: true },+ decorators: [ComponentDecorator],+ play: async ({ canvasElement, args }) => {+ const checkbox = within(canvasElement).getByRole('checkbox');+ await expect(checkbox).toBeChecked();+ await userEvent.click(checkbox);+ await expect(checkbox).not.toBeChecked();+ await expect(args.onCheckedChange).toHaveBeenCalledTimes(1);+ await expect(args.onCheckedChange).toHaveBeenCalledWith(+ false,+ expect.anything(),+ );+ },+};++export const Keyboard: Story = {+ decorators: [ComponentDecorator],+ play: async ({ canvasElement, args }) => {+ const checkbox = within(canvasElement).getByRole('checkbox');+ await userEvent.tab();+ await expect(checkbox).toHaveFocus();+ await expect(getComputedStyle(checkbox).outlineWidth).toBe('2px');+ await userEvent.keyboard('[Space]');+ await expect(checkbox).toBeChecked();+ await userEvent.keyboard('[Space]');+ await expect(checkbox).not.toBeChecked();+ await expect(args.onCheckedChange).toHaveBeenCalledTimes(2);+ },+};++export const Disabled: Story = {+ args: { disabled: true },+ decorators: [ComponentDecorator],+ play: async ({ canvasElement, args }) => {+ const checkbox = within(canvasElement).getByRole('checkbox');+ await userEvent.click(checkbox);+ await userEvent.tab();+ await expect(checkbox).not.toHaveFocus();+ await expect(checkbox).not.toBeChecked();+ await expect(args.onCheckedChange).not.toHaveBeenCalled();+ },+};++export const ReadOnly: Story = {+ args: { readOnly: true, defaultChecked: true },+ decorators: [ComponentDecorator],+ play: async ({ canvasElement, args }) => {+ const checkbox = within(canvasElement).getByRole('checkbox');+ await userEvent.tab();+ await expect(checkbox).toHaveFocus();+ await userEvent.keyboard('[Space]');+ await userEvent.click(checkbox);+ await expect(checkbox).toBeChecked();+ await expect(args.onCheckedChange).not.toHaveBeenCalled();+ },+};++const IndeterminateExample = (props: CheckboxProps) => {+ const [checked, setChecked] = useState(false);+ const [indeterminate, setIndeterminate] = useState(true);+ return (+ <Checkbox+ {...props}+ checked={checked}+ indeterminate={indeterminate}+ onCheckedChange={(value, details) => {+ props.onCheckedChange?.(value, details);+ setChecked(value);+ setIndeterminate(false);+ }}+ />+ );+};++export const Indeterminate: Story = {+ decorators: [ComponentDecorator],+ render: (args) => <IndeterminateExample {...args} />,+ play: async ({ canvasElement }) => {+ const checkbox = within(canvasElement).getByRole('checkbox');+ await expect(checkbox).toBePartiallyChecked();+ await userEvent.click(checkbox);+ await expect(checkbox).toBeChecked();+ await expect(checkbox).not.toBePartiallyChecked();+ },+};++export const CancelChange: Story = {+ args: { onCheckedChange: (_checked, details) => details.cancel() },+ decorators: [ComponentDecorator],+ play: async ({ canvasElement }) => {+ const checkbox = within(canvasElement).getByRole('checkbox');+ await userEvent.click(checkbox);+ await expect(checkbox).not.toBeChecked();+ },+};++export const ShiftClick: Story = {+ decorators: [ComponentDecorator],+ play: async ({ canvasElement, args }) => {+ const user = userEvent.setup();+ await user.keyboard('{Shift>}');+ await user.click(within(canvasElement).getByRole('checkbox'));+ await user.keyboard('{/Shift}');+ await expect(args.onCheckedChange).toHaveBeenCalledWith(+ true,+ expect.objectContaining({+ event: expect.objectContaining({ shiftKey: true }),+ }),+ );+ },+};++export const StateComposition: Story = {+ args: {+ className: (state) =>+ state.checked ? 'selected-checkbox' : 'unselected-checkbox',+ style: (state) => ({ marginInlineStart: state.checked ? 7 : 3 }),+ nativeButton: true,+ render: (props, state) => (+ <button+ {...props}+ data-selection={state.checked ? 'selected' : 'unselected'}+ />+ ),+ },+ decorators: [ComponentDecorator],+ play: async ({ canvasElement }) => {+ const checkbox = within(canvasElement).getByRole('checkbox');+ await expect(checkbox.tagName).toBe('BUTTON');+ await expect(checkbox).toHaveClass('unselected-checkbox');+ await userEvent.click(checkbox);+ await expect(checkbox).toHaveClass('selected-checkbox');+ await expect(checkbox).toHaveAttribute('data-selection', 'selected');+ await expect(checkbox).toHaveStyle({ marginInlineStart: '7px' });+ },+};++export const GroupIndeterminate: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <CheckboxGroup+ allValues={['one', 'two']}+ defaultValue={['one']}+ aria-label="Items"+ >+ <Checkbox parent aria-label="Select all" />+ <Checkbox value="one" aria-label="First item" />+ <Checkbox value="two" aria-label="Second item" />+ </CheckboxGroup>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const parent = canvas.getByRole('checkbox', { name: 'Select all' });+ await expect(parent).toBePartiallyChecked();+ await userEvent.click(parent);+ await expect(+ canvas.getByRole('checkbox', { name: 'First item' }),+ ).toBeChecked();+ await expect(+ canvas.getByRole('checkbox', { name: 'Second item' }),+ ).toBeChecked();+ await expect(parent).toBeChecked();+ },+};++export const SizesAndRtl: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <DirectionProvider direction="rtl">+ <div dir="rtl">+ <Checkbox size="sm" aria-label="Small" />+ <Checkbox size="md" aria-label="Medium" />+ <Checkbox size="sm" hoverable={false} aria-label="Small compact" />+ <Checkbox size="md" hoverable={false} aria-label="Medium compact" />+ </div>+ </DirectionProvider>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ for (const [label, size] of [+ ['Small', 24],+ ['Medium', 32],+ ['Small compact', 14],+ ['Medium compact', 20],+ ] as const) {+ const checkbox = canvas.getByRole('checkbox', { name: label });+ await expect(checkbox.getBoundingClientRect().width).toBe(size);+ await expect(checkbox.getBoundingClientRect().height).toBe(size);+ await userEvent.click(checkbox);+ await expect(checkbox).toBeChecked();+ }+ },+};diff --git a/packages/twenty-ui/src/input/Checkbox/__stories__/Checkbox.stories.tsx b/packages/twenty-ui/src/input/Checkbox/__stories__/Checkbox.stories.tsxindex cd1b7d8a54a..21c252a3f5a 100644--- a/packages/twenty-ui/src/input/Checkbox/__stories__/Checkbox.stories.tsx+++ b/packages/twenty-ui/src/input/Checkbox/__stories__/Checkbox.stories.tsx@@ -1,6 +1,11 @@import { type Meta, type StoryObj } from '@storybook/react-vite';import { useState } from 'react';import { expect, fn, userEvent, within } from 'storybook/test';++import { Checkbox } from '@ui/input/Checkbox/Checkbox';+import { type CheckboxColor } from '@ui/input/Checkbox/types/CheckboxColor';+import { type CheckboxProps } from '@ui/input/Checkbox/types/CheckboxProps';+import { type CheckboxSize } from '@ui/input/Checkbox/types/CheckboxSize';import {A11Y_DEFER_COLOR_CONTRAST,CatalogDecorator,@@ -8,38 +13,20 @@ import {ComponentDecorator,} from '@ui/testing';-import {- Checkbox,- CheckboxAccent,- CheckboxShape,- CheckboxSize,- CheckboxVariant,-} from '@ui/input/Checkbox/Checkbox';-const meta: Meta<typeof Checkbox> = {title: 'UI/Input/Checkbox/Checkbox',component: Checkbox,+ args: { 'aria-label': 'Checkbox' },};export default meta;type Story = StoryObj<typeof Checkbox>;-type ControlledCheckboxExampleProps = {- onCheckedChange?: (checked: boolean) => void;-};--const ControlledCheckboxExample = ({- onCheckedChange,-}: ControlledCheckboxExampleProps) => {+const ControlledExample = (props: CheckboxProps) => {const [checked, setChecked] = useState(false);-return (<>- <Checkbox- checked={checked}- onCheckedChange={onCheckedChange}- aria-label="Controlled checkbox"- />+ <Checkbox {...props} checked={checked} /><button type="button" onClick={() => setChecked(true)}>Apply selection</button>@@ -50,101 +37,105 @@ const ControlledCheckboxExample = ({export const Controlled: Story = {args: { onCheckedChange: fn() },decorators: [ComponentDecorator],- render: (args) => (- <ControlledCheckboxExample onCheckedChange={args.onCheckedChange} />- ),+ render: (args) => <ControlledExample {...args} />,play: async ({ canvasElement, args }) => {const canvas = within(canvasElement);- const checkbox = canvas.getByRole('checkbox', {- name: 'Controlled checkbox',- });-+ const checkbox = canvas.getByRole('checkbox');await userEvent.click(checkbox);-- await expect(args.onCheckedChange).toHaveBeenCalledWith(true);+ await expect(args.onCheckedChange).toHaveBeenCalledWith(+ true,+ expect.objectContaining({+ event: expect.objectContaining({ type: 'click' }),+ }),+ );await expect(checkbox).not.toBeChecked();-await userEvent.click(canvas.getByRole('button', { name: 'Apply selection' }),);-await expect(checkbox).toBeChecked();},};export const Default: Story = {- args: {- checked: false,- indeterminate: false,- hoverable: false,- disabled: false,- variant: CheckboxVariant.Primary,- size: CheckboxSize.Small,- shape: CheckboxShape.Squared,- accent: CheckboxAccent.Blue,- 'aria-label': 'Checkbox',- },+ args: { hoverable: false },+ decorators: [ComponentDecorator],+};++export const Round: Story = {+ args: { shape: 'round', defaultChecked: true },+ decorators: [ComponentDecorator],+};++export const Outline: Story = {+ args: { variant: 'outline' },+ decorators: [ComponentDecorator],+};++export const Success: Story = {+ args: { color: 'success', defaultChecked: true },+ decorators: [ComponentDecorator],+};++export const Warning: Story = {+ args: { color: 'warning', defaultChecked: true },decorators: [ComponentDecorator],};+type CatalogState =+ | 'unchecked'+ | 'checked'+ | 'mixed'+ | 'disabled'+ | 'disabled on';++const CATALOG_STATE_PROPS: Record<CatalogState, Partial<CheckboxProps>> = {+ unchecked: {},+ checked: { checked: true },+ mixed: { indeterminate: true },+ disabled: { disabled: true },+ 'disabled on': { checked: true, disabled: true },+};+export const Catalog: CatalogStory<Story, typeof Checkbox> = {- args: { 'aria-label': 'Checkbox' },- argTypes: {- variant: { control: false },- size: { control: false },- indeterminate: { control: false },- checked: { control: false },- hoverable: { control: false },- shape: { control: false },- accent: { control: false },- },+ decorators: [CatalogDecorator],parameters: {a11y: A11Y_DEFER_COLOR_CONTRAST,catalog: {dimensions: [{name: 'state',- values: ['disabled', 'unchecked', 'checked', 'indeterminate'],- props: (state: string) => {- if (state === 'disabled') {- return { disabled: true };- }- if (state === 'checked') {- return { checked: true };- }- if (state === 'indeterminate') {- return { indeterminate: true };- }- return {};- },+ values: Object.keys(CATALOG_STATE_PROPS),+ props: (state: CatalogState) => CATALOG_STATE_PROPS[state],},{- name: 'shape',- values: Object.values(CheckboxShape),- props: (shape: CheckboxShape) => ({ shape }),- },- {- name: 'isHoverable',- values: ['default', 'hoverable'],- props: (isHoverable: string) => {- if (isHoverable === 'hoverable') {- return { hoverable: true };- }- return {};- },+ name: 'color',+ values: ['accent', 'success', 'warning'],+ props: (color: CheckboxColor) => ({ color }),},{name: 'size',- values: Object.values(CheckboxSize),+ values: ['sm', 'md'],props: (size: CheckboxSize) => ({ size }),},- {- name: 'accent',- values: Object.values(CheckboxAccent),- props: (accent: CheckboxAccent) => ({ accent }),- },],+ options: { elementContainer: { style: { width: 60 } } },},},- decorators: [CatalogDecorator],+};++export const CatalogDark: CatalogStory<Story, typeof Checkbox> = {+ ...Catalog,+ tags: ['!autodocs'],+ globals: { colorScheme: 'dark' },+};++export const Soft: CatalogStory<Story, typeof Checkbox> = {+ ...Catalog,+ args: { variant: 'soft' },+};++export const SoftDark: CatalogStory<Story, typeof Checkbox> = {+ ...Soft,+ tags: ['!autodocs'],+ globals: { colorScheme: 'dark' },};diff --git a/packages/twenty-ui/src/input/Checkbox/__tests__/Checkbox.test.tsx b/packages/twenty-ui/src/input/Checkbox/__tests__/Checkbox.test.tsxnew file mode 100644index 00000000000..728db830662--- /dev/null+++ b/packages/twenty-ui/src/input/Checkbox/__tests__/Checkbox.test.tsx@@ -0,0 +1,11 @@+import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';++import { Checkbox } from '../Checkbox';+import styles from '../Checkbox.module.scss';++runComponentConformance({+ name: 'Checkbox',+ element: <Checkbox aria-label="Select item" />,+ refInstanceOf: HTMLSpanElement,+ ownClassName: styles.root,+});diff --git a/packages/twenty-ui/src/input/Checkbox/types/CheckboxColor.ts b/packages/twenty-ui/src/input/Checkbox/types/CheckboxColor.tsnew file mode 100644index 00000000000..de9540f6259--- /dev/null+++ b/packages/twenty-ui/src/input/Checkbox/types/CheckboxColor.ts@@ -0,0 +1 @@+export type CheckboxColor = 'accent' | 'success' | 'warning';diff --git a/packages/twenty-ui/src/input/Checkbox/types/CheckboxProps.ts b/packages/twenty-ui/src/input/Checkbox/types/CheckboxProps.tsnew file mode 100644index 00000000000..a96436dc061--- /dev/null+++ b/packages/twenty-ui/src/input/Checkbox/types/CheckboxProps.ts@@ -0,0 +1,14 @@+import { type Checkbox as CheckboxPrimitive } from '@base-ui/react/checkbox';++import { type CheckboxColor } from './CheckboxColor';+import { type CheckboxShape } from './CheckboxShape';+import { type CheckboxSize } from './CheckboxSize';+import { type CheckboxVariant } from './CheckboxVariant';++export type CheckboxProps = Omit<CheckboxPrimitive.Root.Props, 'color'> & {+ size?: CheckboxSize;+ variant?: CheckboxVariant;+ shape?: CheckboxShape;+ color?: CheckboxColor;+ hoverable?: boolean;+};diff --git a/packages/twenty-ui/src/input/Checkbox/types/CheckboxShape.ts b/packages/twenty-ui/src/input/Checkbox/types/CheckboxShape.tsnew file mode 100644index 00000000000..6e8ecad0025--- /dev/null+++ b/packages/twenty-ui/src/input/Checkbox/types/CheckboxShape.ts@@ -0,0 +1 @@+export type CheckboxShape = 'square' | 'round';diff --git a/packages/twenty-ui/src/input/Checkbox/types/CheckboxSize.ts b/packages/twenty-ui/src/input/Checkbox/types/CheckboxSize.tsnew file mode 100644index 00000000000..a9e5b3fd5ec--- /dev/null+++ b/packages/twenty-ui/src/input/Checkbox/types/CheckboxSize.ts@@ -0,0 +1 @@+export type CheckboxSize = 'sm' | 'md';diff --git a/packages/twenty-ui/src/input/Checkbox/types/CheckboxVariant.ts b/packages/twenty-ui/src/input/Checkbox/types/CheckboxVariant.tsnew file mode 100644index 00000000000..ab5e4300bf2--- /dev/null+++ b/packages/twenty-ui/src/input/Checkbox/types/CheckboxVariant.ts@@ -0,0 +1 @@+export type CheckboxVariant = 'solid' | 'outline' | 'soft';diff --git a/packages/twenty-ui/src/input/index.ts b/packages/twenty-ui/src/input/index.tsindex 35c4126e352..c0ed5ccd108 100644--- a/packages/twenty-ui/src/input/index.ts+++ b/packages/twenty-ui/src/input/index.ts@@ -23,13 +23,12 @@ export { baseTransitionTiming } from './Button/constant';export type { ButtonGroupProps } from './ButtonGroup/ButtonGroup';export { ButtonGroup } from './ButtonGroup/ButtonGroup';export { CardPicker } from './CardPicker/CardPicker';-export {- CheckboxVariant,- CheckboxShape,- CheckboxSize,- CheckboxAccent,- Checkbox,-} from './Checkbox/Checkbox';+export { Checkbox } from './Checkbox/Checkbox';+export type { CheckboxColor } from './Checkbox/types/CheckboxColor';+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 { CodeEditor } from './CodeEditor/CodeEditor';export { BASE_CODE_EDITOR_THEME_ID } from './CodeEditor/constants/BaseCodeEditorThemeId';export { getBaseCodeEditorTheme } from './CodeEditor/utils/getBaseCodeEditorTheme';diff --git a/packages/twenty-ui/src/navigation/ListItem/internal/ListItemCheckboxIndicator.tsx b/packages/twenty-ui/src/navigation/ListItem/internal/ListItemCheckboxIndicator.tsxindex 863a9dec703..fbd02c1bbe1 100644--- a/packages/twenty-ui/src/navigation/ListItem/internal/ListItemCheckboxIndicator.tsx+++ b/packages/twenty-ui/src/navigation/ListItem/internal/ListItemCheckboxIndicator.tsx@@ -16,10 +16,10 @@ export const ListItemCheckboxIndicator = ({aria-hiddenclassName={clsx(checkboxStyles.root,- checkboxStyles.primary,- checkboxStyles.small,- checkboxStyles.squared,- checkboxStyles.blue,+ checkboxStyles.solid,+ checkboxStyles.sm,+ checkboxStyles.square,+ checkboxStyles.accent,)}data-checked={checked || undefined}data-disabled={disabled || undefined}diff --git a/packages/twenty-ui/src/navigation/MenuItem/parts/MenuItemMultiSelectCheckbox.tsx b/packages/twenty-ui/src/navigation/MenuItem/parts/MenuItemMultiSelectCheckbox.tsxindex 29e3e695669..472dd6ef17b 100644--- a/packages/twenty-ui/src/navigation/MenuItem/parts/MenuItemMultiSelectCheckbox.tsx+++ b/packages/twenty-ui/src/navigation/MenuItem/parts/MenuItemMultiSelectCheckbox.tsx@@ -13,9 +13,7 @@ export const MenuItemMultiSelectCheckbox = ({onSelectChange,ariaLabel,}: MenuItemMultiSelectCheckboxProps) => {- // The checkbox handles its own toggle via onCheckedChange. Base UI- // re-dispatches a bubbling click on its hidden input, so we stop propagation- // here to keep the surrounding row's onClick from toggling twice.+ // The surrounding row also toggles selection on click.return (// oxlint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events<div@@ -24,7 +22,7 @@ export const MenuItemMultiSelectCheckbox = ({><Checkboxchecked={selected}- onCheckedChange={onSelectChange}+ onCheckedChange={(checked) => onSelectChange?.(checked)}aria-label={ariaLabel}/></div>