The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Add Select compound to twenty-ui (#25625)
Raphaël Bosi37ca4b1bacfb
diff --git a/packages/twenty-ui/src/input/Select/Select.module.scss b/packages/twenty-ui/src/input/Select/Select.module.scssnew file mode 100644index 00000000000..640d80a7872--- /dev/null+++ b/packages/twenty-ui/src/input/Select/Select.module.scss@@ -0,0 +1,102 @@+.trigger {+ align-items: center;+ box-sizing: border-box;+ cursor: pointer;+ display: inline-flex;+ gap: var(--t-spacing-2);+ text-align: start;++ &[data-popup-open] {+ --tw-input-border-color: var(--t-color-blue);+ }++ &[data-placeholder] .value {+ color: var(--t-font-color-light);+ }++ &[aria-invalid='true'],+ &[data-invalid] {+ --tw-input-border-color: var(--t-border-color-danger);+ }++ &[data-disabled] {+ color: var(--t-font-color-tertiary);+ cursor: not-allowed;+ }+}++.value {+ flex: 1;+ min-inline-size: 0;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}++.icon {+ align-items: center;+ display: inline-flex;+ flex: none;++ > svg {+ block-size: calc(var(--t-icon-size-md) * 1px);+ inline-size: calc(var(--t-icon-size-md) * 1px);+ stroke-width: var(--t-icon-stroke-sm);+ }+}++.positioner {+ z-index: var(--t-last-layer-z-index);+}++.popup {+ backdrop-filter: var(--t-blur-medium);+ background: var(--t-background-transparent-primary);+ border: 1px solid var(--t-border-color-medium);+ border-radius: var(--t-border-radius-md);+ box-shadow: var(--t-box-shadow-strong);+ box-sizing: border-box;+ color: var(--t-font-color-primary);+ min-inline-size: var(--anchor-width);+ max-inline-size: var(--available-width);+ max-block-size: var(--available-height);+ margin: 0;+ outline: none;+ overflow: auto;+ overscroll-behavior: contain;+ padding: var(--t-spacing-1);+ transition: opacity duration(fast) ease-out;++ &[data-starting-style],+ &[data-ending-style] {+ opacity: 0;+ }++ &[data-ending-style] {+ transition-timing-function: ease-in;+ }+}++.item {+ box-sizing: border-box;+}++.indicator {+ align-items: center;+ display: inline-flex;+ flex: none;+}++.groupLabel {+ color: var(--t-font-color-secondary);+ font-family: var(--t-font-family);+ font-size: var(--t-font-size-sm);+ font-weight: var(--t-font-weight-medium);+ padding: var(--t-spacing-1);+}++.separator {+ background: var(--t-border-color-light);+ block-size: 1px;+ margin-block: var(--t-spacing-1);+}diff --git a/packages/twenty-ui/src/input/Select/Select.module.scss.d.ts b/packages/twenty-ui/src/input/Select/Select.module.scss.d.tsnew file mode 100644index 00000000000..3b055755a91--- /dev/null+++ b/packages/twenty-ui/src/input/Select/Select.module.scss.d.ts@@ -0,0 +1,12 @@+declare const classNames: {+ readonly trigger: 'trigger';+ readonly value: 'value';+ readonly icon: 'icon';+ readonly positioner: 'positioner';+ readonly popup: 'popup';+ readonly item: 'item';+ readonly indicator: 'indicator';+ readonly groupLabel: 'groupLabel';+ readonly separator: 'separator';+};+export default classNames;diff --git a/packages/twenty-ui/src/input/Select/Select.tsx b/packages/twenty-ui/src/input/Select/Select.tsxnew file mode 100644index 00000000000..2a098176dbb--- /dev/null+++ b/packages/twenty-ui/src/input/Select/Select.tsx@@ -0,0 +1,22 @@+import { Select as SelectPrimitive } from '@base-ui/react/select';++import { SelectGroupLabel } from './internal/SelectGroupLabel';+import { SelectItem } from './internal/SelectItem';+import { SelectPopup } from './internal/SelectPopup';+import { SelectSeparator } from './internal/SelectSeparator';+import { SelectTrigger } from './internal/SelectTrigger';+import { SelectValue } from './internal/SelectValue';++const createSelect = () => ({+ Root: SelectPrimitive.Root,+ Trigger: SelectTrigger,+ Value: SelectValue,+ Popup: SelectPopup,+ Item: SelectItem,+ Group: SelectPrimitive.Group,+ GroupLabel: SelectGroupLabel,+ Separator: SelectSeparator,+});++// Base UI namespace reads would otherwise retain Select in unrelated imports.+export const Select = /* @__PURE__ */ createSelect();diff --git a/packages/twenty-ui/src/input/Select/__stories__/Select.interactions.stories.tsx b/packages/twenty-ui/src/input/Select/__stories__/Select.interactions.stories.tsxnew file mode 100644index 00000000000..93c0c49aa65--- /dev/null+++ b/packages/twenty-ui/src/input/Select/__stories__/Select.interactions.stories.tsx@@ -0,0 +1,504 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { useState } from 'react';+import { expect, fn, userEvent, waitFor, within } from 'storybook/test';++import { IconCheck } from '@ui/icon';+import { Field } from '@ui/input/Field/Field';+import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';++import { Select } from '../Select';+import { type SelectRootProps } from '../types/SelectRootProps';+import { SelectExample, SELECT_ITEMS } from './SelectExample';+import { waitForSelectPopup } from './waitForSelectPopup';++const meta: Meta<typeof SelectExample> = {+ title: 'UI/Input/Select/Interactions',+ component: SelectExample,+ parameters: { container: { width: 280, height: 240 } },+};++export default meta;+type Story = StoryObj<typeof SelectExample>;++export const Keyboard: Story = {+ decorators: [ComponentDecorator],+ args: { defaultValue: 'apple', onValueChange: fn() },+ play: async ({ canvasElement, args }) => {+ const trigger = within(canvasElement).getByRole('combobox');+ await userEvent.tab();+ await expect(trigger).toHaveFocus();+ await userEvent.keyboard('{ArrowDown}');+ const popup = await waitForSelectPopup(canvasElement);+ const options = within(popup);+ await waitFor(() =>+ expect(options.getByRole('option', { name: 'Apple' })).toHaveFocus(),+ );+ await userEvent.keyboard('{ArrowDown}');+ await expect(options.getByRole('option', { name: 'Banana' })).toHaveFocus();+ await userEvent.keyboard('{Enter}');+ await expect(args.onValueChange).not.toHaveBeenCalled();+ await userEvent.keyboard('{ArrowDown}');+ await expect(options.getByRole('option', { name: 'Cherry' })).toHaveFocus();+ await userEvent.keyboard('{End}');+ await expect(+ options.getByRole('option', { name: 'Dragon fruit' }),+ ).toHaveFocus();+ await userEvent.keyboard('{Home}');+ await expect(options.getByRole('option', { name: 'Apple' })).toHaveFocus();+ await userEvent.keyboard('c');+ await expect(options.getByRole('option', { name: 'Cherry' })).toHaveFocus();+ await userEvent.keyboard('{Enter}');+ await waitFor(() => expect(popup).not.toBeVisible());+ await expect(trigger).toHaveTextContent('Cherry');+ await expect(trigger).toHaveFocus();+ await userEvent.keyboard(' ');+ await waitForSelectPopup(canvasElement);+ await userEvent.keyboard('{Escape}');+ await waitFor(() =>+ expect(trigger).toHaveAttribute('aria-expanded', 'false'),+ );+ await expect(trigger).toHaveTextContent('Cherry');+ await waitFor(() => expect(trigger).toHaveFocus());+ },+};++export const DisabledItem: Story = {+ decorators: [ComponentDecorator],+ args: { defaultValue: 'apple', onValueChange: fn() },+ play: async ({ canvasElement, args }) => {+ const trigger = within(canvasElement).getByRole('combobox');+ await userEvent.click(trigger);+ const popup = await waitForSelectPopup(canvasElement);+ const disabled = within(popup).getByRole('option', { name: 'Banana' });+ await expect(disabled).toHaveAttribute('aria-disabled', 'true');+ await userEvent.click(disabled);+ await expect(args.onValueChange).not.toHaveBeenCalled();+ await expect(trigger).toHaveTextContent('Apple');+ await expect(popup).toBeVisible();+ },+};++export const Disabled: Story = {+ decorators: [ComponentDecorator],+ args: {+ disabled: true,+ defaultValue: 'apple',+ onOpenChange: fn(),+ onValueChange: fn(),+ },+ play: async ({ canvasElement, args }) => {+ const trigger = within(canvasElement).getByRole('combobox');+ await expect(trigger).toBeDisabled();+ await userEvent.click(trigger);+ await userEvent.tab();+ await expect(trigger).not.toHaveFocus();+ await expect(args.onOpenChange).not.toHaveBeenCalled();+ await expect(args.onValueChange).not.toHaveBeenCalled();+ },+};++export const ReadOnly: Story = {+ decorators: [ComponentDecorator],+ args: { readOnly: true, defaultValue: 'apple', onValueChange: fn() },+ play: async ({ canvasElement, args }) => {+ const trigger = within(canvasElement).getByRole('combobox');+ await expect(trigger).toHaveAttribute('aria-readonly', 'true');+ await userEvent.click(trigger);+ const popup = await waitForSelectPopup(canvasElement);+ await userEvent.click(+ within(popup).getByRole('option', { name: 'Cherry' }),+ );+ await userEvent.keyboard('{End}{Enter}');+ await expect(trigger).toHaveTextContent('Apple');+ await expect(args.onValueChange).not.toHaveBeenCalled();+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(popup).not.toBeVisible());+ },+};++const ControlledSelectExample = (props: SelectRootProps<string, boolean>) => {+ const [value, setValue] = useState<string | null>('apple');++ return (+ <>+ <SelectExample {...props} value={value} modal={false} />+ <button type="button" onClick={() => setValue('cherry')}>+ Apply Cherry+ </button>+ </>+ );+};++export const ControlledValue: Story = {+ decorators: [ComponentDecorator],+ args: { onValueChange: fn() },+ render: (args) => (+ <ControlledSelectExample onValueChange={args.onValueChange} />+ ),+ play: async ({ canvasElement, args }) => {+ const canvas = within(canvasElement);+ const trigger = canvas.getByRole('combobox');+ await userEvent.click(trigger);+ const popup = await waitForSelectPopup(canvasElement);+ await userEvent.click(+ within(popup).getByRole('option', { name: 'Cherry' }),+ );+ await expect(args.onValueChange).toHaveBeenCalledWith(+ 'cherry',+ expect.anything(),+ );+ await waitFor(() => expect(popup).not.toBeVisible());+ await expect(trigger).toHaveTextContent('Apple');+ await userEvent.click(canvas.getByRole('button', { name: 'Apply Cherry' }));+ await expect(trigger).toHaveTextContent('Cherry');+ },+};++const ControlledOpenExample = (props: SelectRootProps<string, boolean>) => {+ const [open, setOpen] = useState(true);++ return (+ <>+ <SelectExample+ {...props}+ defaultValue="apple"+ open={open}+ modal={false}+ />+ <button type="button" onClick={() => setOpen(false)}>+ Apply closed state+ </button>+ </>+ );+};++export const ControlledOpen: Story = {+ decorators: [ComponentDecorator],+ args: { onOpenChange: fn() },+ render: (args) => <ControlledOpenExample onOpenChange={args.onOpenChange} />,+ play: async ({ canvasElement, args }) => {+ const popup = await waitForSelectPopup(canvasElement);+ await userEvent.click(+ within(popup).getByRole('option', { name: 'Cherry' }),+ );+ await expect(args.onOpenChange).toHaveBeenCalledWith(+ false,+ expect.anything(),+ );+ await expect(popup).toBeVisible();+ await userEvent.click(+ within(canvasElement).getByRole('button', { name: 'Apply closed state' }),+ );+ await waitFor(() => expect(popup).not.toBeVisible());+ },+};++export const MultipleKeyboard: Story = {+ decorators: [ComponentDecorator],+ args: { multiple: true, defaultValue: ['apple'], onValueChange: fn() },+ play: async ({ canvasElement, args }) => {+ await userEvent.tab();+ await userEvent.keyboard('{Enter}');+ const popup = await waitForSelectPopup(canvasElement);+ await userEvent.keyboard('{End} ');+ await expect(+ within(popup).getByRole('option', { name: 'Dragon fruit' }),+ ).toHaveAttribute('aria-selected', 'true');+ await expect(args.onValueChange).toHaveBeenLastCalledWith(+ ['apple', 'dragon-fruit'],+ expect.anything(),+ );+ await userEvent.keyboard(' ');+ await expect(args.onValueChange).toHaveBeenLastCalledWith(+ ['apple'],+ expect.anything(),+ );+ await expect(popup).toBeVisible();+ },+};++export const ObjectValues: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <Select.Root+ defaultValue={{ id: 1, name: 'Ada' }}+ itemToStringLabel={(person) => person.name}+ itemToStringValue={(person) => String(person.id)}+ isItemEqualToValue={(person, value) => person.id === value.id}+ >+ <Select.Trigger aria-label="Owner">+ <Select.Value />+ </Select.Trigger>+ <Select.Popup>+ <Select.Item value={{ id: 1, name: 'Ada' }}>Ada</Select.Item>+ <Select.Item value={{ id: 2, name: 'Grace' }}>Grace</Select.Item>+ </Select.Popup>+ </Select.Root>+ ),+ play: async ({ canvasElement }) => {+ const trigger = within(canvasElement).getByRole('combobox', {+ name: 'Owner',+ });+ await expect(trigger).toHaveTextContent('Ada');+ await userEvent.click(trigger);+ const popup = await waitForSelectPopup(canvasElement);+ await expect(+ within(popup).getByRole('option', { name: 'Ada' }),+ ).toHaveAttribute('aria-selected', 'true');+ await userEvent.click(within(popup).getByRole('option', { name: 'Grace' }));+ await waitFor(() => expect(popup).not.toBeVisible());+ await expect(trigger).toHaveTextContent('Grace');+ },+};++const SelectFormExample = () => {+ const [submitted, setSubmitted] = useState('');++ return (+ <form+ onSubmit={(event) => {+ event.preventDefault();+ setSubmitted(+ new FormData(event.currentTarget).getAll('fruit').join(', '),+ );+ }}+ >+ <Field.Root name="fruit">+ <Field.Label>Fruit</Field.Label>+ <Select.Root+ name="fruit"+ items={SELECT_ITEMS}+ multiple+ defaultValue={['apple']}+ >+ <Select.Trigger>+ <Select.Value />+ </Select.Trigger>+ <Select.Popup>+ {SELECT_ITEMS.map(({ value, label }) => (+ <Select.Item key={value} value={value}>+ {label}+ </Select.Item>+ ))}+ </Select.Popup>+ </Select.Root>+ <Field.Description>Choose fruit for delivery</Field.Description>+ </Field.Root>+ <button type="submit">Submit</button>+ <output aria-label="Submitted fruit">{submitted}</output>+ </form>+ );+};++export const Form: Story = {+ decorators: [ComponentDecorator],+ parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },+ render: () => <SelectFormExample />,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const trigger = canvas.getByRole('combobox', {+ name: 'Fruit',+ description: 'Choose fruit for delivery',+ });+ await userEvent.click(trigger);+ const popup = await waitForSelectPopup(canvasElement);+ await userEvent.click(+ within(popup).getByRole('option', { name: 'Cherry' }),+ );+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(popup).not.toBeVisible());+ await userEvent.click(canvas.getByRole('button', { name: 'Submit' }));+ await expect(+ canvas.getByRole('status', { name: 'Submitted fruit' }),+ ).toHaveTextContent('apple, cherry');+ },+};++export const PolymorphismAndState: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <Select.Root items={SELECT_ITEMS} defaultValue="apple">+ <Select.Trigger aria-label="Fruit" nativeButton={false} render={<div />}>+ <Select.Value />+ </Select.Trigger>+ <Select.Popup+ render={(props, state) => (+ <ul {...props} data-open-state={state.open} />+ )}+ >+ <Select.Item+ value="apple"+ render={<li />}+ startIcon={<IconCheck />}+ endIcon={<IconCheck />}+ >+ Apple+ </Select.Item>+ <Select.Item+ value="cherry"+ className={({ selected }) =>+ selected ? 'selected-consumer' : 'consumer'+ }+ style={({ highlighted }) => ({ outlineOffset: highlighted ? 7 : 3 })}+ render={(props, state) => (+ <li {...props} data-selected-state={state.selected} />+ )}+ >+ Cherry+ </Select.Item>+ </Select.Popup>+ </Select.Root>+ ),+ play: async ({ canvasElement }) => {+ const trigger = within(canvasElement).getByRole('combobox');+ await expect(trigger.tagName).toBe('DIV');+ await userEvent.click(trigger);+ const popup = await waitForSelectPopup(canvasElement);+ await expect(popup.tagName).toBe('UL');+ await expect(popup).toHaveAttribute('data-open-state', 'true');+ const cherry = within(popup).getByRole('option', { name: 'Cherry' });+ await expect(cherry.tagName).toBe('LI');+ await expect(cherry).toHaveClass('consumer');+ await userEvent.hover(cherry);+ await waitFor(() => expect(cherry).toHaveStyle({ outlineOffset: '7px' }));+ await userEvent.click(cherry);+ await waitFor(() => expect(popup).not.toBeVisible());+ await userEvent.click(trigger);+ const reopened = await waitForSelectPopup(canvasElement);+ await expect(+ within(reopened).getByRole('option', { name: 'Cherry' }),+ ).toHaveClass('selected-consumer');+ await expect(+ within(reopened).getByRole('option', { name: 'Cherry' }),+ ).toHaveAttribute('data-selected-state', 'true');+ },+};++export const SlotsAndTypeahead: Story = {+ decorators: [ComponentDecorator],+ parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },+ render: () => (+ <Select.Root items={SELECT_ITEMS} defaultValue="cherry">+ <Select.Trigger aria-label="Fruit">+ <Select.Value />+ </Select.Trigger>+ <Select.Popup>+ <Select.Item+ value="apple"+ description="Cherry alternative"+ descriptionPlacement="end"+ startIcon={<IconCheck />}+ >+ Apple+ </Select.Item>+ <Select.Item+ value="cherry"+ description="Seasonal"+ endIcon={<IconCheck />}+ >+ Cherry+ </Select.Item>+ </Select.Popup>+ </Select.Root>+ ),+ play: async ({ canvasElement }) => {+ const trigger = within(canvasElement).getByRole('combobox');+ await userEvent.tab();+ await userEvent.keyboard('{Enter}');+ const popup = await waitForSelectPopup(canvasElement);+ const apple = within(popup).getByRole('option', {+ name: 'Apple Cherry alternative',+ });+ const cherry = within(popup).getByRole('option', {+ name: 'Cherry Seasonal',+ });+ await expect(apple).toHaveTextContent('Cherry alternative');+ await expect(cherry).toHaveTextContent('Seasonal');+ await userEvent.keyboard('{End}');+ await userEvent.keyboard('c');+ await expect(cherry).toHaveFocus();+ await userEvent.keyboard('{Enter}');+ await waitFor(() => expect(popup).not.toBeVisible());+ await expect(trigger).toHaveTextContent(/^Cherry$/);+ },+};++const ControlledMultipleExample = () => {+ const [value, setValue] = useState<string[]>(['apple']);++ return (+ <>+ <Select.Root+ multiple+ value={value}+ onValueChange={setValue}+ items={SELECT_ITEMS}+ >+ <Select.Trigger aria-label="Fruit">+ <Select.Value />+ </Select.Trigger>+ <Select.Popup>+ {SELECT_ITEMS.map(({ value: itemValue, label }) => (+ <Select.Item key={itemValue} value={itemValue}>+ {label}+ </Select.Item>+ ))}+ </Select.Popup>+ </Select.Root>+ <output aria-label="Selected values">{value.join(', ')}</output>+ </>+ );+};++export const ControlledMultiple: Story = {+ decorators: [ComponentDecorator],+ render: () => <ControlledMultipleExample />,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(canvas.getByRole('combobox'));+ const popup = await waitForSelectPopup(canvasElement);+ await userEvent.click(+ within(popup).getByRole('option', { name: 'Cherry' }),+ );+ await expect(+ canvas.getByRole('status', { name: 'Selected values', hidden: true }),+ ).toHaveTextContent('apple, cherry');+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(popup).not.toBeVisible());+ await expect(canvas.getByRole('combobox')).toHaveTextContent(+ 'Apple, Cherry',+ );+ },+};++export const ClosedTypeahead: Story = {+ decorators: [ComponentDecorator],+ args: { defaultValue: 'apple' },+ play: async ({ canvasElement }) => {+ const trigger = within(canvasElement).getByRole('combobox');+ await userEvent.tab();+ await userEvent.keyboard('c');+ await expect(trigger).toHaveTextContent('Cherry');+ await expect(trigger).toHaveAttribute('aria-expanded', 'false');+ },+};++export const Invalid: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <Field.Root invalid>+ <SelectExample defaultValue="apple" />+ </Field.Root>+ ),+ play: async ({ canvasElement }) => {+ const trigger = within(canvasElement).getByRole('combobox');+ await expect(trigger).toHaveAttribute('data-invalid');+ await expect(trigger).toHaveAttribute('aria-invalid', 'true');+ const invalidBorderColor = getComputedStyle(trigger).borderColor;+ await userEvent.click(trigger);+ await waitForSelectPopup(canvasElement);+ await expect(getComputedStyle(trigger).borderColor).toBe(+ invalidBorderColor,+ );+ },+};diff --git a/packages/twenty-ui/src/input/Select/__stories__/Select.portals.stories.tsx b/packages/twenty-ui/src/input/Select/__stories__/Select.portals.stories.tsxnew file mode 100644index 00000000000..40175b9d682--- /dev/null+++ b/packages/twenty-ui/src/input/Select/__stories__/Select.portals.stories.tsx@@ -0,0 +1,236 @@+import { DirectionProvider } from '@base-ui/react/direction-provider';+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { useState } from 'react';+import { expect, userEvent, waitFor, within } from 'storybook/test';++import { ComponentDecorator } from '@ui/testing';+import { ThemeProvider } from '@ui/theme-constants/ThemeProvider';++import { Select } from '../Select';+import { SelectExample, type SelectExampleProps } from './SelectExample';+import { waitForSelectPopup } from './waitForSelectPopup';++const meta: Meta<typeof SelectExample> = {+ title: 'UI/Input/Select/Portals',+ component: SelectExample,+ parameters: { container: { width: 280, height: 240 } },+};++export default meta;+type Story = StoryObj<typeof SelectExample>;++export const BodyPortalAndOutsideDismissal: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <>+ <SelectExample defaultValue="apple" modal={false} />+ <button type="button" style={{ marginTop: 160 }}>+ Outside+ </button>+ </>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const trigger = canvas.getByRole('combobox');+ await userEvent.click(trigger);+ const popup = await waitForSelectPopup(canvasElement);+ await expect(canvasElement).not.toContainElement(popup);+ await expect(canvasElement.ownerDocument.body).toContainElement(popup);+ await expect(trigger).toHaveAttribute('aria-controls', popup.id);+ await userEvent.click(canvas.getByRole('button', { name: 'Outside' }));+ await waitFor(() => expect(popup).not.toBeVisible());+ await expect(trigger).toHaveAttribute('aria-expanded', 'false');+ },+};++const ExplicitContainerExample = (props: SelectExampleProps) => {+ const [container, setContainer] = useState<HTMLDivElement | null>(null);++ return (+ <>+ <SelectExample {...props} container={container} />+ <div ref={setContainer} role="region" aria-label="Select portal" />+ </>+ );+};++export const ExplicitContainer: Story = {+ decorators: [ComponentDecorator],+ args: { defaultOpen: true, defaultValue: 'apple', modal: false },+ render: (args) => <ExplicitContainerExample {...args} />,+ play: async ({ canvasElement }) => {+ const popup = await waitForSelectPopup(canvasElement);+ await expect(+ within(canvasElement).getByRole('region', { name: 'Select portal' }),+ ).toContainElement(popup);+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(popup).not.toBeVisible());+ },+};++export const ScopedTheme: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <section aria-label="Scoped dark theme">+ <ThemeProvider colorScheme="dark" applyToRoot={false}>+ <div style={{ background: 'var(--t-background-primary)', height: 220 }}>+ <SelectExample defaultValue="apple" defaultOpen modal={false} />+ </div>+ </ThemeProvider>+ </section>+ ),+ play: async ({ canvasElement }) => {+ const popup = await waitForSelectPopup(canvasElement);+ await expect(+ within(canvasElement).getByRole('region', { name: 'Scoped dark theme' }),+ ).toContainElement(popup);+ await expect(popup.closest('.dark')).not.toBeNull();+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(popup).not.toBeVisible());+ },+};++const DeferredContainerExample = () => {+ const [container, setContainer] = useState<HTMLDivElement | null>(null);+ const [mounted, setMounted] = useState(false);+ const [open, setOpen] = useState(true);++ return (+ <ThemeProvider colorScheme="dark" applyToRoot={false}>+ <div style={{ background: 'var(--t-background-primary)', height: 220 }}>+ <SelectExample+ container={container}+ defaultValue="apple"+ open={open}+ onOpenChange={(nextOpen, details) => {+ if (details.reason === 'escape-key') {+ setOpen(nextOpen);+ }+ }}+ modal={false}+ />+ <button type="button" onClick={() => setMounted(true)}>+ Mount portal+ </button>+ {mounted && (+ <div ref={setContainer} role="region" aria-label="Deferred portal" />+ )}+ </div>+ </ThemeProvider>+ );+};++export const NullContainerWaits: Story = {+ decorators: [ComponentDecorator],+ render: () => <DeferredContainerExample />,+ play: async ({ canvasElement }) => {+ await expect(+ within(canvasElement.ownerDocument.body).queryByRole('listbox'),+ ).not.toBeInTheDocument();+ await userEvent.click(+ within(canvasElement).getByRole('button', { name: 'Mount portal' }),+ );+ const popup = await waitForSelectPopup(canvasElement);+ await expect(+ within(canvasElement).getByRole('region', { name: 'Deferred portal' }),+ ).toContainElement(popup);+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(popup).not.toBeVisible());+ },+};++export const RightToLeft: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <DirectionProvider direction="rtl">+ <div dir="rtl">+ <SelectExample defaultValue="apple" />+ </div>+ </DirectionProvider>+ ),+ play: async ({ canvasElement }) => {+ await userEvent.click(within(canvasElement).getByRole('combobox'));+ const popup = await waitForSelectPopup(canvasElement);+ const trigger = within(canvasElement).getByRole('combobox');+ await expect(popup).toHaveAttribute('data-align', 'start');+ await waitFor(() =>+ expect(+ Math.abs(+ popup.getBoundingClientRect().right -+ trigger.getBoundingClientRect().right,+ ),+ ).toBeLessThan(2),+ );+ await userEvent.keyboard('{End}{Enter}');+ await waitFor(() => expect(popup).not.toBeVisible());+ await expect(trigger).toHaveTextContent('Dragon fruit');+ },+};++export const Scrollable: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <Select.Root+ defaultValue={1}+ itemToStringLabel={(value) => `Option ${value}`}+ >+ <Select.Trigger aria-label="Long list">+ <Select.Value />+ </Select.Trigger>+ <Select.Popup style={{ maxHeight: 160 }}>+ {Array.from({ length: 30 }, (_, index) => (+ <Select.Item key={index} value={index + 1}>+ Option {index + 1}+ </Select.Item>+ ))}+ </Select.Popup>+ </Select.Root>+ ),+ play: async ({ canvasElement }) => {+ await userEvent.tab();+ await userEvent.keyboard('{Enter}');+ const popup = await waitForSelectPopup(canvasElement);+ await expect(popup.scrollHeight).toBeGreaterThan(popup.clientHeight);+ await userEvent.keyboard('{End}');+ const last = within(popup).getByRole('option', { name: 'Option 30' });+ await expect(last).toHaveFocus();+ await waitFor(() =>+ expect(last.getBoundingClientRect().bottom).toBeLessThanOrEqual(+ popup.getBoundingClientRect().bottom,+ ),+ );+ await userEvent.keyboard('{Enter}');+ await waitFor(() => expect(popup).not.toBeVisible());+ await expect(within(canvasElement).getByRole('combobox')).toHaveTextContent(+ 'Option 30',+ );+ },+};++export const AlignedWithSelectedItem: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <div style={{ width: 240, paddingTop: 120 }}>+ <SelectExample defaultValue="cherry" alignItemWithTrigger />+ </div>+ ),+ play: async ({ canvasElement }) => {+ const trigger = within(canvasElement).getByRole('combobox');+ await userEvent.click(trigger);+ const popup = await waitForSelectPopup(canvasElement);+ await expect(popup).toHaveAttribute('data-side', 'none');+ const selected = within(popup).getByRole('option', { name: 'Cherry' });+ await waitFor(() => {+ const triggerBounds = trigger.getBoundingClientRect();+ const selectedBounds = selected.getBoundingClientRect();+ expect(+ Math.abs(+ triggerBounds.top ++ triggerBounds.height / 2 -+ selectedBounds.top -+ selectedBounds.height / 2,+ ),+ ).toBeLessThan(3);+ });+ },+};diff --git a/packages/twenty-ui/src/input/Select/__stories__/Select.stories.tsx b/packages/twenty-ui/src/input/Select/__stories__/Select.stories.tsxnew file mode 100644index 00000000000..b15da2041e5--- /dev/null+++ b/packages/twenty-ui/src/input/Select/__stories__/Select.stories.tsx@@ -0,0 +1,220 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { useId, useState } from 'react';+import { expect, userEvent, waitFor, within } from 'storybook/test';++import {+ A11Y_DEFER_COLOR_CONTRAST,+ CatalogDecorator,+ type CatalogStory,+ ComponentDecorator,+} from '@ui/testing';++import { Select } from '../Select';+import {+ SelectExample,+ type SelectExampleProps,+ SELECT_ITEMS,+} from './SelectExample';+import { waitForSelectPopup } from './waitForSelectPopup';++const meta: Meta<typeof SelectExample> = {+ title: 'UI/Input/Select',+ component: SelectExample,+};++export default meta;+type Story = StoryObj<typeof SelectExample>;++export const Default: Story = {+ decorators: [ComponentDecorator],+ parameters: { container: { width: 240, height: 200 } },+ args: { defaultValue: 'apple' },+ play: async ({ canvasElement }) => {+ const trigger = within(canvasElement).getByRole('combobox', {+ name: 'Fruit',+ });+ await expect(trigger).toHaveTextContent('Apple');+ await userEvent.click(trigger);+ const popup = await waitForSelectPopup(canvasElement);+ await expect(+ within(popup).getByRole('option', { name: 'Apple' }),+ ).toHaveAttribute('aria-selected', 'true');+ await userEvent.click(+ within(popup).getByRole('option', { name: 'Cherry' }),+ );+ await waitFor(() => expect(popup).not.toBeVisible());+ await expect(trigger).toHaveTextContent('Cherry');+ await waitFor(() => expect(trigger).toHaveFocus());+ },+};++export const Placeholder: Story = {+ ...Default,+ args: {},+ play: async ({ canvasElement }) => {+ const trigger = within(canvasElement).getByRole('combobox');+ await expect(trigger).toHaveTextContent('Choose a fruit');+ await expect(trigger).toHaveAttribute('data-placeholder');+ await userEvent.click(trigger);+ const popup = await waitForSelectPopup(canvasElement);+ await userEvent.click(within(popup).getByRole('option', { name: 'Apple' }));+ await waitFor(() => expect(popup).not.toBeVisible());+ await expect(trigger).toHaveTextContent('Apple');+ await expect(trigger).not.toHaveAttribute('data-placeholder');+ },+};++export const Multiple: Story = {+ ...Default,+ args: { multiple: true, defaultValue: ['apple'] },+ play: async ({ canvasElement }) => {+ const trigger = within(canvasElement).getByRole('combobox');+ await userEvent.click(trigger);+ const popup = await waitForSelectPopup(canvasElement);+ await expect(popup).toHaveAttribute('aria-multiselectable', 'true');+ const apple = within(popup).getByRole('option', { name: 'Apple' });+ const cherry = within(popup).getByRole('option', { name: 'Cherry' });+ await userEvent.click(cherry);+ await expect(popup).toBeVisible();+ await expect(apple).toHaveAttribute('aria-selected', 'true');+ await expect(cherry).toHaveAttribute('aria-selected', 'true');+ await expect(trigger).toHaveTextContent('Apple, Cherry');+ await userEvent.click(apple);+ await expect(apple).toHaveAttribute('aria-selected', 'false');+ await expect(trigger).toHaveTextContent('Cherry');+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(popup).not.toBeVisible());+ await expect(trigger).toHaveFocus();+ },+};++export const Grouped: Story = {+ ...Default,+ render: () => (+ <Select.Root items={SELECT_ITEMS} defaultValue="apple">+ <Select.Trigger aria-label="Fruit">+ <Select.Value />+ </Select.Trigger>+ <Select.Popup>+ <Select.Group>+ <Select.GroupLabel>Everyday</Select.GroupLabel>+ <Select.Item value="apple">Apple</Select.Item>+ <Select.Item value="cherry">Cherry</Select.Item>+ </Select.Group>+ <Select.Separator />+ <Select.Group>+ <Select.GroupLabel>Tropical</Select.GroupLabel>+ <Select.Item value="dragon-fruit">Dragon fruit</Select.Item>+ </Select.Group>+ </Select.Popup>+ </Select.Root>+ ),+ play: async ({ canvasElement }) => {+ await userEvent.click(within(canvasElement).getByRole('combobox'));+ const popup = await waitForSelectPopup(canvasElement);+ await expect(+ within(popup).getByRole('group', { name: 'Everyday' }),+ ).toBeVisible();+ await expect(+ within(popup).getByRole('group', { name: 'Tropical' }),+ ).toBeVisible();+ await expect(within(popup).getByRole('presentation')).toBeVisible();+ },+};++const SelectCatalogCell = ({+ size,+ disabled,+ multiple,+ defaultOpen,+}: SelectExampleProps) => {+ const [container, setContainer] = useState<HTMLDivElement | null>(null);+ const triggerId = useId();++ return (+ <div+ ref={setContainer}+ data-select-catalog=""+ style={{ width: 180, height: defaultOpen ? 180 : 40 }}+ >+ <Select.Root+ items={SELECT_ITEMS}+ value={multiple ? ['apple', 'cherry'] : 'apple'}+ multiple={multiple}+ disabled={disabled}+ open={defaultOpen}+ modal={false}+ >+ <Select.Trigger id={triggerId} size={size} aria-label="Fruit">+ <Select.Value />+ </Select.Trigger>+ <Select.Popup container={container}>+ {SELECT_ITEMS.map(({ value, label }) => (+ <Select.Item+ key={value}+ value={value}+ disabled={value === 'banana'}+ >+ {label}+ </Select.Item>+ ))}+ </Select.Popup>+ </Select.Root>+ </div>+ );+};++export const Catalog: CatalogStory<Story, typeof SelectExample> = {+ render: (args) => <SelectCatalogCell {...args} />,+ decorators: [CatalogDecorator],+ parameters: {+ a11y: {+ ...A11Y_DEFER_COLOR_CONTRAST,+ config: {+ rules: [+ ...A11Y_DEFER_COLOR_CONTRAST.config.rules,+ {+ id: 'aria-hidden-focus',+ // Simultaneously open selects keep Base UI's focus sentinels active.+ selector:+ '[aria-hidden="true"]:not([data-select-catalog] [data-base-ui-focus-guard])',+ },+ ],+ },+ },+ catalog: {+ dimensions: [+ {+ name: 'size',+ values: ['sm', 'md'],+ props: (size: SelectExampleProps['size']) => ({ size }),+ },+ {+ name: 'state',+ values: ['default', 'disabled', 'open', 'multiple'],+ props: (state: string) => ({+ disabled: state === 'disabled',+ defaultOpen: state === 'open' || state === 'multiple',+ multiple: state === 'multiple',+ }),+ },+ ],+ options: { elementContainer: { style: { width: 180 } } },+ },+ },+ play: async ({ canvasElement }) => {+ await waitFor(() => {+ const popups = within(canvasElement).getAllByRole('listbox');+ expect(popups).toHaveLength(4);+ for (const popup of popups) {+ expect(getComputedStyle(popup).opacity).toBe('1');+ }+ });+ },+};++export const CatalogDark: CatalogStory<Story, typeof SelectExample> = {+ ...Catalog,+ tags: ['!autodocs'],+ globals: { colorScheme: 'dark' },+};diff --git a/packages/twenty-ui/src/input/Select/__stories__/SelectExample.tsx b/packages/twenty-ui/src/input/Select/__stories__/SelectExample.tsxnew file mode 100644index 00000000000..bca0b4909c5--- /dev/null+++ b/packages/twenty-ui/src/input/Select/__stories__/SelectExample.tsx@@ -0,0 +1,45 @@+import { Select } from '../Select';+import { type SelectPopupProps } from '../types/SelectPopupProps';+import { type SelectRootProps } from '../types/SelectRootProps';+import { type SelectTriggerProps } from '../types/SelectTriggerProps';++export const SELECT_ITEMS = [+ { label: 'Apple', value: 'apple' },+ { label: 'Banana', value: 'banana' },+ { label: 'Cherry', value: 'cherry' },+ { label: 'Dragon fruit', value: 'dragon-fruit' },+];++export type SelectExampleProps = SelectRootProps<string, boolean> &+ Pick<SelectTriggerProps, 'size'> &+ Pick<+ SelectPopupProps,+ 'container' | 'side' | 'align' | 'alignItemWithTrigger'+ >;++export const SelectExample = ({+ size,+ container,+ side,+ align,+ alignItemWithTrigger,+ ...props+}: SelectExampleProps) => (+ <Select.Root {...props} items={SELECT_ITEMS}>+ <Select.Trigger size={size} aria-label="Fruit">+ <Select.Value placeholder="Choose a fruit" />+ </Select.Trigger>+ <Select.Popup+ container={container}+ side={side}+ align={align}+ alignItemWithTrigger={alignItemWithTrigger}+ >+ {SELECT_ITEMS.map(({ value, label }) => (+ <Select.Item key={value} value={value} disabled={value === 'banana'}>+ {label}+ </Select.Item>+ ))}+ </Select.Popup>+ </Select.Root>+);diff --git a/packages/twenty-ui/src/input/Select/__stories__/waitForSelectPopup.ts b/packages/twenty-ui/src/input/Select/__stories__/waitForSelectPopup.tsnew file mode 100644index 00000000000..b0e0ebc7f36--- /dev/null+++ b/packages/twenty-ui/src/input/Select/__stories__/waitForSelectPopup.ts@@ -0,0 +1,14 @@+import { expect, waitFor, within } from 'storybook/test';++export const waitForSelectPopup = async (canvasElement: HTMLElement) => {+ const popup = await within(canvasElement.ownerDocument.body).findByRole(+ 'listbox',+ );++ await waitFor(() => {+ expect(popup).toBeVisible();+ expect(getComputedStyle(popup).opacity).toBe('1');+ });++ return popup;+};diff --git a/packages/twenty-ui/src/input/Select/__tests__/Select.test.tsx b/packages/twenty-ui/src/input/Select/__tests__/Select.test.tsxnew file mode 100644index 00000000000..e0261a21fe6--- /dev/null+++ b/packages/twenty-ui/src/input/Select/__tests__/Select.test.tsx@@ -0,0 +1,80 @@+import { type ReactNode } from 'react';++import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';++import { Select } from '../Select';+import styles from '../Select.module.scss';++const SelectRootWrapper = ({ children }: { children: ReactNode }) => (+ <Select.Root>{children}</Select.Root>+);+const SelectTriggerWrapper = ({ children }: { children: ReactNode }) => (+ <Select.Root>+ <Select.Trigger>{children}</Select.Trigger>+ </Select.Root>+);+const OpenSelectWrapper = ({ children }: { children: ReactNode }) => (+ <Select.Root open>{children}</Select.Root>+);+const SelectPopupWrapper = ({ children }: { children: ReactNode }) => (+ <Select.Root open>+ <Select.Popup>{children}</Select.Popup>+ </Select.Root>+);+const SelectGroupWrapper = ({ children }: { children: ReactNode }) => (+ <Select.Root open>+ <Select.Popup>+ <Select.Group>{children}</Select.Group>+ </Select.Popup>+ </Select.Root>+);++runComponentConformance({+ name: 'Select.Trigger',+ element: <Select.Trigger>Choose</Select.Trigger>,+ refInstanceOf: HTMLButtonElement,+ wrapper: SelectRootWrapper,+ ownClassName: styles.trigger,+ renderPropTagName: 'button',+});+runComponentConformance({+ name: 'Select.Value',+ element: <Select.Value placeholder="Choose" />,+ refInstanceOf: HTMLSpanElement,+ wrapper: SelectTriggerWrapper,+ ownClassName: styles.value,+});+runComponentConformance({+ name: 'Select.Popup',+ element: <Select.Popup />,+ refInstanceOf: HTMLDivElement,+ wrapper: OpenSelectWrapper,+ ownClassName: styles.popup,+});+runComponentConformance({+ name: 'Select.Item',+ element: <Select.Item value="first">First</Select.Item>,+ refInstanceOf: HTMLDivElement,+ wrapper: SelectPopupWrapper,+ ownClassName: styles.item,+});+runComponentConformance({+ name: 'Select.Group',+ element: <Select.Group />,+ refInstanceOf: HTMLDivElement,+ wrapper: SelectPopupWrapper,+});+runComponentConformance({+ name: 'Select.GroupLabel',+ element: <Select.GroupLabel>Group</Select.GroupLabel>,+ refInstanceOf: HTMLDivElement,+ wrapper: SelectGroupWrapper,+ ownClassName: styles.groupLabel,+});+runComponentConformance({+ name: 'Select.Separator',+ element: <Select.Separator />,+ refInstanceOf: HTMLDivElement,+ wrapper: SelectPopupWrapper,+ ownClassName: styles.separator,+});diff --git a/packages/twenty-ui/src/input/Select/internal/SelectGroupLabel.tsx b/packages/twenty-ui/src/input/Select/internal/SelectGroupLabel.tsxnew file mode 100644index 00000000000..1467c0fc781--- /dev/null+++ b/packages/twenty-ui/src/input/Select/internal/SelectGroupLabel.tsx@@ -0,0 +1,16 @@+import { Select as SelectPrimitive } from '@base-ui/react/select';++import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import styles from '../Select.module.scss';+import { type SelectGroupLabelProps } from '../types/SelectGroupLabelProps';++export const SelectGroupLabel = ({+ className,+ ...props+}: SelectGroupLabelProps) => (+ <SelectPrimitive.GroupLabel+ {...props}+ className={mergeClassNames(styles.groupLabel, className)}+ />+);diff --git a/packages/twenty-ui/src/input/Select/internal/SelectItem.tsx b/packages/twenty-ui/src/input/Select/internal/SelectItem.tsxnew file mode 100644index 00000000000..f1fbee9d350--- /dev/null+++ b/packages/twenty-ui/src/input/Select/internal/SelectItem.tsx@@ -0,0 +1,69 @@+import { Select as SelectPrimitive } from '@base-ui/react/select';+import { clsx } from 'clsx';++import { IconCheck } from '@ui/icon';+import { isRenderableSlot } from '@ui/navigation/ListItem/internal/isRenderableSlot';+import listItemStyles from '@ui/navigation/ListItem/ListItem.module.scss';+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import styles from '../Select.module.scss';+import { type SelectItemProps } from '../types/SelectItemProps';++export const SelectItem = ({+ className,+ children,+ startIcon,+ endIcon,+ description,+ descriptionPlacement = 'inline',+ ...props+}: SelectItemProps) => (+ <SelectPrimitive.Item+ {...props}+ className={mergeClassNames(+ clsx(listItemStyles.root, styles.item),+ className,+ )}+ data-color="neutral"+ data-indicator="check"+ >+ {isRenderableSlot(startIcon) && (+ <div className={listItemStyles.startIcon} aria-hidden>+ {startIcon}+ </div>+ )}+ <div className={listItemStyles.label}>+ <SelectPrimitive.ItemText className={listItemStyles.text}>+ {children}+ </SelectPrimitive.ItemText>+ {isRenderableSlot(description) && descriptionPlacement === 'inline' && (+ <div+ className={clsx(+ listItemStyles.description,+ listItemStyles.inlineDescription,+ )}+ >+ {description}+ </div>+ )}+ </div>+ {isRenderableSlot(description) && descriptionPlacement === 'end' && (+ <div+ className={clsx(+ listItemStyles.description,+ listItemStyles.endDescription,+ )}+ >+ {description}+ </div>+ )}+ {isRenderableSlot(endIcon) && (+ <div className={listItemStyles.endIcon} aria-hidden>+ {endIcon}+ </div>+ )}+ <SelectPrimitive.ItemIndicator className={styles.indicator}>+ <IconCheck className={listItemStyles.checkIndicator} />+ </SelectPrimitive.ItemIndicator>+ </SelectPrimitive.Item>+);diff --git a/packages/twenty-ui/src/input/Select/internal/SelectPopup.tsx b/packages/twenty-ui/src/input/Select/internal/SelectPopup.tsxnew file mode 100644index 00000000000..fead121256d--- /dev/null+++ b/packages/twenty-ui/src/input/Select/internal/SelectPopup.tsx@@ -0,0 +1,47 @@+import { useDirection } from '@base-ui/react/direction-provider';+import { Select as SelectPrimitive } from '@base-ui/react/select';++import { useThemeContainer } from '@ui/theme-constants';+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import styles from '../Select.module.scss';+import { type SelectPopupProps } from '../types/SelectPopupProps';++export const SelectPopup = ({+ side = 'bottom',+ align = 'start',+ sideOffset = 8,+ alignOffset,+ alignItemWithTrigger = false,+ anchor,+ container,+ className,+ ...props+}: SelectPopupProps) => {+ const themeContainer = useThemeContainer();+ const direction = useDirection();++ return (+ <SelectPrimitive.Portal+ container={+ container === undefined ? (themeContainer ?? undefined) : container+ }+ >+ <SelectPrimitive.Positioner+ dir={direction}+ side={side}+ align={align}+ sideOffset={sideOffset}+ alignOffset={alignOffset}+ alignItemWithTrigger={alignItemWithTrigger}+ anchor={anchor}+ className={styles.positioner}+ >+ <SelectPrimitive.Popup+ {...props}+ className={mergeClassNames(styles.popup, className)}+ />+ </SelectPrimitive.Positioner>+ </SelectPrimitive.Portal>+ );+};diff --git a/packages/twenty-ui/src/input/Select/internal/SelectSeparator.tsx b/packages/twenty-ui/src/input/Select/internal/SelectSeparator.tsxnew file mode 100644index 00000000000..21ecb258d6a--- /dev/null+++ b/packages/twenty-ui/src/input/Select/internal/SelectSeparator.tsx@@ -0,0 +1,16 @@+import { Select as SelectPrimitive } from '@base-ui/react/select';++import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import styles from '../Select.module.scss';+import { type SelectSeparatorProps } from '../types/SelectSeparatorProps';++export const SelectSeparator = ({+ className,+ ...props+}: SelectSeparatorProps) => (+ <SelectPrimitive.Separator+ {...props}+ className={mergeClassNames(styles.separator, className)}+ />+);diff --git a/packages/twenty-ui/src/input/Select/internal/SelectTrigger.tsx b/packages/twenty-ui/src/input/Select/internal/SelectTrigger.tsxnew file mode 100644index 00000000000..825d61e8bd9--- /dev/null+++ b/packages/twenty-ui/src/input/Select/internal/SelectTrigger.tsx@@ -0,0 +1,29 @@+import { Select as SelectPrimitive } from '@base-ui/react/select';+import { clsx } from 'clsx';++import { IconChevronDown } from '@ui/icon';+import inputStyles from '@ui/input/Input/Input.module.scss';+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import styles from '../Select.module.scss';+import { type SelectTriggerProps } from '../types/SelectTriggerProps';++export const SelectTrigger = ({+ size = 'md',+ className,+ children,+ ...props+}: SelectTriggerProps) => (+ <SelectPrimitive.Trigger+ {...props}+ className={mergeClassNames(+ clsx(inputStyles.input, inputStyles[size], styles.trigger),+ className,+ )}+ >+ {children}+ <SelectPrimitive.Icon className={styles.icon}>+ <IconChevronDown />+ </SelectPrimitive.Icon>+ </SelectPrimitive.Trigger>+);diff --git a/packages/twenty-ui/src/input/Select/internal/SelectValue.tsx b/packages/twenty-ui/src/input/Select/internal/SelectValue.tsxnew file mode 100644index 00000000000..7366af93227--- /dev/null+++ b/packages/twenty-ui/src/input/Select/internal/SelectValue.tsx@@ -0,0 +1,13 @@+import { Select as SelectPrimitive } from '@base-ui/react/select';++import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import styles from '../Select.module.scss';+import { type SelectValueProps } from '../types/SelectValueProps';++export const SelectValue = ({ className, ...props }: SelectValueProps) => (+ <SelectPrimitive.Value+ {...props}+ className={mergeClassNames(styles.value, className)}+ />+);diff --git a/packages/twenty-ui/src/input/Select/types/SelectGroupLabelProps.ts b/packages/twenty-ui/src/input/Select/types/SelectGroupLabelProps.tsnew file mode 100644index 00000000000..ba3fb7b73ef--- /dev/null+++ b/packages/twenty-ui/src/input/Select/types/SelectGroupLabelProps.ts@@ -0,0 +1,3 @@+import { type Select as SelectPrimitive } from '@base-ui/react/select';++export type SelectGroupLabelProps = SelectPrimitive.GroupLabel.Props;diff --git a/packages/twenty-ui/src/input/Select/types/SelectGroupProps.ts b/packages/twenty-ui/src/input/Select/types/SelectGroupProps.tsnew file mode 100644index 00000000000..41ab5bbbb97--- /dev/null+++ b/packages/twenty-ui/src/input/Select/types/SelectGroupProps.ts@@ -0,0 +1,3 @@+import { type Select as SelectPrimitive } from '@base-ui/react/select';++export type SelectGroupProps = SelectPrimitive.Group.Props;diff --git a/packages/twenty-ui/src/input/Select/types/SelectItemProps.ts b/packages/twenty-ui/src/input/Select/types/SelectItemProps.tsnew file mode 100644index 00000000000..1eaf7243e47--- /dev/null+++ b/packages/twenty-ui/src/input/Select/types/SelectItemProps.ts@@ -0,0 +1,9 @@+import { type Select as SelectPrimitive } from '@base-ui/react/select';++import { type ListItemProps } from '@ui/navigation/ListItem/types/ListItemProps';++export type SelectItemProps = SelectPrimitive.Item.Props &+ Pick<+ ListItemProps,+ 'startIcon' | 'endIcon' | 'description' | 'descriptionPlacement'+ >;diff --git a/packages/twenty-ui/src/input/Select/types/SelectPopupProps.ts b/packages/twenty-ui/src/input/Select/types/SelectPopupProps.tsnew file mode 100644index 00000000000..0fd9a8e4a51--- /dev/null+++ b/packages/twenty-ui/src/input/Select/types/SelectPopupProps.ts@@ -0,0 +1,14 @@+import { type Select as SelectPrimitive } from '@base-ui/react/select';++export type SelectPopupProps = SelectPrimitive.Popup.Props &+ Pick<+ SelectPrimitive.Positioner.Props,+ | 'side'+ | 'align'+ | 'sideOffset'+ | 'alignOffset'+ | 'alignItemWithTrigger'+ | 'anchor'+ > & {+ container?: SelectPrimitive.Portal.Props['container'];+ };diff --git a/packages/twenty-ui/src/input/Select/types/SelectRootProps.ts b/packages/twenty-ui/src/input/Select/types/SelectRootProps.tsnew file mode 100644index 00000000000..344d456d699--- /dev/null+++ b/packages/twenty-ui/src/input/Select/types/SelectRootProps.ts@@ -0,0 +1,6 @@+import { type Select as SelectPrimitive } from '@base-ui/react/select';++export type SelectRootProps<+ TValue,+ TMultiple extends boolean | undefined = false,+> = SelectPrimitive.Root.Props<TValue, TMultiple>;diff --git a/packages/twenty-ui/src/input/Select/types/SelectSeparatorProps.ts b/packages/twenty-ui/src/input/Select/types/SelectSeparatorProps.tsnew file mode 100644index 00000000000..b0064c1a122--- /dev/null+++ b/packages/twenty-ui/src/input/Select/types/SelectSeparatorProps.ts@@ -0,0 +1,3 @@+import { type Select as SelectPrimitive } from '@base-ui/react/select';++export type SelectSeparatorProps = SelectPrimitive.Separator.Props;diff --git a/packages/twenty-ui/src/input/Select/types/SelectTriggerProps.ts b/packages/twenty-ui/src/input/Select/types/SelectTriggerProps.tsnew file mode 100644index 00000000000..7bd319af42b--- /dev/null+++ b/packages/twenty-ui/src/input/Select/types/SelectTriggerProps.ts@@ -0,0 +1,7 @@+import { type Select as SelectPrimitive } from '@base-ui/react/select';++import { type InputSize } from '@ui/input/types/InputSize';++export type SelectTriggerProps = SelectPrimitive.Trigger.Props & {+ size?: InputSize;+};diff --git a/packages/twenty-ui/src/input/Select/types/SelectValueProps.ts b/packages/twenty-ui/src/input/Select/types/SelectValueProps.tsnew file mode 100644index 00000000000..a39a8306bc6--- /dev/null+++ b/packages/twenty-ui/src/input/Select/types/SelectValueProps.ts@@ -0,0 +1,3 @@+import { type Select as SelectPrimitive } from '@base-ui/react/select';++export type SelectValueProps = SelectPrimitive.Value.Props;diff --git a/packages/twenty-ui/src/input/index.ts b/packages/twenty-ui/src/input/index.tsindex 77972d72158..bcb4abaab16 100644--- a/packages/twenty-ui/src/input/index.ts+++ b/packages/twenty-ui/src/input/index.ts@@ -109,6 +109,15 @@ export type {SegmentedControlProps,} from './SegmentedControl/SegmentedControl';export { SegmentedControl } from './SegmentedControl/SegmentedControl';+export { Select } from './Select/Select';+export type { SelectGroupLabelProps } from './Select/types/SelectGroupLabelProps';+export type { SelectGroupProps } from './Select/types/SelectGroupProps';+export type { SelectItemProps } from './Select/types/SelectItemProps';+export type { SelectPopupProps } from './Select/types/SelectPopupProps';+export type { SelectRootProps } from './Select/types/SelectRootProps';+export type { SelectSeparatorProps } from './Select/types/SelectSeparatorProps';+export type { SelectTriggerProps } from './Select/types/SelectTriggerProps';+export type { SelectValueProps } from './Select/types/SelectValueProps';export type { SliderColor, SliderProps } from './Slider/Slider';export { Slider } from './Slider/Slider';export type { TabContentProps } from './TabButton/TabButton';