The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Add plain Input and Textarea variants (#28529)
Raphaël Bosi8ebfacf9e5fd
diff --git a/packages/twenty-docs/snippets/ui/generated/input/input.mdx b/packages/twenty-docs/snippets/ui/generated/input/input.mdxindex 7d9168d514b..90237e52e6e 100644--- a/packages/twenty-docs/snippets/ui/generated/input/input.mdx+++ b/packages/twenty-docs/snippets/ui/generated/input/input.mdx@@ -44,3 +44,7 @@<ParamField body="value" type="string | number | readonly string[]">The value of the input. Use when controlled.</ParamField>++<ParamField body="variant" type=""default" | "plain"" default="default">+ default keeps the field frame. plain removes fill, border, radius and padding and uses natural height. Its outline follows native :focus-visible, including pointer focus or autofocus on text inputs; invalid state uses a danger outline. InputGroup always owns the grouped frame.+</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/input/textarea.mdx b/packages/twenty-docs/snippets/ui/generated/input/textarea.mdxindex 875e4172392..cf6db5e1bdb 100644--- a/packages/twenty-docs/snippets/ui/generated/input/textarea.mdx+++ b/packages/twenty-docs/snippets/ui/generated/input/textarea.mdx@@ -12,7 +12,7 @@*/}<ParamField body="autoResize" type="boolean" default="false">- Measures committed controlled values or uncontrolled edits, form resets, row and size changes, and width changes. Overrides blockSize while enabled.+ Measures committed controlled values or uncontrolled edits, form resets, row, size and variant changes, and width changes. Overrides blockSize while enabled.</ParamField><ParamField body="className" type="string | ((state: InputState) => string | undefined)">@@ -39,3 +39,7 @@<ParamField body="size" type=""md" | "sm"" default="md">Visual size of the textarea.</ParamField>++<ParamField body="variant" type=""default" | "plain"" default="default">+ default keeps the field frame. plain removes fill, border, radius and padding while retaining rows, automatic sizing and maximum rows. Its outline follows native :focus-visible, including pointer focus or autofocus on textareas; invalid state uses a danger outline.+</ParamField>diff --git a/packages/twenty-docs/ui/primitives/input/input.mdx b/packages/twenty-docs/ui/primitives/input/input.mdxindex a814fc9ec81..7eecd84425e 100644--- a/packages/twenty-docs/ui/primitives/input/input.mdx+++ b/packages/twenty-docs/ui/primitives/input/input.mdx@@ -47,6 +47,23 @@ Compare small and medium inputs in their default, focused, invalid, and disabledheight={380}/>+## Plain appearance++Use `variant="plain"` inside an existing row or surface. It removes the fill, border, rounded corners and padding and uses natural height. The parent supplies spacing and row dimensions. Text, placeholder and disabled styling remain shared. The blue outline follows the browser's native `:focus-visible` behavior. For text controls this can include pointer focus and autofocus as well as keyboard focus. Invalid state uses a danger outline without changing layout.++```tsx+import { Field, Input } from 'twenty-ui/primitives/input';++export const InlineSubject = () => (+ <Field.Root>+ <Field.Label>Subject</Field.Label>+ <Input variant="plain" placeholder="Add a subject" />+ </Field.Root>+);+```++`InputGroup` automatically gives its input the plain appearance and keeps the group as the only focus and validation frame. Its `sm` and `md` heights remain 24px and 32px. Standalone plain inputs do not use the fixed height associated with `size`.+## Controlled statePass `value` and update it with `onValueChange` to own the same email address in React state. The callback receives the next string value and event details.diff --git a/packages/twenty-docs/ui/primitives/input/textarea.mdx b/packages/twenty-docs/ui/primitives/input/textarea.mdxindex 8d1614471b5..76aca739142 100644--- a/packages/twenty-docs/ui/primitives/input/textarea.mdx+++ b/packages/twenty-docs/ui/primitives/input/textarea.mdx@@ -44,6 +44,23 @@ Compare the two sizes in default, focused, invalid, and disabled states. Automatheight={440}/>+## Plain appearance++Use `variant="plain"` for multiline text inside an existing surface. It removes the fill, border, rounded corners and all padding while keeping the shared text, placeholder and disabled styling. The blue outline follows the browser's native `:focus-visible` behavior. For text controls this can include pointer focus and autofocus as well as keyboard focus. Invalid state uses a danger outline without changing layout.++```tsx+import { Field, Textarea } from 'twenty-ui/primitives/input';++export const InlineNotes = () => (+ <Field.Root>+ <Field.Label>Notes</Field.Label>+ <Textarea variant="plain" autoResize rows={1} maxRows={6} />+ </Field.Root>+);+```++The parent supplies spacing. `rows`, `maxRows` and automatic sizing still control the content height. The row limit excludes padding and borders in the plain appearance. Changing `variant` while automatic sizing is enabled measures the new layout.+## Controlled statePass `value` and update it with `onValueChange` to own the same notes in React state. The callback receives the next string value and event details; native `onChange` is also available.@@ -95,7 +112,7 @@ export const DescriptionField = () => {};```-`autoResize` measures the committed value after controlled updates and measures uncontrolled edits directly. Rejected controlled edits do not change the height. It also updates after native form resets, `rows`, `size`, `maxRows`, and available width changes. Use `maxRows` to cap growth and scroll longer content.+`autoResize` measures the committed value after controlled updates and measures uncontrolled edits directly. Rejected controlled edits do not change the height. It also updates after native form resets, `rows`, `size`, `variant`, `maxRows`, and available width changes. Use `maxRows` to cap growth and scroll longer content.Automatic sizing owns inline `blockSize` while enabled. Turning it off restores the current `style.blockSize`, or clears the automatic size if none is supplied. With automatic sizing off, `rows` and native styles control height. Manual resizing is disabled by default; set `style={{ resize: 'vertical' }}` when callers should resize the control themselves.diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-field-controls.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-field-controls.front-component.tsxindex 2c0d4ed1437..3239b330b3b 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-field-controls.front-component.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-field-controls.front-component.tsx@@ -1,4 +1,4 @@-import { createElement, useRef, useState } from 'react';+import { useRef, useState } from 'react';import { defineFrontComponent } from 'twenty-sdk/define';import {Button,@@ -8,6 +8,7 @@ import {Radio,RadioGroup,Textarea,+ type InputVariant,} from 'twenty-ui/primitives/input';import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';@@ -19,6 +20,8 @@ const FieldControls = () => {const [controlValues, setControlValues] = useState('');const [email, setEmail] = useState('');const [notes, setNotes] = useState('');+ const [inlineSubject, setInlineSubject] = useState('');+ const [notesVariant, setNotesVariant] = useState<InputVariant>('default');const [notesWidth, setNotesWidth] = useState('100%');const [reportedValues, setReportedValues] = useState('');@@ -70,6 +73,7 @@ const FieldControls = () => {<p id="notes-help">Additional guidance</p><Textarearef={textareaRef}+ variant={notesVariant}aria-describedby="notes-help"value={notes}onValueChange={setNotes}@@ -78,12 +82,13 @@ const FieldControls = () => {style={{ width: notesWidth }}autoResizemaxRows={6}- render={(props, state) =>- createElement('textarea', {- ...props,- 'data-filled': state.filled || undefined,- })- }+ render={(props, state) => (+ <textarea+ // oxlint-disable-next-line react/jsx-props-no-spreading+ {...props}+ data-filled={state.filled || undefined}+ />+ )}/><Field.Description>Team context</Field.Description><Field.Error match>Notes need review</Field.Error>@@ -94,7 +99,20 @@ const FieldControls = () => {<Field.Description>Keep this reference</Field.Description><Field.Error match>Reference cannot be changed</Field.Error></Field.Root>+ <Field.Root>+ <Field.Label>Inline subject</Field.Label>+ <Input+ variant="plain"+ value={inlineSubject}+ onValueChange={setInlineSubject}+ />+ <Field.Description>Subject without a field frame</Field.Description>+ </Field.Root><Input aria-label="Disabled input" disabled value="Locked" />+ <p role="status">Inline subject: {inlineSubject}</p>+ <Button type="button" onClick={() => setNotesVariant('plain')}>+ Use plain notes+ </Button><p role="status">Email: {email}; Notes: {notes}</p>diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/fieldControlsTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/fieldControlsTest.tsindex 6170cfa6fc7..9ea89b5c5e2 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/fieldControlsTest.ts+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/fieldControlsTest.ts@@ -120,5 +120,30 @@ export const fieldControlsTest: TwentyUiGalleryPlayFunction = async ({),{ timeout: INTERACTION_TIMEOUT },);+ const inlineSubject = canvas.getByRole('textbox', { name: 'Inline subject' });+ expect(inlineSubject).toHaveAccessibleDescription(+ 'Subject without a field frame',+ );+ expect(getComputedStyle(inlineSubject).borderWidth).toBe('0px');+ expect(getComputedStyle(inlineSubject).padding).toBe('0px');+ await userEvent.type(inlineSubject, 'Weekly update', { delay: TYPING_DELAY });+ await waitFor(() =>+ expect(canvas.getByText('Inline subject: Weekly update')).toBeVisible(),+ );+ const framedNotesHeight = notes.getBoundingClientRect().height;+ await userEvent.click(+ canvas.getByRole('button', { name: 'Use plain notes' }),+ );+ await waitFor(() => expect(notes).toHaveAttribute('data-variant', 'plain'));+ await waitFor(+ () =>+ expect(notes.getBoundingClientRect().height).toBeLessThan(+ framedNotesHeight,+ ),+ { timeout: INTERACTION_TIMEOUT },+ );+ expect(notes).toHaveAttribute('aria-invalid', 'true');+ expect(getComputedStyle(notes).borderWidth).toBe('0px');+ expect(getComputedStyle(notes).padding).toBe('0px');expect(errorHandler).not.toHaveBeenCalled();};diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventComposerFields.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventComposerFields.tsxindex 0040f96b776..9ee61b18697 100644--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventComposerFields.tsx+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventComposerFields.tsx@@ -3,7 +3,6 @@ import { CalendarEventLocationInput } from '@/activities/calendar/components/Calimport { type useCalendarEventComposer } from '@/activities/calendar/hooks/useCalendarEventComposer';import { ComposerFieldRow } from '@/activities/components/ComposerFieldRow';import { ComposerHeader } from '@/activities/components/ComposerHeader';-import { StyledComposerTextInput } from '@/activities/components/ComposerTextInput';import { EmailRecipientsFieldInput } from '@/activities/emails/recipients/components/EmailRecipientsFieldInput';import { useEmailRecipientsDragAndDrop } from '@/activities/emails/recipients/hooks/useEmailRecipientsDragAndDrop';import { type EmailComposerContextRecord } from '@/activities/emails/recipients/types/EmailComposerContextRecord';@@ -23,7 +22,7 @@ import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { isDefined } from 'twenty-shared/utils';import { Callout } from 'twenty-ui/components/feedback';-import { Switch } from 'twenty-ui/primitives/input';+import { Input, Switch } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme';const StyledFieldsContainer = styled.div`@@ -127,7 +126,8 @@ export const CalendarEventComposerFields = ({</ComposerFieldRow>)}<ComposerFieldRow label={t`Title`}>- <StyledComposerTextInput+ <Input+ variant="plain"type="text"aria-label={t`Title`}placeholder={t`Add an event title`}diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventLocationInput.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventLocationInput.tsxindex 1755ad63f43..3e7c3d497b7 100644--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventLocationInput.tsx+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventLocationInput.tsx@@ -1,9 +1,8 @@-import { StyledComposerTextInput } from '@/activities/components/ComposerTextInput';import { PlaceAutocompleteSelect } from '@/geo-map/components/PlaceAutocompleteSelect';import { usePlaceAutocomplete } from '@/geo-map/hooks/usePlaceAutocomplete';import { AutocompleteRoot } from '@/ui/input/components/AutocompleteRoot';import { isDefined } from 'twenty-shared/utils';-import { Autocomplete } from 'twenty-ui/primitives/input';+import { Autocomplete, Input } from 'twenty-ui/primitives/input';const CALENDAR_EVENT_LOCATION_AUTOCOMPLETE_DROPDOWN_ID ='calendar-event-location-autocomplete-dropdown';@@ -61,7 +60,7 @@ export const CalendarEventLocationInput = ({autoComplete="off"aria-label={ariaLabel}placeholder={placeholder}- render={<StyledComposerTextInput />}+ render={<Input variant="plain" />}/><PlaceAutocompleteSelectlist={placeAutocompleteData}diff --git a/packages/twenty-front/src/modules/activities/components/ComposerTextInput.tsx b/packages/twenty-front/src/modules/activities/components/ComposerTextInput.tsxdeleted file mode 100644index 3d4bec07f51..00000000000--- a/packages/twenty-front/src/modules/activities/components/ComposerTextInput.tsx+++ /dev/null@@ -1,19 +0,0 @@-import { FORM_FIELD_PLACEHOLDER_STYLES } from '@/ui/input/constants/FormFieldPlaceholderStyles';-import { styled } from '@linaria/react';-import { themeCssVariables } from 'twenty-ui/theme';--export const StyledComposerTextInput = styled.input`- background: transparent;- border: none;- color: ${themeCssVariables.font.color.primary};- font-family: inherit;- font-size: ${themeCssVariables.font.size.md};- font-weight: ${themeCssVariables.font.weight.regular};- outline: none;- padding: 0;- width: 100%;-- &::placeholder {- ${FORM_FIELD_PLACEHOLDER_STYLES}- }-`;diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailComposerFields.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailComposerFields.tsxindex 3acab4b6ff9..2791e955b9c 100644--- a/packages/twenty-front/src/modules/activities/emails/components/EmailComposerFields.tsx+++ b/packages/twenty-front/src/modules/activities/emails/components/EmailComposerFields.tsx@@ -13,11 +13,11 @@ import { IconPaperclip } from 'twenty-ui/icon';import { useRef } from 'react';import { flushSync } from 'react-dom';import { LightButton } from 'twenty-ui/components/input';+import { Input } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme';import { ComposerFieldRow } from '@/activities/components/ComposerFieldRow';import { ComposerHeader } from '@/activities/components/ComposerHeader';-import { StyledComposerTextInput } from '@/activities/components/ComposerTextInput';import { EmailAttachmentsField } from '@/activities/emails/components/EmailAttachmentsField';import { INLINE_EMAIL_BODY_EDITOR_PROFILE } from '@/activities/emails/editor/constants/InlineEmailBodyEditorProfile';import { useUploadEmailImage } from '@/activities/emails/hooks/useUploadEmailImage';@@ -249,7 +249,8 @@ export const EmailComposerFields = ({</>)}<ComposerFieldRow label={t`Subject`}>- <StyledComposerTextInput+ <Input+ variant="plain"type="text"aria-label={t`Subject`}defaultValue={composerState.initialSubject}diff --git a/packages/twenty-front/src/modules/ai/components/internal/AiChatEmailRecipientsRow.tsx b/packages/twenty-front/src/modules/ai/components/internal/AiChatEmailRecipientsRow.tsxindex 7e48d223387..838ff341494 100644--- a/packages/twenty-front/src/modules/ai/components/internal/AiChatEmailRecipientsRow.tsx+++ b/packages/twenty-front/src/modules/ai/components/internal/AiChatEmailRecipientsRow.tsx@@ -1,9 +1,11 @@+import { css } from '@linaria/core';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { type KeyboardEvent, useState } from 'react';import { LightIconButton } from 'twenty-ui/components/input';import { IconX } from 'twenty-ui/icon';import { Chip } from 'twenty-ui/primitives/data-display';+import { Input } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme';import { type EmailRecipient } from '@/activities/emails/recipients/types/EmailRecipient';@@ -23,19 +25,9 @@ const StyledRowLabel = styled.span`width: 32px;`;-const StyledInput = styled.input`- background: transparent;- border: none;- color: ${themeCssVariables.font.color.primary};+const RECIPIENT_INPUT_CLASS_NAME = css`flex: 1 0 80px;- font-family: inherit;- font-size: ${themeCssVariables.font.size.sm};min-width: 80px;- outline: none;-- &::placeholder {- color: ${themeCssVariables.font.color.light};- }`;type AiChatEmailRecipientsRowProps = {@@ -113,7 +105,9 @@ export const AiChatEmailRecipientsRow = ({</Chip>))}{!disabled && (- <StyledInput+ <Input+ variant="plain"+ className={RECIPIENT_INPUT_CLASS_NAME}aria-label={t`Add a recipient to ${label}`}placeholder={recipients.length === 0 ? t`Add recipient` : undefined}value={draftRecipient}diff --git a/packages/twenty-front/src/modules/ai/components/internal/AiChatToolCallApprovalEmailCard.tsx b/packages/twenty-front/src/modules/ai/components/internal/AiChatToolCallApprovalEmailCard.tsxindex 333412f346c..d44e475d03d 100644--- a/packages/twenty-front/src/modules/ai/components/internal/AiChatToolCallApprovalEmailCard.tsx+++ b/packages/twenty-front/src/modules/ai/components/internal/AiChatToolCallApprovalEmailCard.tsx@@ -10,7 +10,7 @@ import {} from 'twenty-shared/utils';import { LightButton } from 'twenty-ui/components/input';import { IconDeviceFloppy, IconSend, IconTrash } from 'twenty-ui/icon';-import { Button } from 'twenty-ui/primitives/input';+import { Button, Input } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme';import { parseEmailRecipients } from '@/activities/emails/recipients/utils/parseEmailRecipients';@@ -27,15 +27,8 @@ const EMAIL_TOOL_NAMES = {draft: 'draft_email',} as const;-const StyledSubjectInput = styled.input`- background: transparent;- border: none;+const StyledSubjectContainer = styled.div`border-bottom: 1px solid ${themeCssVariables.border.color.light};- color: ${themeCssVariables.font.color.primary};- font-family: inherit;- font-size: ${themeCssVariables.font.size.md};- font-weight: ${themeCssVariables.font.weight.medium};- outline: none;padding: ${themeCssVariables.spacing[1]} 0;`;@@ -208,13 +201,16 @@ export const AiChatToolCallApprovalEmailCard = ({onChange={setBcc}/>)}- <StyledSubjectInput- aria-label={t`Subject`}- placeholder={t`Subject`}- value={subject}- disabled={isAnswering}- onChange={(event) => setSubject(event.target.value)}- />+ <StyledSubjectContainer>+ <Input+ variant="plain"+ aria-label={t`Subject`}+ placeholder={t`Subject`}+ value={subject}+ disabled={isAnswering}+ onChange={(event) => setSubject(event.target.value)}+ />+ </StyledSubjectContainer><FormAdvancedTextFieldInputdefaultValue={serializeEmailBody(proposal.arguments.body)}onChange={handleBodyChange}diff --git a/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx b/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsxindex 7841cce7b16..731cc3c60d2 100644--- a/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx+++ b/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx@@ -190,7 +190,7 @@ export const MatchingNavigateShortcuts: Story = {export const NoResultsSearchFallback: Story = {play: async ({ canvasElement }) => {const canvas = within(canvasElement);- const searchInput = await canvas.findByTestId(SIDE_PANEL_FOCUS_ID);+ const searchInput = await canvas.findByRole('textbox', { name: 'Search' });await waitFor(() => expect(searchInput).toHaveFocus());await userEvent.type(searchInput, 'input without results');expect(diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormArrayFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormArrayFieldInput.tsxindex 6c5279fd61e..d825d520e63 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormArrayFieldInput.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormArrayFieldInput.tsx@@ -424,7 +424,6 @@ export const FormArrayFieldInput = ({onEscape={handleNewItemInputEscape}onChange={handleNewItemInputChange}onEnter={handleNewItemInputSubmit}- hasItem/>) : !isLimitReached ? (<Dropdown.Section>diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemBaseInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemBaseInput.tsxindex 955e3320bdb..8845c7ef271 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemBaseInput.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemBaseInput.tsx@@ -7,46 +7,17 @@ import { Key } from 'ts-key-enum';import { isNonEmptyString } from '@sniptt/guards';import { themeCssVariables } from 'twenty-ui/theme';import { isDefined } from 'twenty-shared/utils';+import { Input } from 'twenty-ui/primitives/input';import { combineRefs } from '~/utils/combineRefs';-const StyledInput = styled.input<{- withRightComponent?: boolean;- hasError?: boolean;- hasItem: boolean;-}>`- background-color: ${({ hasItem }) =>- hasItem ? themeCssVariables.background.transparent.lighter : 'transparent'};- background-color: transparent;- border: ${({ hasItem, hasError }) =>- hasItem- ? hasError- ? `1px solid ${themeCssVariables.border.color.danger}`- : `1px solid ${themeCssVariables.border.color.medium}`- : 'none'};- border: none;- border-radius: ${({ hasItem }) => (hasItem ? '4px' : '0')};+const StyledInputContent = styled.div<{ hasRightComponent: boolean }>`+ align-items: center;box-sizing: border-box;- color: ${themeCssVariables.font.color.primary};- font-family: ${themeCssVariables.font.family};-- &::placeholder,- &::-webkit-input-placeholder {- color: ${themeCssVariables.font.color.light};- font-family: ${themeCssVariables.font.family};- font-weight: ${themeCssVariables.font.weight.medium};- }-- font-size: inherit;- font-weight: ${themeCssVariables.font.weight.medium};- font-weight: inherit;- height: 32px;- outline: none;- padding: ${themeCssVariables.spacing[0]} ${themeCssVariables.spacing[2]};- padding-right: ${({ withRightComponent }) =>- withRightComponent ? '32px' : '0'};- position: relative;-- width: 100%;+ display: flex;+ min-height: ${themeCssVariables.spacing[8]};+ padding-inline-end: ${({ hasRightComponent }) =>+ hasRightComponent ? themeCssVariables.spacing[8] : '0'};+ padding-inline-start: ${themeCssVariables.spacing[2]};`;const StyledInputContainer = styled.div`@@ -90,7 +61,6 @@ export const MultiItemBaseInput = ({renderInput,error = '',hasError = false,- hasItem,instanceId,ref,}: MultiItemBaseInputProps & { ref?: Ref<HTMLInputElement> }) => {@@ -158,19 +128,20 @@ export const MultiItemBaseInput = ({onBlur,})) : (- <StyledInput- hasError={hasError}- autoFocus={autoFocus}- value={value}- placeholder={placeholder}- onChange={(event) => onChange(event.target.value)}- ref={combinedRef}- withRightComponent={isDefined(rightComponent)}- hasItem={hasItem}- onFocus={onFocus}- onBlur={onBlur}- onKeyDown={handleKeyDown}- />+ <StyledInputContent hasRightComponent={isDefined(rightComponent)}>+ <Input+ variant="plain"+ aria-invalid={hasError || undefined}+ autoFocus={autoFocus}+ value={value}+ placeholder={placeholder}+ onChange={(event) => onChange(event.target.value)}+ ref={combinedRef}+ onFocus={onFocus}+ onBlur={onBlur}+ onKeyDown={handleKeyDown}+ />+ </StyledInputContent>)}{isDefined(rightComponent) && (<StyledRightContainer>{rightComponent}</StyledRightContainer>diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsxindex c5bc0a9de49..d667cbe9dc1 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsx@@ -362,7 +362,6 @@ export const MultiItemFieldInput = <T,>({}}onEnter={handleEnter}preventTabNavigation- hasItem={isNonEmptyArray(items)}rightComponent={isNonEmptyArray(items) ? (<LightIconButtondiff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/MultiItemBaseInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/MultiItemBaseInput.stories.tsxindex 81c5eede674..87f39599e15 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/MultiItemBaseInput.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/MultiItemBaseInput.stories.tsx@@ -1,3 +1,4 @@+import { expect, fn, userEvent, within } from 'storybook/test';import { type Meta, type StoryObj } from '@storybook/react-vite';import { MultiItemBaseInput } from '@/object-record/record-field/ui/meta-types/input/components/MultiItemBaseInput';@@ -18,3 +19,24 @@ export const Default: Story = {};export const Focused: Story = {args: { autoFocus: true },};++export const InvalidPlainInput: Story = {+ args: {+ hasError: true,+ error: 'Enter a valid value',+ onChange: fn(),+ onEnter: fn(),+ },+ play: async ({ canvasElement, args }) => {+ const canvas = within(canvasElement);+ const input = canvas.getByRole('textbox');++ await expect(input).toHaveAttribute('aria-invalid', 'true');+ await expect(canvas.getByText('Enter a valid value')).toBeVisible();+ await expect(getComputedStyle(input).borderWidth).toBe('0px');+ await expect(getComputedStyle(input).outlineWidth).toBe('2px');+ await userEvent.click(input);+ await userEvent.keyboard('{Enter}');+ await expect(args.onEnter).toHaveBeenCalledTimes(1);+ },+};diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/types/MultiItemBaseInputProps.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/types/MultiItemBaseInputProps.tsindex 91b561749fb..5559b67c1ec 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/types/MultiItemBaseInputProps.ts+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/types/MultiItemBaseInputProps.ts@@ -24,7 +24,6 @@ export type MultiItemBaseInputProps = Pick<) => ReactNode;error?: string | null;hasError?: boolean;- hasItem: boolean;onChange: (value: string) => void;instanceId: string;};diff --git a/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBar.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBar.tsxindex 43e8132ff5d..825ef2f34f9 100644--- a/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBar.tsx+++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBar.tsx@@ -26,6 +26,7 @@ import { useRef } from 'react';import { Key } from 'ts-key-enum';import { SidePanelPages } from 'twenty-shared/types';import { useIsMobile } from 'twenty-ui/utilities';+import { Input } from 'twenty-ui/primitives/input';import { useTheme, themeCssVariables } from 'twenty-ui/theme';const StyledInputContainer = styled.div<{ isMobile: boolean }>`@@ -51,24 +52,6 @@ const StyledInputContainer = styled.div<{ isMobile: boolean }>`position: relative;`;-const StyledInput = styled.input`- background-color: transparent;- border: none;- border-radius: 0;- color: ${themeCssVariables.font.color.primary};- flex: 1;- font-size: ${themeCssVariables.font.size.md};- height: 24px;- margin: 0;- outline: none;- padding: 0;-- &::placeholder {- color: ${themeCssVariables.font.color.light};- font-weight: ${themeCssVariables.font.weight.medium};- }-`;-const StyledContentContainer = styled.div`align-items: center;display: flex;@@ -243,7 +226,10 @@ export const SidePanelTopBar = ({)}{COMMAND_MENU_SIDE_PANEL_PAGES.includes(sidePanelPage) && (<>- <StyledInput+ <Input+ variant="plain"+ size="sm"+ aria-label={t`Search`}data-testid={SIDE_PANEL_FOCUS_ID}ref={inputRef}value={sidePanelSearch}diff --git a/packages/twenty-front/src/modules/ui/input/components/TextArea.tsx b/packages/twenty-front/src/modules/ui/input/components/TextArea.tsxindex 87d12d2f483..511c12d659e 100644--- a/packages/twenty-front/src/modules/ui/input/components/TextArea.tsx+++ b/packages/twenty-front/src/modules/ui/input/components/TextArea.tsx@@ -1,47 +1,20 @@-import { css, cx } from '@linaria/core';import { styled } from '@linaria/react';import { type FocusEventHandler } from 'react';import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById';import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';-import { type FormFieldInputVariant } from '@/ui/input/types/FormFieldInputVariant';+import { type TextAreaProps } from '@/ui/input/types/TextAreaProps';import { isDefined } from 'twenty-shared/utils';import { Field, Textarea } from 'twenty-ui/primitives/input';import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';-export type TextAreaProps = {- textAreaId: string;- label?: string;- disabled?: boolean;- height?: number;- minRows?: number;- maxRows?: number;- onChange?: (value: string) => void;- placeholder?: string;- value?: string;- className?: string;- onFocus?: () => void;- onBlur?: () => void;- readOnly?: boolean;- variant?: FormFieldInputVariant;-};-const StyledContainer = styled.div`display: flex;flex-direction: column;width: 100%;`;-const transparentTextareaClassName = css`- background-color: transparent;- border: none;- border-radius: 0;- line-height: inherit;- overflow: hidden;- padding: 0;-`;-export const TextArea = ({textAreaId,label,@@ -93,7 +66,8 @@ export const TextArea = ({<TextareaautoResizerows={computedMinRows}- maxRows={isTransparent ? undefined : maxRows}+ maxRows={maxRows}+ variant={isTransparent ? 'plain' : 'default'}placeholder={placeholder}value={value}onChange={(event) =>@@ -103,11 +77,9 @@ export const TextArea = ({onBlur={handleBlur}disabled={disabled}readOnly={readOnly}- className={cx(className, isTransparent && transparentTextareaClassName)}+ className={className}style={{height,- maxBlockSize:- isTransparent && isDefined(maxRows) ? `${maxRows}lh` : undefined,}}/></Field.Root>diff --git a/packages/twenty-front/src/modules/ui/input/components/__stories__/TextArea.stories.tsx b/packages/twenty-front/src/modules/ui/input/components/__stories__/TextArea.stories.tsxindex adc2fff4ed2..0d8d0b2595f 100644--- a/packages/twenty-front/src/modules/ui/input/components/__stories__/TextArea.stories.tsx+++ b/packages/twenty-front/src/modules/ui/input/components/__stories__/TextArea.stories.tsx@@ -1,8 +1,9 @@import { type Meta, type StoryObj } from '@storybook/react-vite';import { useState } from 'react';-import { TextArea, type TextAreaProps } from '@/ui/input/components/TextArea';-import { expect, userEvent, within } from 'storybook/test';+import { TextArea } from '@/ui/input/components/TextArea';+import { type TextAreaProps } from '@/ui/input/types/TextAreaProps';+import { expect, userEvent, waitFor, within } from 'storybook/test';import { ComponentDecorator } from 'twenty-ui/testing';type RenderProps = TextAreaProps;@@ -61,6 +62,22 @@ export const Transparent: Story = {variant: 'transparent',value: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',},+ play: async ({ canvasElement }) => {+ const textarea = within(canvasElement).getByRole('textbox');++ await expect(textarea).toHaveAttribute('data-variant', 'plain');+ await expect(getComputedStyle(textarea).borderWidth).toBe('0px');+ await expect(getComputedStyle(textarea).padding).toBe('0px');+ const initialHeight = textarea.clientHeight;+ await userEvent.type(+ textarea,+ '{enter}Second{enter}Third{enter}Fourth{enter}Fifth{enter}Sixth',+ );+ await waitFor(() =>+ expect(textarea.scrollHeight).toBeGreaterThan(textarea.clientHeight),+ );+ await expect(textarea.clientHeight).toBeGreaterThanOrEqual(initialHeight);+ },};export const TransparentUnbounded: Story = {diff --git a/packages/twenty-front/src/modules/ui/input/types/TextAreaProps.ts b/packages/twenty-front/src/modules/ui/input/types/TextAreaProps.tsnew file mode 100644index 00000000000..6a4fc76eaa5--- /dev/null+++ b/packages/twenty-front/src/modules/ui/input/types/TextAreaProps.ts@@ -0,0 +1,18 @@+import { type FormFieldInputVariant } from '@/ui/input/types/FormFieldInputVariant';++export type TextAreaProps = {+ textAreaId: string;+ label?: string;+ disabled?: boolean;+ height?: number;+ minRows?: number;+ maxRows?: number;+ onChange?: (value: string) => void;+ placeholder?: string;+ value?: string;+ className?: string;+ onFocus?: () => void;+ onBlur?: () => void;+ readOnly?: boolean;+ variant?: FormFieldInputVariant;+};diff --git a/packages/twenty-ui/docs/inputPropDescriptions.ts b/packages/twenty-ui/docs/inputPropDescriptions.tsindex 039e4497fd7..039a5c95a8e 100644--- a/packages/twenty-ui/docs/inputPropDescriptions.ts+++ b/packages/twenty-ui/docs/inputPropDescriptions.ts@@ -1,6 +1,8 @@import { type InputProps } from '../src/primitives/input/Input/types/InputProps';export const INPUT_PROP_DESCRIPTIONS = {+ variant:+ 'default keeps the field frame. plain removes fill, border, radius and padding and uses natural height. Its outline follows native :focus-visible, including pointer focus or autofocus on text inputs; invalid state uses a danger outline. InputGroup always owns the grouped frame.',size: 'Visual size. Explicit input size takes precedence over the InputGroup default, then md applies. Group layout still sets the surrounding height.',ref: 'Ref to the native input element.',render:diff --git a/packages/twenty-ui/docs/public-exports.json b/packages/twenty-ui/docs/public-exports.jsonindex 2b08b8bdf6b..7317ac5da4e 100644--- a/packages/twenty-ui/docs/public-exports.json+++ b/packages/twenty-ui/docs/public-exports.json@@ -897,6 +897,7 @@"InputGroupProps": "primitives/input/InputGroup/types/InputGroupProps","InputProps": "primitives/input/Input/types/InputProps","InputSize": "primitives/input/types/InputSize",+ "InputVariant": "primitives/input/types/InputVariant","NumberFieldDecrementProps": "primitives/input/NumberField/types/NumberFieldDecrementProps","NumberFieldDecrementState": "primitives/input/NumberField/types/NumberFieldDecrementState","NumberFieldGroupProps": "primitives/input/NumberField/types/NumberFieldGroupProps",diff --git a/packages/twenty-ui/docs/textareaPropDescriptions.ts b/packages/twenty-ui/docs/textareaPropDescriptions.tsindex 5da65f0759e..c28dd6eb99c 100644--- a/packages/twenty-ui/docs/textareaPropDescriptions.ts+++ b/packages/twenty-ui/docs/textareaPropDescriptions.ts@@ -1,13 +1,15 @@import { type TextareaProps } from '../src/primitives/input/Textarea/types/TextareaProps';export const TEXTAREA_PROP_DESCRIPTIONS = {+ variant:+ 'default keeps the field frame. plain removes fill, border, radius and padding while retaining rows, automatic sizing and maximum rows. Its outline follows native :focus-visible, including pointer focus or autofocus on textareas; invalid state uses a danger outline.',ref: 'Ref to the native textarea element.',render:'Composes the native textarea with a custom element or callback receiving textarea props and Field state. Forward the supplied props and ref to a textarea.',onValueChange:'Receives the next string value and Base UI details, including the native event, reason and cancellation methods.',autoResize:- 'Measures committed controlled values or uncontrolled edits, form resets, row and size changes, and width changes. Overrides blockSize while enabled.',+ 'Measures committed controlled values or uncontrolled edits, form resets, row, size and variant changes, and width changes. Overrides blockSize while enabled.',maxRows:'Caps automatic height growth. Content beyond this row limit scrolls.',} satisfies Partial<Record<keyof TextareaProps, string>>;diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex f36776fc171..847d5183024 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -3685,6 +3685,13 @@"required": false,"defaultValue": null,"description": "The value of the input. Use when controlled."+ },+ {+ "name": "variant",+ "type": "\"default\" | \"plain\"",+ "required": false,+ "defaultValue": "default",+ "description": "default keeps the field frame. plain removes fill, border, radius and padding and uses natural height. Its outline follows native :focus-visible, including pointer focus or autofocus on text inputs; invalid state uses a danger outline. InputGroup always owns the grouped frame."}]},@@ -4378,7 +4385,7 @@"type": "boolean","required": false,"defaultValue": "false",- "description": "Measures committed controlled values or uncontrolled edits, form resets, row and size changes, and width changes. Overrides blockSize while enabled."+ "description": "Measures committed controlled values or uncontrolled edits, form resets, row, size and variant changes, and width changes. Overrides blockSize while enabled."},{"name": "className",@@ -4421,6 +4428,13 @@"required": false,"defaultValue": "md","description": "Visual size of the textarea."+ },+ {+ "name": "variant",+ "type": "\"default\" | \"plain\"",+ "required": false,+ "defaultValue": "default",+ "description": "default keeps the field frame. plain removes fill, border, radius and padding while retaining rows, automatic sizing and maximum rows. Its outline follows native :focus-visible, including pointer focus or autofocus on textareas; invalid state uses a danger outline."}]},diff --git a/packages/twenty-ui/src/components/input/SearchInput/types/SearchInputProps.ts b/packages/twenty-ui/src/components/input/SearchInput/types/SearchInputProps.tsindex b42a6f3d2cd..f9d314f1228 100644--- a/packages/twenty-ui/src/components/input/SearchInput/types/SearchInputProps.ts+++ b/packages/twenty-ui/src/components/input/SearchInput/types/SearchInputProps.ts@@ -2,6 +2,6 @@ import { type ReactNode } from 'react';import { type InputProps } from '@ui/primitives/input/Input/types/InputProps';-export type SearchInputProps = InputProps & {+export type SearchInputProps = Omit<InputProps, 'variant'> & {actions?: ReactNode;};diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/Dropdown.module.scss b/packages/twenty-ui/src/components/navigation/Dropdown/Dropdown.module.scssindex 01e8f1c8804..9fd8c8a3ffc 100644--- a/packages/twenty-ui/src/components/navigation/Dropdown/Dropdown.module.scss+++ b/packages/twenty-ui/src/components/navigation/Dropdown/Dropdown.module.scss@@ -111,14 +111,10 @@display: flex;flex: none;min-block-size: 36px;- padding-block: var(--t-spacing-2);+ padding: var(--t-spacing-2);}.search[data-dropdown-search] {- background: transparent;- block-size: auto;- border: none;- border-radius: 0;font-size: var(--t-font-size-sm);}diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownSearch.tsx b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownSearch.tsxindex 07b3b23f804..5a696956d8e 100644--- a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownSearch.tsx+++ b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownSearch.tsx@@ -31,6 +31,7 @@ export const DropdownSearch = ({ref={mergedRef}value={value}data-dropdown-search=""+ variant="plain"className={mergeClassNames(styles.search, className)}onValueChange={(value) => onValueChange?.(value)}onBlur={(event) => {diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/types/DropdownSearchProps.ts b/packages/twenty-ui/src/components/navigation/Dropdown/types/DropdownSearchProps.tsindex ac6eaa9735f..2b4ed395744 100644--- a/packages/twenty-ui/src/components/navigation/Dropdown/types/DropdownSearchProps.ts+++ b/packages/twenty-ui/src/components/navigation/Dropdown/types/DropdownSearchProps.ts@@ -1,5 +1,8 @@import { type InputProps } from '@ui/primitives/input/Input/types/InputProps';-export type DropdownSearchProps = Omit<InputProps, 'onValueChange' | 'size'> & {+export type DropdownSearchProps = Omit<+ InputProps,+ 'onValueChange' | 'size' | 'variant'+> & {onValueChange?: (value: string) => void;};diff --git a/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/Autocomplete.collection.stories.tsx b/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/Autocomplete.collection.stories.tsxindex 981e17721d8..d047aa4dd41 100644--- a/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/Autocomplete.collection.stories.tsx+++ b/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/Autocomplete.collection.stories.tsx@@ -23,6 +23,17 @@ export const GroupedObjectInteractions: Story = {const canvas = within(canvasElement);const body = within(canvasElement.ownerDocument.body);const input = canvas.getByRole('combobox', { name: 'City' });+ const group = canvas.getByRole('group');+ const restingBorderColor = getComputedStyle(group).borderColor;++ await expect(group.getBoundingClientRect().height).toBe(32);+ await expect(getComputedStyle(group).borderWidth).toBe('1px');+ await expect(getComputedStyle(input).borderWidth).toBe('0px');+ await expect(getComputedStyle(input).borderRadius).toBe('0px');+ await expect(getComputedStyle(input).padding).toBe('0px');+ await expect(getComputedStyle(input).backgroundColor).toBe(+ 'rgba(0, 0, 0, 0)',+ );await userEvent.click(canvas.getByRole('button', { name: 'Show cities' }));await body.findByRole('option', { name: 'Paris France' });@@ -31,6 +42,11 @@ export const GroupedObjectInteractions: Story = {expect(body.getByText('Central Europe')).toBeVisible();});await userEvent.type(input, 'li');+ await expect(input).toHaveFocus();+ await expect(getComputedStyle(input).outlineStyle).toBe('none');+ await expect(getComputedStyle(group).borderColor).not.toBe(+ restingBorderColor,+ );const lisbon = await body.findByRole('option', { name: 'Lisbon Portugal' });const berlin = body.getByRole('option', { name: 'Berlin Germany' });await expect(diff --git a/packages/twenty-ui/src/primitives/input/Input/Input.module.scss b/packages/twenty-ui/src/primitives/input/Input/Input.module.scssindex bd22a22c92d..267746aaa78 100644--- a/packages/twenty-ui/src/primitives/input/Input/Input.module.scss+++ b/packages/twenty-ui/src/primitives/input/Input/Input.module.scss@@ -38,14 +38,28 @@cursor: not-allowed;}+ &[data-variant='plain'],&[data-grouped] {- align-self: stretch;background-color: transparent;block-size: auto;border: 0;border-radius: 0;+ padding: 0;++ &:not([data-grouped]) {+ @include focus-ring;++ &[aria-invalid='true'],+ &[data-invalid] {+ outline: 2px solid var(--t-border-color-danger);+ outline-offset: 1px;+ }+ }+ }++ &[data-grouped] {+ align-self: stretch;flex: 1;- padding-inline: 0;}}diff --git a/packages/twenty-ui/src/primitives/input/Input/Input.tsx b/packages/twenty-ui/src/primitives/input/Input/Input.tsxindex abcc7fbd1d6..0fd37ce1921 100644--- a/packages/twenty-ui/src/primitives/input/Input/Input.tsx+++ b/packages/twenty-ui/src/primitives/input/Input/Input.tsx@@ -9,9 +9,16 @@ import { isDefined } from '@ui/utilities/utils/isDefined';import styles from './Input.module.scss';import { type InputProps } from './types/InputProps';-export const Input = ({ size, className, ...props }: InputProps) => {+export const Input = ({+ size,+ variant = 'default',+ className,+ ...props+}: InputProps) => {const inputGroup = useContext(InputGroupContext);const resolvedSize = size ?? inputGroup?.size ?? 'md';+ const isGrouped = isDefined(inputGroup);+ const resolvedVariant = isGrouped ? 'plain' : variant;return (<InputPrimitive@@ -20,7 +27,8 @@ export const Input = ({ size, className, ...props }: InputProps) => {clsx(styles.input, styles[resolvedSize]),className,)}- data-grouped={isDefined(inputGroup) || undefined}+ data-variant={resolvedVariant}+ data-grouped={isGrouped || undefined}/>);};diff --git a/packages/twenty-ui/src/primitives/input/Input/__stories__/InputInteractions.stories.tsx b/packages/twenty-ui/src/primitives/input/Input/__stories__/InputInteractions.stories.tsxindex 8635fd9bb11..e987ec7debc 100644--- a/packages/twenty-ui/src/primitives/input/Input/__stories__/InputInteractions.stories.tsx+++ b/packages/twenty-ui/src/primitives/input/Input/__stories__/InputInteractions.stories.tsx@@ -4,7 +4,7 @@ import { expect, fn, userEvent, within } from 'storybook/test';import { Button } from '@ui/primitives/input/Button/Button';import { Field } from '@ui/primitives/input/Field/Field';-import { ComponentDecorator } from '@ui/testing';+import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';import { Input } from '../Input';import styles from '../Input.module.scss';@@ -129,3 +129,53 @@ export const FieldStates: Story = {await expect(args.onValueChange).not.toHaveBeenCalled();},};++export const PlainAppearance: Story = {+ parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },+ render: () => (+ <div>+ <Input variant="plain" aria-label="Plain name" placeholder="Name" />+ <Field.Root invalid>+ <Input variant="plain" aria-label="Invalid name" />+ <Field.Error match>Choose another name</Field.Error>+ </Field.Root>+ <Input variant="plain" aria-label="Disabled name" disabled />+ <Input aria-label="Framed name" />+ </div>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const plainInput = canvas.getByRole('textbox', { name: 'Plain name' });+ const invalidInput = canvas.getByRole('textbox', { name: 'Invalid name' });+ const disabledInput = canvas.getByRole('textbox', {+ name: 'Disabled name',+ });+ const framedInput = canvas.getByRole('textbox', { name: 'Framed name' });++ await expect(plainInput).toHaveAttribute('data-variant', 'plain');+ await expect(getComputedStyle(plainInput).borderWidth).toBe('0px');+ await expect(getComputedStyle(plainInput).padding).toBe('0px');+ await expect(getComputedStyle(plainInput).borderRadius).toBe('0px');+ await expect(plainInput.clientHeight).toBeLessThan(+ framedInput.clientHeight,+ );++ await userEvent.tab();+ await expect(plainInput).toHaveFocus();+ await expect(getComputedStyle(plainInput).outlineWidth).toBe('2px');+ await expect(getComputedStyle(plainInput).outlineStyle).toBe('solid');+ await userEvent.type(plainInput, 'Alice');+ await expect(plainInput).toHaveValue('Alice');++ await expect(invalidInput).toHaveAttribute('aria-invalid', 'true');+ await expect(invalidInput).toHaveAccessibleDescription(+ 'Choose another name',+ );+ await expect(getComputedStyle(invalidInput).outlineWidth).toBe('2px');+ await expect(getComputedStyle(invalidInput).outlineColor).not.toBe(+ getComputedStyle(plainInput).outlineColor,+ );+ await expect(disabledInput).toBeDisabled();+ await expect(getComputedStyle(disabledInput).cursor).toBe('not-allowed');+ },+};diff --git a/packages/twenty-ui/src/primitives/input/Input/types/InputProps.ts b/packages/twenty-ui/src/primitives/input/Input/types/InputProps.tsindex 24794ab12cf..4cd5fbca894 100644--- a/packages/twenty-ui/src/primitives/input/Input/types/InputProps.ts+++ b/packages/twenty-ui/src/primitives/input/Input/types/InputProps.ts@@ -1,7 +1,9 @@import { type Input as InputPrimitive } from '@base-ui/react/input';import { type InputSize } from '@ui/primitives/input/types/InputSize';+import { type InputVariant } from '@ui/primitives/input/types/InputVariant';export type InputProps = Omit<InputPrimitive.Props, 'size'> & {size?: InputSize;+ variant?: InputVariant;};diff --git a/packages/twenty-ui/src/primitives/input/InputGroup/__stories__/InputGroup.stories.tsx b/packages/twenty-ui/src/primitives/input/InputGroup/__stories__/InputGroup.stories.tsxindex dbc6e8339ba..21664655815 100644--- a/packages/twenty-ui/src/primitives/input/InputGroup/__stories__/InputGroup.stories.tsx+++ b/packages/twenty-ui/src/primitives/input/InputGroup/__stories__/InputGroup.stories.tsx@@ -2,7 +2,7 @@ import { Text } from '@ui/primitives/typography';import { type ComponentProps } from 'react';import { Field } from '@ui/primitives/input';import { type Meta, type StoryObj } from '@storybook/react-vite';-import { expect, within } from 'storybook/test';+import { expect, userEvent, within } from 'storybook/test';import {A11Y_DEFER_COLOR_CONTRAST,@@ -167,3 +167,41 @@ export const CatalogDark: CatalogStory<Story, typeof InputGroup> = {tags: ['!autodocs'],globals: { colorScheme: 'dark' },};++export const SharedPlainFrame: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <>+ <InputGroup size="sm" role="group" aria-label="Compact frame">+ <Input variant="plain" aria-label="Compact input" />+ </InputGroup>+ <Field.Root invalid>+ <InputGroup role="group" aria-label="Invalid frame">+ <Input aria-label="Invalid grouped input" />+ </InputGroup>+ </Field.Root>+ </>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const group = canvas.getByRole('group', { name: 'Compact frame' });+ const input = canvas.getByRole('textbox', { name: 'Compact input' });+ const invalidGroup = canvas.getByRole('group', { name: 'Invalid frame' });+ const invalidInput = canvas.getByRole('textbox', {+ name: 'Invalid grouped input',+ });++ await expect(group.getBoundingClientRect().height).toBe(24);+ await expect(invalidGroup.getBoundingClientRect().height).toBe(32);+ await expect(input).toHaveAttribute('data-variant', 'plain');+ await expect(getComputedStyle(input).borderWidth).toBe('0px');+ await userEvent.tab();+ await expect(input).toHaveFocus();+ await expect(getComputedStyle(input).outlineStyle).toBe('none');+ await expect(getComputedStyle(invalidInput).outlineStyle).toBe('none');+ await expect(getComputedStyle(group).borderWidth).toBe('1px');+ await expect(getComputedStyle(invalidGroup).borderColor).not.toBe(+ getComputedStyle(group).borderColor,+ );+ },+};diff --git a/packages/twenty-ui/src/primitives/input/Textarea/Textarea.module.scss b/packages/twenty-ui/src/primitives/input/Textarea/Textarea.module.scssindex cc221b7102f..2d784e4124f 100644--- a/packages/twenty-ui/src/primitives/input/Textarea/Textarea.module.scss+++ b/packages/twenty-ui/src/primitives/input/Textarea/Textarea.module.scss@@ -1,6 +1,7 @@.textarea {--tw-textarea-border-color: var(--t-border-color-medium);--tw-textarea-padding-block: var(--t-spacing-2);+ --tw-textarea-border-block-size: 2px;appearance: none;background-color: var(--t-background-transparent-lighter);@@ -16,7 +17,7 @@margin: 0;max-block-size: calc(var(--tw-textarea-max-rows) * 1lh + 2 * var(--tw-textarea-padding-block) +- 2px+ var(--tw-textarea-border-block-size));outline: none;overflow: auto;@@ -42,6 +43,25 @@color: var(--t-font-color-tertiary);cursor: not-allowed;}++ &[data-variant='plain'] {+ --tw-textarea-padding-block: 0px;+ --tw-textarea-border-block-size: 0px;++ @include focus-ring;++ background-color: transparent;+ block-size: auto;+ border: 0;+ border-radius: 0;+ padding: 0;++ &[aria-invalid='true'],+ &[data-invalid] {+ outline: 2px solid var(--t-border-color-danger);+ outline-offset: 1px;+ }+ }}.sm {diff --git a/packages/twenty-ui/src/primitives/input/Textarea/Textarea.tsx b/packages/twenty-ui/src/primitives/input/Textarea/Textarea.tsxindex 55b5ffceb2a..02a0559ab21 100644--- a/packages/twenty-ui/src/primitives/input/Textarea/Textarea.tsx+++ b/packages/twenty-ui/src/primitives/input/Textarea/Textarea.tsx@@ -1,27 +1,20 @@import { Input as InputPrimitive } from '@base-ui/react/input';import { clsx } from 'clsx';-import {- type ChangeEvent,- type CSSProperties,- useLayoutEffect,- useMemo,- useRef,- useState,-} from 'react';+import { type ChangeEvent, type CSSProperties, useMemo, useState } from 'react';import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';import { isDefined } from '@ui/utilities/utils/isDefined';import { TextareaControl } from './internal/TextareaControl';-import { formatInlineBlockSize } from './internal/formatInlineBlockSize';+import { TextareaAutoResizeEffect } from './internal/TextareaAutoResizeEffect';import { mergeRefs } from './internal/mergeRefs';-import { observeTextareaWidth } from './internal/observeTextareaWidth';import { resizeTextareaToContent } from './internal/resizeTextareaToContent';import styles from './Textarea.module.scss';import { type TextareaProps } from './types/TextareaProps';export const Textarea = ({size = 'md',+ variant = 'default',autoResize = false,maxRows,className,@@ -37,52 +30,6 @@ export const Textarea = ({const mergedRef = useMemo(() => mergeRefs(ref, setTextarea), [ref]);const isControlled = isDefined(value);const consumerBlockSize = style?.blockSize;- const wasAutoResize = useRef(false);-- useLayoutEffect(() => {- if (!isDefined(textarea)) {- return;- }-- const shouldRestoreBlockSize = wasAutoResize.current;- wasAutoResize.current = autoResize;-- if (autoResize) {- resizeTextareaToContent(textarea);- return;- }-- if (shouldRestoreBlockSize) {- textarea.style.blockSize = formatInlineBlockSize(consumerBlockSize);- }- }, [textarea, autoResize, value, maxRows, rows, size, consumerBlockSize]);-- useLayoutEffect(() => {- if (!autoResize || !isDefined(textarea)) {- return;- }-- let isActive = true;- const handleReset = (event: Event) => {- requestAnimationFrame(() => {- if (isActive && !event.defaultPrevented) {- resizeTextareaToContent(textarea);- }- });- };-- const form = textarea.form;- const stopObservingWidth = observeTextareaWidth(textarea);-- form?.addEventListener('reset', handleReset);-- return () => {- isActive = false;- form?.removeEventListener('reset', handleReset);- stopObservingWidth?.();- };- }, [textarea, autoResize, props.form]);-const handleChange = (event: ChangeEvent<HTMLTextAreaElement>) => {if (autoResize && !isControlled) {resizeTextareaToContent(event.currentTarget);@@ -117,28 +64,42 @@ export const Textarea = ({};return (- <InputPrimitive- {...controlProps}- render={(elementProps, state) => (- <TextareaControl- controlProps={elementProps}- nativeProps={{- ...nativeProps,- rows,- onChange: handleChange,- ref: mergedRef,- }}- state={state}- render={render}- />- )}- value={value}- className={mergeClassNames(- clsx(styles.textarea, styles[size]),- className,- )}- style={resolvedStyle}- data-auto-resize={autoResize || undefined}- />+ <>+ <InputPrimitive+ {...controlProps}+ render={(elementProps, state) => (+ <TextareaControl+ controlProps={elementProps}+ nativeProps={{+ ...nativeProps,+ rows,+ onChange: handleChange,+ ref: mergedRef,+ }}+ state={state}+ render={render}+ />+ )}+ value={value}+ className={mergeClassNames(+ clsx(styles.textarea, styles[size]),+ className,+ )}+ style={resolvedStyle}+ data-auto-resize={autoResize || undefined}+ data-variant={variant}+ />+ <TextareaAutoResizeEffect+ textarea={textarea}+ autoResize={autoResize}+ value={value}+ maxRows={maxRows}+ rows={rows}+ size={size}+ variant={variant}+ consumerBlockSize={consumerBlockSize}+ form={props.form}+ />+ </>);};diff --git a/packages/twenty-ui/src/primitives/input/Textarea/__stories__/TextareaPlain.stories.tsx b/packages/twenty-ui/src/primitives/input/Textarea/__stories__/TextareaPlain.stories.tsxnew file mode 100644index 00000000000..9f69e74e7fa--- /dev/null+++ b/packages/twenty-ui/src/primitives/input/Textarea/__stories__/TextareaPlain.stories.tsx@@ -0,0 +1,109 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { useState } from 'react';+import { expect, userEvent, waitFor, within } from 'storybook/test';++import { Button } from '@ui/primitives/input/Button/Button';+import { type InputVariant } from '@ui/primitives/input/types/InputVariant';+import { ComponentDecorator } from '@ui/testing';++import { Textarea } from '../Textarea';+import { type TextareaProps } from '../types/TextareaProps';++const PlainTextareaResizeExample = ({+ variant: initialVariant = 'default',+ maxRows: initialMaxRows,+ ...props+}: TextareaProps) => {+ const [variant, setVariant] = useState<InputVariant>(initialVariant);+ const [maxRows, setMaxRows] = useState(initialMaxRows);++ return (+ <form>+ <Textarea+ // oxlint-disable-next-line react/jsx-props-no-spreading+ {...props}+ variant={variant}+ maxRows={maxRows}+ autoResize+ rows={1}+ />+ <Button type="button" onClick={() => setVariant('plain')}>+ Use plain appearance+ </Button>+ <Button type="button" onClick={() => setVariant('default')}>+ Use default appearance+ </Button>+ <Button type="button" onClick={() => setMaxRows(6)}>+ Expand row limit+ </Button>+ </form>+ );+};++const meta: Meta<typeof Textarea> = {+ title: 'UI/Input/Textarea/Plain',+ component: Textarea,+ tags: ['!autodocs'],+ decorators: [ComponentDecorator],+ parameters: { container: { width: 240 } },+ args: { 'aria-label': 'Notes' },+ render: (args) => <PlainTextareaResizeExample {...args} />,+};++export default meta;+type Story = StoryObj<typeof Textarea>;++export const VariantChange: Story = {+ args: { defaultValue: 'First\nSecond', maxRows: 2 },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const textarea = canvas.getByRole('textbox', { name: 'Notes' });+ const framedHeight = textarea.getBoundingClientRect().height;++ await userEvent.click(+ canvas.getByRole('button', { name: 'Use plain appearance' }),+ );+ await waitFor(() =>+ expect(textarea.getBoundingClientRect().height).toBeLessThan(+ framedHeight,+ ),+ );+ await expect(textarea).toHaveValue('First\nSecond');+ await expect(getComputedStyle(textarea).padding).toBe('0px');+ await expect(getComputedStyle(textarea).borderWidth).toBe('0px');+ await expect(textarea.clientHeight).toBe(+ 2 * Number.parseFloat(getComputedStyle(textarea).lineHeight),+ );+ await userEvent.click(+ canvas.getByRole('button', { name: 'Use default appearance' }),+ );+ await waitFor(() =>+ expect(textarea.getBoundingClientRect().height).toBe(framedHeight),+ );+ },+};++export const PlainMaximumRows: Story = {+ args: {+ variant: 'plain',+ defaultValue: 'First\nSecond\nThird\nFourth',+ maxRows: 2,+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const textarea = canvas.getByRole('textbox', { name: 'Notes' });+ const lineHeight = Number.parseFloat(getComputedStyle(textarea).lineHeight);++ await expect(textarea.clientHeight).toBe(2 * lineHeight);+ await expect(textarea.scrollHeight).toBeGreaterThan(textarea.clientHeight);+ await userEvent.type(textarea, '{enter}Fifth');+ await expect(textarea.clientHeight).toBe(2 * lineHeight);+ await userEvent.click(+ canvas.getByRole('button', { name: 'Expand row limit' }),+ );+ await waitFor(() =>+ expect(textarea.clientHeight).toBeGreaterThan(2 * lineHeight),+ );+ await expect(textarea.clientHeight).toBeLessThanOrEqual(6 * lineHeight);+ },+};diff --git a/packages/twenty-ui/src/primitives/input/Textarea/internal/TextareaAutoResizeEffect.tsx b/packages/twenty-ui/src/primitives/input/Textarea/internal/TextareaAutoResizeEffect.tsxnew file mode 100644index 00000000000..8fb2244fbcf--- /dev/null+++ b/packages/twenty-ui/src/primitives/input/Textarea/internal/TextareaAutoResizeEffect.tsx@@ -0,0 +1,85 @@+import { type CSSProperties, useLayoutEffect, useRef } from 'react';++import { isDefined } from '@ui/utilities/utils/isDefined';++import { type TextareaProps } from '../types/TextareaProps';+import { formatInlineBlockSize } from './formatInlineBlockSize';+import { observeTextareaWidth } from './observeTextareaWidth';+import { resizeTextareaToContent } from './resizeTextareaToContent';++type TextareaAutoResizeEffectProps = Pick<+ TextareaProps,+ 'autoResize' | 'value' | 'maxRows' | 'rows' | 'size' | 'variant' | 'form'+> & {+ textarea: HTMLTextAreaElement | null;+ consumerBlockSize: CSSProperties['blockSize'];+};++export const TextareaAutoResizeEffect = ({+ textarea,+ autoResize,+ value,+ maxRows,+ rows,+ size,+ variant,+ consumerBlockSize,+ form,+}: TextareaAutoResizeEffectProps) => {+ const wasAutoResize = useRef(false);++ useLayoutEffect(() => {+ if (!isDefined(textarea)) {+ return;+ }++ const shouldRestoreBlockSize = wasAutoResize.current;+ wasAutoResize.current = autoResize ?? false;++ if (autoResize) {+ resizeTextareaToContent(textarea);+ return;+ }++ if (shouldRestoreBlockSize) {+ textarea.style.blockSize = formatInlineBlockSize(consumerBlockSize);+ }+ }, [+ textarea,+ autoResize,+ value,+ maxRows,+ rows,+ size,+ variant,+ consumerBlockSize,+ ]);++ useLayoutEffect(() => {+ if (!autoResize || !isDefined(textarea)) {+ return;+ }++ let isActive = true;+ const handleReset = (event: Event) => {+ requestAnimationFrame(() => {+ if (isActive && !event.defaultPrevented) {+ resizeTextareaToContent(textarea);+ }+ });+ };++ const textareaForm = textarea.form;+ const stopObservingWidth = observeTextareaWidth(textarea);++ textareaForm?.addEventListener('reset', handleReset);++ return () => {+ isActive = false;+ textareaForm?.removeEventListener('reset', handleReset);+ stopObservingWidth?.();+ };+ }, [textarea, autoResize, form]);++ return null;+};diff --git a/packages/twenty-ui/src/primitives/input/Textarea/types/TextareaProps.ts b/packages/twenty-ui/src/primitives/input/Textarea/types/TextareaProps.tsindex 01d0534c620..81e643d3c81 100644--- a/packages/twenty-ui/src/primitives/input/Textarea/types/TextareaProps.ts+++ b/packages/twenty-ui/src/primitives/input/Textarea/types/TextareaProps.ts@@ -2,6 +2,7 @@ import { type Input as InputPrimitive } from '@base-ui/react/input';import { type useRender } from '@base-ui/react/use-render';import { type InputSize } from '@ui/primitives/input/types/InputSize';+import { type InputVariant } from '@ui/primitives/input/types/InputVariant';export type TextareaProps = Omit<useRender.ComponentProps<@@ -22,6 +23,7 @@ export type TextareaProps = Omit<) => void;/** Visual size of the textarea. */size?: InputSize;+ variant?: InputVariant;autoResize?: boolean;maxRows?: number;};diff --git a/packages/twenty-ui/src/primitives/input/index.ts b/packages/twenty-ui/src/primitives/input/index.tsindex 2a5b1e701c0..3a3f5edb715 100644--- a/packages/twenty-ui/src/primitives/input/index.ts+++ b/packages/twenty-ui/src/primitives/input/index.ts@@ -173,4 +173,5 @@ export type { SwitchThumbProps } from './Switch/types/SwitchThumbProps';export { Textarea } from './Textarea/Textarea';export type { TextareaProps } from './Textarea/types/TextareaProps';export type { InputSize } from './types/InputSize';+export type { InputVariant } from './types/InputVariant';export type { SelectOption } from './types/SelectOption';diff --git a/packages/twenty-ui/src/primitives/input/types/InputVariant.ts b/packages/twenty-ui/src/primitives/input/types/InputVariant.tsnew file mode 100644index 00000000000..668fef6873d--- /dev/null+++ b/packages/twenty-ui/src/primitives/input/types/InputVariant.ts@@ -0,0 +1 @@+export type InputVariant = 'default' | 'plain';