Skip to content

The open alternative to Salesforce, designed for AI.

Expose NumberField and retain NumberStepper (#27734)

Raphaël Bosi55e2d2e5c0d5
diff --git a/packages/twenty-docs/docs.json b/packages/twenty-docs/docs.json
index 79921bfc4b7..2cd8c968a1e 100644
--- a/packages/twenty-docs/docs.json
+++ b/packages/twenty-docs/docs.json
@@ -570,7 +570,7 @@
"ui/primitives/input/field",
"ui/primitives/input/input",
"ui/primitives/input/input-group",
- "ui/primitives/input/number-stepper",
+ "ui/primitives/input/number-field",
"ui/primitives/input/textarea",
"ui/primitives/input/checkbox",
"ui/primitives/input/radio",
@@ -653,7 +653,8 @@
"ui/components/input/currency-picker",
"ui/components/input/phone-country-picker",
"ui/components/input/image-input",
- "ui/components/input/search-input"
+ "ui/components/input/search-input",
+ "ui/components/input/number-stepper"
]
},
{
@@ -6731,6 +6732,10 @@
"source": "/ui/primitives/layout/animated-expandable-container",
"destination": "/ui/primitives/layout/collapsible"
},
+ {
+ "source": "/ui/primitives/input/number-stepper",
+ "destination": "/ui/components/input/number-stepper"
+ },
{
"source": "/twenty-ui/input/checkbox",
"destination": "/ui/primitives/input/checkbox"
diff --git a/packages/twenty-docs/navigation/base-structure.json b/packages/twenty-docs/navigation/base-structure.json
index e19b10ebcb8..98a725908e2 100644
--- a/packages/twenty-docs/navigation/base-structure.json
+++ b/packages/twenty-docs/navigation/base-structure.json
@@ -583,7 +583,7 @@
"ui/primitives/input/field",
"ui/primitives/input/input",
"ui/primitives/input/input-group",
- "ui/primitives/input/number-stepper",
+ "ui/primitives/input/number-field",
"ui/primitives/input/textarea",
"ui/primitives/input/checkbox",
"ui/primitives/input/radio",
@@ -674,7 +674,8 @@
"ui/components/input/currency-picker",
"ui/components/input/phone-country-picker",
"ui/components/input/image-input",
- "ui/components/input/search-input"
+ "ui/components/input/search-input",
+ "ui/components/input/number-stepper"
]
},
{
diff --git a/packages/twenty-docs/snippets/ui/generated/input/number-stepper.mdx b/packages/twenty-docs/snippets/ui/generated/components/input/number-stepper.mdx
similarity index 88%
rename from packages/twenty-docs/snippets/ui/generated/input/number-stepper.mdx
rename to packages/twenty-docs/snippets/ui/generated/components/input/number-stepper.mdx
index fd69abe81cf..a08ef19146f 100644
--- a/packages/twenty-docs/snippets/ui/generated/input/number-stepper.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/components/input/number-stepper.mdx
@@ -64,6 +64,10 @@
Called with the next number or null and event details when the numeric value changes. Clearing reports null; incomplete text does not report a number.
</ParamField>
+<ParamField body="onValueCommitted" type="((value: number | null, eventDetails: NumberFieldRootCommitEventDetails) =&gt; void)">
+ Called with the committed number or null and generic event details after an edit is committed. Details contain the native event and reason, without change cancellation methods.
+</ParamField>
+
<ParamField body="readOnly" type="boolean" default="false">
Prevents numeric changes while keeping the input focusable.
</ParamField>
@@ -73,10 +77,7 @@
</ParamField>
<ParamField body="render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;DetailedHTMLProps&lt;InputHTMLAttributes&lt;HTMLInputElement&gt;, HTMLInputElement&gt;, NumberFieldInputState&gt;">
- Allows you to replace the component's HTML element
- with a different tag, or compose it with another component.
-
- Accepts a `ReactElement` or a function that returns the element to render.
+ Composes the visible text input with an element or render callback. Forward the supplied props and ref to an input. Use a separate element to customize the surrounding layout.
</ParamField>
<ParamField body="required" type="boolean" default="false">
diff --git a/packages/twenty-docs/snippets/ui/generated/input/number-field.mdx b/packages/twenty-docs/snippets/ui/generated/input/number-field.mdx
new file mode 100644
index 00000000000..da2a91b1e4a
--- /dev/null
+++ b/packages/twenty-docs/snippets/ui/generated/input/number-field.mdx
@@ -0,0 +1,274 @@
+{/*
+ * _____ _
+ *|_ _|_ _____ _ __ | |_ _ _
+ * | | \ \ /\ / / _ \ '_ \| __| | | | Auto-generated file
+ * | | \ V V / __/ | | | |_| |_| | DO NOT EDIT - changes will be overwritten
+ * |_| \_/\_/ \___|_| |_|\__|\__, | Generated by: npx nx generate:ui twenty-docs
+ * |___/
+ *
+ * This file is generated from the documentation data in packages/twenty-ui/generated.
+ * To update it, edit the component prop types or design tokens in twenty-ui and run:
+ * npx nx generate:ui twenty-docs
+ */}
+
+### NumberField.Root
+
+<ParamField body="Root.allowOutOfRange" type="boolean" default="false">
+ Allows typed, pasted, and autofilled values outside min and max. Native range validation still applies; step interactions remain bounded.
+</ParamField>
+
+<ParamField body="Root.allowWheelScrub" type="boolean" default="false">
+ Allows wheel adjustments while the visible input is focused and hovered. Defaults to false.
+</ParamField>
+
+<ParamField body="Root.children" type="ReactNode">
+ Composed NumberField parts and supporting content.
+</ParamField>
+
+<ParamField body="Root.className" type="string | ((state: NumberFieldRootState) =&gt; string | undefined)">
+ Class applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+<ParamField body="Root.defaultValue" type="number" default="empty">
+ Initial uncontrolled number. Omit to start empty; the public type accepts a number.
+</ParamField>
+
+<ParamField body="Root.disabled" type="boolean" default="false">
+ Prevents interaction and excludes the value from form submission.
+</ParamField>
+
+<ParamField body="Root.form" type="string">
+ ID of the form owning the hidden native number input.
+</ParamField>
+
+<ParamField body="Root.format" type="NumberFormatOptions">
+ Intl.NumberFormat options for display and parsing, including currency, units, percent, grouping, and precision. Explicit rounding options can normalize the committed value on blur.
+</ParamField>
+
+<ParamField body="Root.id" type="string">
+ ID associated with the visible input. Generated when omitted.
+</ParamField>
+
+<ParamField body="Root.inputRef" type="Ref&lt;HTMLInputElement&gt;">
+ Ref to the hidden native number input used for submission and validation. Use Input.ref to focus the visible text input.
+</ParamField>
+
+<ParamField body="Root.largeStep" type="number" default="10">
+ Amount used while Shift is held. Defaults to 10.
+</ParamField>
+
+<ParamField body="Root.locale" type="LocalesArgument">
+ Locale or locale list used to format and parse numbers. Defaults to the runtime locale.
+</ParamField>
+
+<ParamField body="Root.max" type="number">
+ Inclusive maximum for stepping and native range validation.
+</ParamField>
+
+<ParamField body="Root.min" type="number">
+ Inclusive minimum for stepping and native range validation.
+</ParamField>
+
+<ParamField body="Root.name" type="string">
+ Name of the raw numeric value submitted by the hidden input.
+</ParamField>
+
+<ParamField body="Root.onValueChange" type="((value: number | null, eventDetails: NumberFieldRootChangeEventDetails) =&gt; void)">
+ Receives the next number or null and change details with the native event, reason, cancellation and propagation methods, and optional stepping direction.
+</ParamField>
+
+<ParamField body="Root.onValueCommitted" type="((value: number | null, eventDetails: NumberFieldRootCommitEventDetails) =&gt; void)">
+ Receives the committed number or null and generic details containing event and reason. Typing commits on blur; pointer steps and scrubbing commit on release; keyboard and wheel changes commit immediately.
+</ParamField>
+
+<ParamField body="Root.readOnly" type="boolean" default="false">
+ Prevents changes while keeping the visible input focusable.
+</ParamField>
+
+<ParamField body="Root.ref" type="Ref&lt;HTMLDivElement&gt;">
+ Ref to the root div, or the element composed through Root.render.
+</ParamField>
+
+<ParamField body="Root.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, NumberFieldRootState&gt;">
+ Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element.
+</ParamField>
+
+<ParamField body="Root.required" type="boolean" default="false">
+ Requires a numeric value for native form submission.
+</ParamField>
+
+<ParamField body="Root.smallStep" type="number" default="0.1">
+ Amount used while Alt is held. Defaults to 0.1.
+</ParamField>
+
+<ParamField body="Root.snapOnStep" type="boolean" default="false">
+ Snaps step interactions to multiples of the active step. Defaults to false.
+</ParamField>
+
+<ParamField body="Root.step" type="number | &quot;any&quot;" default="1">
+ Base amount for buttons, arrow keys, wheel, and scrubbing. Use any to disable native step validation while stepping by 1.
+</ParamField>
+
+<ParamField body="Root.style" type="CSSProperties | ((state: NumberFieldRootState) =&gt; CSSProperties | undefined)">
+ Inline styles applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+<ParamField body="Root.value" type="number | null">
+ Controlled raw numeric value. Use null for an empty field.
+</ParamField>
+
+### NumberField.Group
+
+<ParamField body="Group.children" type="ReactNode">
+ The visible input and any increment or decrement controls.
+</ParamField>
+
+<ParamField body="Group.className" type="string | ((state: NumberFieldGroupState) =&gt; string | undefined)">
+ Class applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+<ParamField body="Group.ref" type="Ref&lt;HTMLDivElement&gt;">
+ Ref to the group div, or the element composed through Group.render.
+</ParamField>
+
+<ParamField body="Group.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, NumberFieldGroupState&gt;">
+ Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element.
+</ParamField>
+
+<ParamField body="Group.style" type="CSSProperties | ((state: NumberFieldGroupState) =&gt; CSSProperties | undefined)">
+ Inline styles applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+### NumberField.Input
+
+<ParamField body="Input.aria-roledescription" type="string" default="Number field">
+ Describes the role to assistive technology. Defaults to Number field; use Field.Label, aria-label, or aria-labelledby for the accessible name.
+</ParamField>
+
+<ParamField body="Input.className" type="string | ((state: NumberFieldInputState) =&gt; string | undefined)">
+ Class applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+<ParamField body="Input.ref" type="Ref&lt;HTMLInputElement&gt;">
+ Ref to the visible native text input.
+</ParamField>
+
+<ParamField body="Input.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;DetailedHTMLProps&lt;InputHTMLAttributes&lt;HTMLInputElement&gt;, HTMLInputElement&gt;, NumberFieldInputState&gt;">
+ Composes the visible text input with an element or render callback. Forward the supplied props and ref to an input. Customize layout through Root or Group.
+</ParamField>
+
+<ParamField body="Input.size" type="number">
+ Native input size attribute. Use styles to customize visual dimensions.
+</ParamField>
+
+<ParamField body="Input.style" type="CSSProperties | ((state: NumberFieldInputState) =&gt; CSSProperties | undefined)">
+ Inline styles applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+### NumberField.Increment
+
+<ParamField body="Increment.children" type="ReactNode">
+ Visible content for the increment control. Supply its accessible name.
+</ParamField>
+
+<ParamField body="Increment.className" type="string | ((state: NumberFieldIncrementState) =&gt; string | undefined)">
+ Class applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+<ParamField body="Increment.nativeButton" type="boolean" default="true">
+ Whether render composes a native button. Set false for a custom non-button element so Base UI supplies button interaction.
+</ParamField>
+
+<ParamField body="Increment.ref" type="Ref&lt;HTMLButtonElement&gt;">
+ Ref to the increment button, or the element composed through render.
+</ParamField>
+
+<ParamField body="Increment.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, NumberFieldIncrementState&gt;">
+ Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element.
+</ParamField>
+
+<ParamField body="Increment.style" type="CSSProperties | ((state: NumberFieldIncrementState) =&gt; CSSProperties | undefined)">
+ Inline styles applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+### NumberField.Decrement
+
+<ParamField body="Decrement.children" type="ReactNode">
+ Visible content for the decrement control. Supply its accessible name.
+</ParamField>
+
+<ParamField body="Decrement.className" type="string | ((state: NumberFieldDecrementState) =&gt; string | undefined)">
+ Class applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+<ParamField body="Decrement.nativeButton" type="boolean" default="true">
+ Whether render composes a native button. Set false for a custom non-button element so Base UI supplies button interaction.
+</ParamField>
+
+<ParamField body="Decrement.ref" type="Ref&lt;HTMLButtonElement&gt;">
+ Ref to the decrement button, or the element composed through render.
+</ParamField>
+
+<ParamField body="Decrement.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, NumberFieldDecrementState&gt;">
+ Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element.
+</ParamField>
+
+<ParamField body="Decrement.style" type="CSSProperties | ((state: NumberFieldDecrementState) =&gt; CSSProperties | undefined)">
+ Inline styles applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+### NumberField.ScrubArea
+
+<ParamField body="ScrubArea.children" type="ReactNode">
+ Content the user can drag to adjust the number, plus an optional ScrubAreaCursor.
+</ParamField>
+
+<ParamField body="ScrubArea.className" type="string | ((state: NumberFieldScrubAreaState) =&gt; string | undefined)">
+ Class applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+<ParamField body="ScrubArea.direction" type="&quot;horizontal&quot; | &quot;vertical&quot;" default="horizontal">
+ Pointer movement direction used for scrubbing.
+</ParamField>
+
+<ParamField body="ScrubArea.pixelSensitivity" type="number" default="2">
+ Pixels of pointer movement needed for a step. Larger values reduce sensitivity.
+</ParamField>
+
+<ParamField body="ScrubArea.ref" type="Ref&lt;HTMLSpanElement&gt;">
+ Ref to the scrub area span, or the element composed through render.
+</ParamField>
+
+<ParamField body="ScrubArea.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, NumberFieldScrubAreaState&gt;">
+ Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element.
+</ParamField>
+
+<ParamField body="ScrubArea.style" type="CSSProperties | ((state: NumberFieldScrubAreaState) =&gt; CSSProperties | undefined)">
+ Inline styles applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+<ParamField body="ScrubArea.teleportDistance" type="number">
+ Optional distance from the scrub area center at which the pointer loops around.
+</ParamField>
+
+### NumberField.ScrubAreaCursor
+
+<ParamField body="ScrubAreaCursor.children" type="ReactNode">
+ Custom cursor content shown during supported pointer-lock scrubbing.
+</ParamField>
+
+<ParamField body="ScrubAreaCursor.className" type="string | ((state: NumberFieldScrubAreaCursorState) =&gt; string | undefined)">
+ Class applied to this part, or a callback receiving its NumberField state.
+</ParamField>
+
+<ParamField body="ScrubAreaCursor.ref" type="Ref&lt;HTMLSpanElement&gt;">
+ Ref to the cursor span portaled to the document body while active. Null while absent.
+</ParamField>
+
+<ParamField body="ScrubAreaCursor.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, NumberFieldScrubAreaCursorState&gt;">
+ Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element.
+</ParamField>
+
+<ParamField body="ScrubAreaCursor.style" type="CSSProperties | ((state: NumberFieldScrubAreaCursorState) =&gt; CSSProperties | undefined)">
+ Inline styles applied to this part, or a callback receiving its NumberField state.
+</ParamField>
diff --git a/packages/twenty-docs/ui/primitives/input/number-stepper.mdx b/packages/twenty-docs/ui/components/input/number-stepper.mdx
similarity index 65%
rename from packages/twenty-docs/ui/primitives/input/number-stepper.mdx
rename to packages/twenty-docs/ui/components/input/number-stepper.mdx
index 3425d6091f3..1ad6c399f3e 100644
--- a/packages/twenty-docs/ui/primitives/input/number-stepper.mdx
+++ b/packages/twenty-docs/ui/components/input/number-stepper.mdx
@@ -4,9 +4,9 @@ description: Edit a number with optional bounds and increment or decrement butto
---
import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';
-import NumberStepperReference from '/snippets/ui/generated/input/number-stepper.mdx';
+import NumberStepperReference from '/snippets/ui/generated/components/input/number-stepper.mdx';
-`NumberStepper` combines a compact numeric text field with decrement and increment buttons. It owns numeric editing, bounds, and step interactions. Your application chooses the limits and handles persistence.
+`NumberStepper` is the compact convenience preset built from [NumberField](/ui/primitives/input/number-field). It combines a numeric text input with optional decrement and increment buttons. Import it from `twenty-ui/components/input`. Use `NumberField` when you need locale or formatting options, different modifier steps, scrubbing, or independent part composition.
<StoryEmbed
storyId="ui-input-numberstepper--default"
@@ -19,7 +19,8 @@ import NumberStepperReference from '/snippets/ui/generated/input/number-stepper.
Use `defaultValue` to set the initial quantity. The input owns subsequent changes.
```tsx
-import { Field, NumberStepper } from 'twenty-ui/primitives/input';
+import { NumberStepper } from 'twenty-ui/components/input';
+import { Field } from 'twenty-ui/primitives/input';
export const QuantityInput = () => (
<Field.Root>
@@ -36,7 +37,8 @@ Pass a number or `null` through `value` and update it in `onValueChange` to own
```tsx
import { useState } from 'react';
-import { Field, NumberStepper } from 'twenty-ui/primitives/input';
+import { NumberStepper } from 'twenty-ui/components/input';
+import { Field } from 'twenty-ui/primitives/input';
export const QuantityInput = () => {
const [quantity, setQuantity] = useState<number | null>(3);
@@ -60,6 +62,8 @@ export const QuantityInput = () => {
Clearing the field reports `null`. Incomplete text such as `-` or `+` remains editable without reporting an invalid number until it is replaced or stepped. By default, parseable numeric edits report the bounded value; the displayed draft is normalized on blur. Values equal to the current value do not call `onValueChange` again.
+`onValueCommitted(value, details)` reports the value after an edit is committed: on blur after typing or clearing, on pointer release after a button adjustment, and immediately for keyboard adjustments. Its details contain the native `event` and `reason`. `onValueChange` retains change details, including cancellation methods and the optional stepping direction.
+
## Application validation
Set `allowOutOfRange` when the application needs the parsed value before applying its own limits or validation. `onValueChange` then receives typed and pasted numbers outside the range. Uncontrolled fields, or controlled fields that accept those values, preserve them on blur. Controlled fields that reject them return to their accepted value on blur. For example, replacing `60` with `45` reports `4` and then `45`, even when `min={30}`. The application can ignore the intermediate value without accidentally saving the minimum.
@@ -84,11 +88,13 @@ Use a controlled `value` when your application needs to reset the field. A nativ
`disabled` prevents changes and excludes the value from form submission. `readOnly` prevents changes while keeping the input focusable and its value available to the form.
-Native input attributes and handlers, `className`, `style`, and `ref` apply to the visible input. For example, call `ref.current?.focus()` to focus the field. Combine the input with `Field.Description` and `Field.Error` for guidance and validation messages.
+Native input attributes and handlers, `className`, `style`, `ref`, and `render` apply to the visible text input. The ref receives an `HTMLInputElement`; call `ref.current?.focus()` to focus it. When composing through `render`, forward the supplied props and ref to a native input. Customize the surrounding layout with a separate element, or use the `NumberField.Root` and `NumberField.Group` parts when wrapper access is required. Combine the input with `Field.Description` and `Field.Error` for guidance and validation messages.
+
+The preset deliberately uses compact styling, Latin digits, up to 15 fraction digits, grouping from five integer digits, and the same `step` for ordinary, Shift, and Alt adjustments. These choices apply only to `NumberStepper`. The full `NumberField` primitive retains Base UI's formatting and stepping options.
## Front component renderer
-The React and Preact renderer sandboxes support typing, keyboard adjustments, bounds, and form values. Pointer stepping is currently blocked because the sandbox input does not implement `setSelectionRange`. Pasting is not supported: without input selection, the pasted text is inserted around the whole value, that wrong number is reported, and the front component then stops rendering. These limitations do not affect normal React rendering.
+The React and Preact renderer sandboxes support typing, keyboard adjustments, bounds, form values, pointer stepping, and pasting over selected text. The renderer gallery verifies these interactions in both runtimes. As with `NumberField`, pointer adjustments report changes, but the sandbox does not currently deliver the corresponding commit callback on pointer release. Ordinary React hosts retain the complete commit behavior.
## Props
diff --git a/packages/twenty-docs/ui/primitives/input/number-field.mdx b/packages/twenty-docs/ui/primitives/input/number-field.mdx
new file mode 100644
index 00000000000..72a462ff4dd
--- /dev/null
+++ b/packages/twenty-docs/ui/primitives/input/number-field.mdx
@@ -0,0 +1,171 @@
+---
+title: NumberField
+description: Compose a numeric field with locale formatting, stepping, native forms, and scrubbing.
+---
+
+import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';
+import NumberFieldReference from '/snippets/ui/generated/input/number-field.mdx';
+
+`NumberField` exposes all seven parts of the installed Base UI Number Field: `Root`, `Group`, `Input`, `Decrement`, `Increment`, `ScrubArea`, and `ScrubAreaCursor`. Import it from `twenty-ui/primitives/input`. It retains Base UI's numeric state, formatting, stepping, event details, and native form integration with Twenty UI styling for the input, group, and adjustment controls.
+
+For the compact preset with fixed formatting and modifier-step defaults, use [NumberStepper](/ui/components/input/number-stepper) from `twenty-ui/components/input`.
+
+<StoryEmbed
+ storyId="ui-input-numberfield--default"
+ title="NumberField example"
+ height={200}
+/>
+
+## Compose a field
+
+`Root` owns numeric state. `Input` is the visible text input. Use `Group` to arrange optional decrement and increment controls around it. Supply content and accessible names for the controls; the primitive does not inject icons or labels.
+
+```tsx
+import { Field, NumberField } from 'twenty-ui/primitives/input';
+
+export const QuantityInput = () => (
+ <Field.Root>
+ <Field.Label>Quantity</Field.Label>
+ <NumberField.Root name="quantity" defaultValue={3} min={0} max={10}>
+ <NumberField.Group>
+ <NumberField.Decrement aria-label="Decrease quantity">
+ −
+ </NumberField.Decrement>
+ <NumberField.Input />
+ <NumberField.Increment aria-label="Increase quantity">
+ +
+ </NumberField.Increment>
+ </NumberField.Group>
+ </NumberField.Root>
+ <Field.Description>Choose up to ten items.</Field.Description>
+ </Field.Root>
+);
+```
+
+`Field.Label`, `Field.Description`, and `Field.Error` associate with the visible input. Alternatively, pass `aria-label` or `aria-labelledby` to `Input`. The default `aria-roledescription` is `Number field`; it does not provide an accessible name.
+
+## Values and callbacks
+
+Omit `value` for an uncontrolled field, and supply a numeric `defaultValue` when an initial value is needed. Omitting `defaultValue` starts empty. For a controlled field, pass a number or `null` through `value` and update it from `onValueChange`.
+
+```tsx
+import { useState } from 'react';
+import { Field, NumberField } from 'twenty-ui/primitives/input';
+
+export const PriceInput = () => {
+ const [price, setPrice] = useState<number | null>(null);
+ const [savedPrice, setSavedPrice] = useState<number | null>(null);
+
+ return (
+ <Field.Root>
+ <Field.Label>Price</Field.Label>
+ <NumberField.Root
+ value={price}
+ onValueChange={setPrice}
+ onValueCommitted={setSavedPrice}
+ >
+ <NumberField.Input placeholder="Enter a price" />
+ </NumberField.Root>
+ <Field.Description>
+ Last committed price: {savedPrice ?? 'empty'}
+ </Field.Description>
+ </Field.Root>
+ );
+};
+```
+
+Clearing reports `null`, including when `min` is set. Incomplete drafts such as `-` remain editable without reporting an invalid number. Parseable typing updates the numeric value before the edit is committed. The first step from an empty value starts at zero clamped to the bounds; subsequent steps use the active step amount.
+
+`onValueChange(value, details)` retains the native `event`, `reason`, `cancel`, `allowPropagation`, `isCanceled`, `isPropagationAllowed`, `trigger`, and optional `direction`. Reasons distinguish typing (`input-change`), clearing (`input-clear`), blur normalization (`input-blur`), paste (`input-paste`), keyboard, increment or decrement presses, wheel, scrubbing, and native autofill (`none`). Calling `cancel()` prevents the numeric state update; controlled callers still choose their accepted value.
+
+`onValueCommitted(value, details)` runs on blur after editing, on pointer release after stepping or scrubbing, and immediately for keyboard and wheel adjustments. Clearing commits `null` on blur. Commit details contain `event` and `reason`; they are generic details without change cancellation methods. Focusing and blurring an untouched field does not itself commit a value when no numeric normalization is needed. Explicit rounding options can normalize and commit an untouched value.
+
+## Locale and formatting
+
+Set `locale` and `format` on `Root`. They retain the installed Base UI contract: `locale` accepts `Intl.LocalesArgument`, and `format` accepts `Intl.NumberFormatOptions`. Display formatting is separate from the raw numeric value submitted by the form. The primitive does not force Latin digits, grouping, precision, or modifier steps.
+
+<StoryEmbed
+ storyId="ui-input-numberfield--locale-currency"
+ title="Locale and currency formatting"
+ height={200}
+/>
+
+```tsx
+import { Field, NumberField } from 'twenty-ui/primitives/input';
+
+export const AmountInput = () => (
+ <Field.Root>
+ <Field.Label>Amount in euros</Field.Label>
+ <NumberField.Root
+ name="amount"
+ defaultValue={1234.5}
+ locale="de-DE"
+ format={{ style: 'currency', currency: 'EUR' }}
+ step={0.5}
+ smallStep={0.01}
+ largeStep={10}
+ >
+ <NumberField.Input />
+ </NumberField.Root>
+ </Field.Root>
+);
+```
+
+Typing and paste use the configured locale and supported format symbols. Blur normalizes the displayed text. Explicit precision or rounding options can also normalize the committed number; without those options, formatting alone does not replace an untouched numeric value with rounded display text.
+
+## Stepping and bounds
+
+`step` defaults to `1`, `smallStep` to `0.1` while Alt is held, and `largeStep` to `10` while Shift is held. The active step applies to buttons, Arrow Up and Arrow Down, wheel, and scrub-area movement. `snapOnStep` defaults to `false`; enable it to snap adjustments to the active step. Home and End select the corresponding explicit bound. Native key handlers can call `event.preventBaseUIHandler()` when the owner needs to override Base UI's keyboard behavior.
+
+`min` and `max` are inclusive. Step interactions stay bounded. By default, typed and pasted values also clamp numerically, with the draft normalized on blur. Set `allowOutOfRange` to accept direct edits outside those bounds and let native range validation or application validation report the problem.
+
+`step="any"` disables native step validation while interactive stepping uses `1` and the configured modifier steps. With a numeric step, provide `min` explicitly when native submission must validate step alignment. The numeric step does not round every typed value to a step.
+
+## Scrubbing
+
+`ScrubArea` changes the numeric value as the pointer moves. It supports horizontal or vertical movement, `pixelSensitivity`, and optional `teleportDistance`. The active step and bounds also apply to scrubbing. Use a visible label as the scrub target while keeping the input available for keyboard editing.
+
+<StoryEmbed
+ storyId="ui-input-numberfield--with-scrubbing"
+ title="Scrub the width label"
+ height={220}
+/>
+
+Compose `ScrubAreaCursor` inside `ScrubArea` for a custom cursor during pointer-lock scrubbing. It portals to the document body while active. Base UI falls back to the normal cursor for touch input, denied pointer lock, and WebKit. Set `allowWheelScrub` on `Root` to allow wheel adjustment while the input is focused and hovered; it defaults to `false`.
+
+## Forms and disabled state
+
+`Root` renders a hidden native `input type="number"` for raw numeric submission and native validation. Set `name`, `form`, `required`, `min`, `max`, and `step` on `Root`. `form` can associate the field with a form elsewhere in the document. The default adjustment controls use `type="button"`, so stepping does not submit the form.
+
+`disabled` prevents interaction and excludes the value from submission. `readOnly` prevents changes while keeping the visible input focusable and its form value available. Use a controlled value when the application must reset numeric state; native form reset does not reset it.
+
+## DOM targets and customization
+
+| Part or prop | Default DOM and ref target |
+| ------------------------- | ------------------------------------------------------------------------------ |
+| `Root` / `Root.ref` | The outer `div` |
+| `Root.inputRef` | The hidden native number input |
+| `Root.id` | Associates the visible text input's ID |
+| `Group` / `Group.ref` | The group `div` |
+| `Input` / `Input.ref` | The visible `input type="text"` |
+| `Decrement` / `Increment` | Native buttons |
+| `ScrubArea` | A `span` |
+| `ScrubAreaCursor` | A `span` portaled to the document body while active; its ref is otherwise null |
+
+Native attributes, `className`, `style`, and `render` target the part receiving them. Input customization applies to the visible control; wrapper customization belongs on `Root` or `Group`. To focus the control, use `Input.ref`, rather than `Root.inputRef`.
+
+Each part accepts an element or callback through `render`, with the corresponding public state type. Forward the supplied props and ref to the appropriate DOM element so editing, focus, labels, and validation keep working. When a stepping control renders a non-button element, set `nativeButton={false}`. `className` and `style` also accept state callbacks. State includes numeric `value`, formatted `inputValue`, `required`, `disabled`, `readOnly`, `scrubbing`, and inherited Field state.
+
+The public entry points export the props and state type for every part, plus `NumberFieldRootChangeEventDetails`, `NumberFieldRootChangeEventReason`, `NumberFieldRootCommitEventDetails`, and `NumberFieldRootCommitEventReason`.
+
+## Front component renderer
+
+React and Preact sandbox fixtures verify initial locale formatting, localized paste, raw numeric form values, accessible labels, refs, render composition, blur commits, keyboard change and commit details, and pointer change details.
+
+Sequential typing after clearing a controlled localized field currently resets the caret in the renderer: typing `2` and then `3` can produce `32`. A formatted pointer adjustment can also race with blur and leave the visible input showing the previous value. Pointer adjustments report changes, but pointer release does not deliver the corresponding commit callback; later blur can commit with `input-blur` instead. Dragging the scrub area and using its custom cursor are also unavailable in the sandbox. These limitations do not affect ordinary React hosts.
+
+## Props
+
+The reference is generated from the installed public component types. Native attributes and event handlers are also accepted on parts that render elements.
+
+<NumberFieldReference />
diff --git a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
index a52d2714473..5d65540f0e6 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
@@ -17,6 +17,7 @@ import { progressTest } from '@/__stories__/twenty-ui-gallery/utils/progressTest
import { inputTest } from '@/__stories__/twenty-ui-gallery/utils/inputTest';
import { numberStepperTest } from '@/__stories__/twenty-ui-gallery/utils/numberStepperTest';
import { numberStepperSelectionTest } from '@/__stories__/twenty-ui-gallery/utils/numberStepperSelectionTest';
+import { numberFieldTest } from '@/__stories__/twenty-ui-gallery/utils/numberFieldTest';
import { settingsRowTest } from '@/__stories__/twenty-ui-gallery/utils/settingsRowTest';
import { layoutTest } from '@/__stories__/twenty-ui-gallery/utils/layoutTest';
import { listItemTest } from '@/__stories__/twenty-ui-gallery/utils/listItemTest';
@@ -173,6 +174,18 @@ export const NumberStepperSelectionPreact: Story = createGalleryStory({
play: numberStepperSelectionTest,
});
+export const NumberFieldReact: Story = createGalleryStory({
+ frontComponentBundleName: 'twenty-ui-number-field',
+ runtime: 'react',
+ play: numberFieldTest,
+});
+
+export const NumberFieldPreact: Story = createGalleryStory({
+ frontComponentBundleName: 'twenty-ui-number-field',
+ runtime: 'preact',
+ play: numberFieldTest,
+});
+
export const JsonVisualizerReact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-json-visualizer-gallery',
runtime: 'react',
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md
index 7eca9124ca7..ae34c653491 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md
@@ -9,6 +9,8 @@ so Dropdown-based popups never open there.
The field-controls fixture checks native input/textarea refs and change targets, typed textarea render composition, Field labels and controlled multiline value updates in React and Preact.
Textarea auto-resize remains a renderer limitation. Geometry reads use cached host snapshots, so resetting inline height and reading scrollHeight in the same turn cannot measure the updated layout. These stale reads can also produce cumulative height growth instead of fitting the current content. The field fixture verifies values, refs, events and accessibility without treating incidental height changes as resize acceptance. Standalone Textarea browser checks pass.
+NumberField checks locale formatting and localized paste, controlled empty values, uncontrolled typing, bounds, keyboard commits, pointer value changes, callback event details, accessible labels, native forms, refs and render composition in both runtimes. Sequential typing after clearing a formatted value can reset the caret and insert subsequent digits before earlier input. Formatted pointer edits can also restore stale display values when host blur races the worker update. Pointer button release does not emit its commit callback, although host blur can emit an input-blur commit. ScrubArea can enter its scrubbing state, but drag movement and release do not reach the worker window listeners; pointer lock and the custom scrub cursor are also unavailable. These renderer limits apply independently of the standalone React NumberField browser checks.
+
Popover composes Portal, Positioner, Popup, Arrow and Viewport. Its focused React/Preact cases check controlled trigger requests, native attributes, Button render composition, DOM refs and callback reasons. These checks do not establish popup visibility, geometry or dismissal support. The omitted-container popup still requires C04/C05/C07 renderer acceptance.
Typography composition checks constrained text, explicit links, semantic elements, refs and native focus handlers in both runtimes. Overflow tooltip popup acceptance still depends on renderer portal and geometry support.
@@ -41,6 +43,7 @@ effect within the interaction timeout.
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `twenty-ui-field-controls` | Field, Input, InputGroup, Textarea |
| `twenty-ui-number-stepper` | NumberStepper (pointer stepping, selected-range paste, caret restoration, keyboard bounds, disabled/read-only state and forms) |
+| `twenty-ui-number-field` | NumberField (locale formatting and paste, controlled/uncontrolled values, callback details, native forms and refs, bounds and render composition) |
| `twenty-ui-autocomplete` | Autocomplete (caret keys, controlled editing, composition, filtering, disabled state, Empty; `TwentyUiAutocomplete.stories.tsx`) |
| `twenty-ui-display-helpers` | Text |
| `twenty-ui-avatar-controls` | Avatar (stable presentational root, compound fallback, refs, explicit button/link composition and native keyboard/disabled behavior) |
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-number-field.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-number-field.front-component.tsx
new file mode 100644
index 00000000000..c3cea9b690f
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-number-field.front-component.tsx
@@ -0,0 +1,161 @@
+import { createElement, useRef, useState } from 'react';
+import { defineFrontComponent } from 'twenty-sdk/define';
+import { Button, Field, NumberField } from 'twenty-ui/primitives/input';
+import { Text } from 'twenty-ui/primitives/typography';
+
+import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';
+
+const NumberFieldExample = () => {
+ const rootRef = useRef<HTMLDivElement>(null);
+ const inputRef = useRef<HTMLInputElement>(null);
+ const nativeInputRef = useRef<HTMLInputElement>(null);
+ const [value, setValue] = useState<number | null>(12.5);
+ const [changeDetails, setChangeDetails] = useState('none');
+ const [commitDetails, setCommitDetails] = useState('none');
+ const [quantityDetails, setQuantityDetails] = useState('none');
+ const [refTargets, setRefTargets] = useState('');
+ const [scrubDetails, setScrubDetails] = useState('none');
+
+ return (
+ <TwentyUiGalleryCard title="NumberField">
+ <form aria-label="Amount form">
+ <Field.Root>
+ <Field.Label>Localized amount</Field.Label>
+ <NumberField.Root
+ ref={rootRef}
+ inputRef={nativeInputRef}
+ name="amount"
+ locale="de-DE"
+ format={{ minimumFractionDigits: 2, maximumFractionDigits: 2 }}
+ value={value}
+ step={0.25}
+ smallStep={0.05}
+ largeStep={5}
+ onValueChange={(nextValue, details) => {
+ setValue(nextValue);
+ setChangeDetails(
+ `${details.reason}/${details.event.type}/${typeof details.cancel}`,
+ );
+ }}
+ onValueCommitted={(nextValue, details) =>
+ setCommitDetails(
+ `${nextValue ?? 'empty'}/${details.reason}/${details.event.type}`,
+ )
+ }
+ render={(props, state) =>
+ createElement('div', {
+ ...props,
+ 'data-testid': 'amount-root',
+ 'data-value': state.value ?? 'empty',
+ })
+ }
+ >
+ <NumberField.Group
+ render={<section aria-label="Amount controls" />}
+ >
+ <NumberField.Decrement
+ aria-label="Decrease amount"
+ render={<Button />}
+ >
+ Decrease amount
+ </NumberField.Decrement>
+ <NumberField.Input
+ ref={inputRef}
+ render={(props, state) =>
+ createElement('input', {
+ ...props,
+ 'data-testid': 'amount-input',
+ 'data-value': state.value ?? 'empty',
+ })
+ }
+ />
+ <NumberField.Increment
+ aria-label="Increase amount"
+ render={<Button />}
+ >
+ Increase amount
+ </NumberField.Increment>
+ </NumberField.Group>
+ </NumberField.Root>
+ <Field.Description>
+ Enter an amount using a decimal comma
+ </Field.Description>
+ </Field.Root>
+ </form>
+ <Text role="status" aria-label="Amount state">
+ Value: {value ?? 'empty'}; Change: {changeDetails}; Commit:{' '}
+ {commitDetails}
+ </Text>
+ <Button
+ onClick={() => {
+ setRefTargets(
+ `${rootRef.current?.tagName}/${inputRef.current?.tagName}:${inputRef.current?.type}/${nativeInputRef.current?.tagName}:${nativeInputRef.current?.type}/${nativeInputRef.current?.value}`,
+ );
+ }}
+ >
+ Inspect amount refs
+ </Button>
+ <Text role="status" aria-label="Amount ref targets">
+ {refTargets}
+ </Text>
+ <Field.Root>
+ <Field.Label>Uncontrolled quantity</Field.Label>
+ <NumberField.Root
+ defaultValue={2}
+ min={0}
+ max={4}
+ step={2}
+ onValueChange={(nextValue, details) =>
+ setQuantityDetails(
+ `${nextValue ?? 'empty'}/${details.reason}/${details.event.type}`,
+ )
+ }
+ >
+ <NumberField.Group>
+ <NumberField.Decrement aria-label="Decrease uncontrolled quantity" />
+ <NumberField.Input />
+ <NumberField.Increment aria-label="Increase uncontrolled quantity" />
+ </NumberField.Group>
+ </NumberField.Root>
+ </Field.Root>
+ <Text role="status" aria-label="Quantity details">
+ {quantityDetails}
+ </Text>
+ <NumberField.Root defaultValue={6} disabled>
+ <NumberField.Group>
+ <NumberField.Input aria-label="Disabled number field" />
+ <NumberField.Increment aria-label="Increase disabled number field" />
+ </NumberField.Group>
+ </NumberField.Root>
+ <Field.Root>
+ <NumberField.Root
+ defaultValue={10}
+ onValueChange={(nextValue, details) =>
+ setScrubDetails(`${nextValue}/${details.reason}`)
+ }
+ onValueCommitted={(nextValue, details) =>
+ setScrubDetails(`${nextValue}/${details.reason}/committed`)
+ }
+ >
+ <NumberField.ScrubArea data-testid="number-scrub-area">
+ <Field.Label>Scrubbable quantity</Field.Label>
+ <NumberField.ScrubAreaCursor>
+ <span aria-hidden>↔</span>
+ </NumberField.ScrubAreaCursor>
+ </NumberField.ScrubArea>
+ <NumberField.Input />
+ </NumberField.Root>
+ </Field.Root>
+ <Text role="status" aria-label="Scrub state">
+ {scrubDetails}
+ </Text>
+ </TwentyUiGalleryCard>
+ );
+};
+
+export default defineFrontComponent({
+ universalIdentifier: '1c9fdf30-13df-4d27-ae69-fdadcf952758',
+ name: 'twenty-ui-number-field',
+ description: 'Compound numeric controls, locale formatting and native refs',
+ component: NumberFieldExample,
+});
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-number-stepper.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-number-stepper.front-component.tsx
index e1fc3769105..7ed4d7d2a83 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-number-stepper.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-number-stepper.front-component.tsx
@@ -1,6 +1,7 @@
import { useState } from 'react';
import { defineFrontComponent } from 'twenty-sdk/define';
-import { Button, Field, NumberStepper } from 'twenty-ui/primitives/input';
+import { NumberStepper } from 'twenty-ui/components';
+import { Button, Field } from 'twenty-ui/primitives/input';
import { Text } from 'twenty-ui/primitives/typography';
import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/numberFieldTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/numberFieldTest.ts
new file mode 100644
index 00000000000..70a9b9c0ccc
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/numberFieldTest.ts
@@ -0,0 +1,116 @@
+import { expect, userEvent, waitFor, within } from 'storybook/test';
+
+import { errorHandler } from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';
+import { expectFrontComponentMounted } from '@/__stories__/shared/test-utils/matchers/expectFrontComponentMounted';
+import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
+
+export const numberFieldTest: TwentyUiGalleryPlayFunction = async ({
+ canvasElement,
+}) => {
+ const canvas = within(canvasElement);
+ await expectFrontComponentMounted(canvas);
+
+ const amount = canvas.getByRole<HTMLInputElement>('textbox', {
+ name: 'Localized amount',
+ });
+ const amountState = canvas.getByRole('status', { name: 'Amount state' });
+ const root = canvas.getByTestId('amount-root');
+ const controls = canvas.getByRole('group', { name: 'Amount controls' });
+ const form = canvas.getByRole<HTMLFormElement>('form', {
+ name: 'Amount form',
+ });
+
+ expect(amount).toHaveValue('12,50');
+ expect(amount).toHaveAttribute('type', 'text');
+ expect(amount).toHaveAccessibleDescription(
+ 'Enter an amount using a decimal comma',
+ );
+ expect(controls.tagName).toBe('SECTION');
+ expect(root).toHaveAttribute('data-value', '12.5');
+ expect(new FormData(form).get('amount')).toBe('12.5');
+
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Inspect amount refs' }),
+ );
+ await waitFor(() =>
+ expect(
+ canvas.getByRole('status', { name: 'Amount ref targets' }),
+ ).toHaveTextContent('HTML-DIV/HTML-INPUT:text/HTML-INPUT:number/12.5'),
+ );
+
+ await userEvent.click(amount);
+ await waitFor(() => expect(amount).toHaveFocus());
+ await userEvent.clear(amount);
+ await waitFor(() => expect(amountState).toHaveTextContent('Value: empty'));
+ expect(new FormData(form).get('amount')).toBe('');
+ await waitFor(() => expect(amount).toHaveValue(''));
+ await userEvent.paste('23,75');
+ await waitFor(() => expect(amountState).toHaveTextContent('Value: 23.75'));
+ expect(amountState).toHaveTextContent(
+ /Change: input-(change|paste)\/(change|input|paste)\/function/,
+ );
+ expect(amountState).toHaveTextContent('Commit: none');
+ await userEvent.tab();
+ await waitFor(() =>
+ expect(amountState).toHaveTextContent(
+ /Commit: 23\.75\/input-blur\/(blur|focusout)/,
+ ),
+ );
+ expect(amount).toHaveValue('23,75');
+ expect(amount).toHaveAttribute('data-value', '23.75');
+ expect(new FormData(form).get('amount')).toBe('23.75');
+
+ await userEvent.click(amount);
+ await userEvent.keyboard('{ArrowUp}');
+ await waitFor(() =>
+ expect(amountState).toHaveTextContent('Commit: 24/keyboard/keydown'),
+ );
+ await userEvent.keyboard('{ArrowDown}');
+ await waitFor(() =>
+ expect(amountState).toHaveTextContent('Commit: 23.75/keyboard/keydown'),
+ );
+ await waitFor(() => expect(amount).toHaveValue('23,75'));
+ expect(new FormData(form).get('amount')).toBe('23.75');
+
+ const quantity = canvas.getByRole('textbox', {
+ name: 'Uncontrolled quantity',
+ });
+ const increment = canvas.getByRole('button', {
+ name: 'Increase uncontrolled quantity',
+ });
+ const decrement = canvas.getByRole('button', {
+ name: 'Decrease uncontrolled quantity',
+ });
+ expect(quantity).toHaveValue('2');
+ await userEvent.click(increment);
+ await waitFor(() => expect(quantity).toHaveValue('4'));
+ await waitFor(() =>
+ expect(
+ canvas.getByRole('status', { name: 'Quantity details' }),
+ ).toHaveTextContent('4/increment-press/pointerdown'),
+ );
+ expect(increment).toBeDisabled();
+ await userEvent.click(quantity);
+ await userEvent.keyboard('{Home}{ArrowDown}');
+ await waitFor(() => expect(quantity).toHaveValue('0'));
+ expect(decrement).toBeDisabled();
+ await userEvent.clear(quantity);
+ await waitFor(() => expect(quantity).toHaveValue(''));
+ await userEvent.type(quantity, '2');
+ await waitFor(() => expect(quantity).toHaveValue('2'));
+
+ const disabledInput = canvas.getByRole('textbox', {
+ name: 'Disabled number field',
+ });
+ expect(disabledInput).toBeDisabled();
+ await userEvent.click(
+ canvas.getByRole('button', {
+ name: 'Increase disabled number field',
+ }),
+ );
+ expect(disabledInput).toHaveValue('6');
+ expect(
+ canvas.getByRole('textbox', { name: 'Scrubbable quantity' }),
+ ).toHaveValue('10');
+ expect(errorHandler).not.toHaveBeenCalled();
+};
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsCounter.tsx b/packages/twenty-front/src/modules/settings/components/SettingsCounter.tsx
index f91b6a68c53..25211a1b93b 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsCounter.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsCounter.tsx
@@ -11,7 +11,7 @@ import { isDefined } from 'twenty-shared/utils';
import {
NumberStepper,
type NumberStepperProps,
-} from 'twenty-ui/primitives/input';
+} from 'twenty-ui/components/input';
import { themeCssVariables } from 'twenty-ui/theme';
const SETTINGS_COUNTER_CARET_NAVIGATION_KEYS: string[] = [Key.Home, Key.End];
diff --git a/packages/twenty-shared/src/constants/DocumentationPaths.ts b/packages/twenty-shared/src/constants/DocumentationPaths.ts
index bc75dd6b936..ef765e8629b 100644
--- a/packages/twenty-shared/src/constants/DocumentationPaths.ts
+++ b/packages/twenty-shared/src/constants/DocumentationPaths.ts
@@ -152,6 +152,7 @@ export const DOCUMENTATION_PATHS = {
UI_COMPONENTS_INPUT_LIGHT_ICON_BUTTON:
'/ui/components/input/light-icon-button',
UI_COMPONENTS_INPUT_MAIN_BUTTON: '/ui/components/input/main-button',
+ UI_COMPONENTS_INPUT_NUMBER_STEPPER: '/ui/components/input/number-stepper',
UI_COMPONENTS_INPUT_PHONE_COUNTRY_PICKER:
'/ui/components/input/phone-country-picker',
UI_COMPONENTS_INPUT_SEARCH_INPUT: '/ui/components/input/search-input',
@@ -191,7 +192,7 @@ export const DOCUMENTATION_PATHS = {
UI_PRIMITIVES_INPUT_FIELD: '/ui/primitives/input/field',
UI_PRIMITIVES_INPUT_INPUT: '/ui/primitives/input/input',
UI_PRIMITIVES_INPUT_INPUT_GROUP: '/ui/primitives/input/input-group',
- UI_PRIMITIVES_INPUT_NUMBER_STEPPER: '/ui/primitives/input/number-stepper',
+ UI_PRIMITIVES_INPUT_NUMBER_FIELD: '/ui/primitives/input/number-field',
UI_PRIMITIVES_INPUT_RADIO: '/ui/primitives/input/radio',
UI_PRIMITIVES_INPUT_RADIO_GROUP: '/ui/primitives/input/radio-group',
UI_PRIMITIVES_INPUT_SEGMENTED_CONTROL:
diff --git a/packages/twenty-ui/.size-limit.json b/packages/twenty-ui/.size-limit.json
index d975f11aa39..baad3bbd7e9 100644
--- a/packages/twenty-ui/.size-limit.json
+++ b/packages/twenty-ui/.size-limit.json
@@ -13,7 +13,7 @@
{
"name": "components",
"path": "dist/components.mjs",
- "limit": "140 kB"
+ "limit": "145 kB"
},
{
"name": "components/code-editor",
diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.ts
index b433cffaae6..cd1d17a9ba7 100644
--- a/packages/twenty-ui/docs/components.ts
+++ b/packages/twenty-ui/docs/components.ts
@@ -20,6 +20,7 @@ import { RADIO_PROP_DESCRIPTIONS } from './radioPropDescriptions';
import { PHONE_COUNTRY_PICKER_PART_PROP_DESCRIPTIONS } from './phoneCountryPickerPartPropDescriptions';
import { SEARCH_INPUT_PROP_DESCRIPTIONS } from './searchInputPropDescriptions';
import { NUMBER_STEPPER_PROP_DESCRIPTIONS } from './numberStepperPropDescriptions';
+import { NUMBER_FIELD_PART_PROP_DESCRIPTIONS } from './numberFieldPartPropDescriptions';
import { IMAGE_INPUT_PROP_DESCRIPTIONS } from './imageInputPropDescriptions';
import { ANIMATED_ICON_CROSSFADE_PROP_DESCRIPTIONS } from './animatedIconCrossfadePropDescriptions';
import { MENU_ITEM_PROP_DESCRIPTIONS } from './menuItemPropDescriptions';
@@ -331,11 +332,51 @@ export const DOCUMENTED_COMPONENTS = [
propDescriptions: INPUT_GROUP_PROP_DESCRIPTIONS,
},
{
- name: 'NumberStepper',
- source: 'primitives/input/NumberStepper/NumberStepper.tsx',
+ name: 'NumberField',
+ source: 'primitives/input/NumberField/NumberField.tsx',
entryPoint: 'twenty-ui/primitives/input',
- slug: 'input/number-stepper',
+ slug: 'input/number-field',
+ parts: [
+ 'Root',
+ 'Group',
+ 'Input',
+ 'Decrement',
+ 'Increment',
+ 'ScrubArea',
+ 'ScrubAreaCursor',
+ ],
+ partPropDescriptions: NUMBER_FIELD_PART_PROP_DESCRIPTIONS,
+ partPropDefaults: {
+ Root: {
+ defaultValue: 'empty',
+ step: '1',
+ smallStep: '0.1',
+ largeStep: '10',
+ allowOutOfRange: 'false',
+ allowWheelScrub: 'false',
+ snapOnStep: 'false',
+ required: 'false',
+ disabled: 'false',
+ readOnly: 'false',
+ },
+ Decrement: { nativeButton: 'true' },
+ Increment: { nativeButton: 'true' },
+ ScrubArea: { direction: 'horizontal', pixelSensitivity: '2' },
+ },
+ },
+ {
+ name: 'NumberStepper',
+ source: 'components/input/NumberStepper/NumberStepper.tsx',
+ entryPoint: 'twenty-ui/components/input',
+ slug: 'components/input/number-stepper',
propDescriptions: NUMBER_STEPPER_PROP_DESCRIPTIONS,
+ propDefaults: {
+ step: '1',
+ allowOutOfRange: 'false',
+ showButtons: 'true',
+ decrementLabel: 'Decrease value',
+ incrementLabel: 'Increase value',
+ },
},
{
name: 'Textarea',
diff --git a/packages/twenty-ui/docs/module-ownership.json b/packages/twenty-ui/docs/module-ownership.json
index 1812eeddaae..f5b039bb3f5 100644
--- a/packages/twenty-ui/docs/module-ownership.json
+++ b/packages/twenty-ui/docs/module-ownership.json
@@ -22,7 +22,7 @@
"ListItem",
"Loader",
"Menu",
- "NumberStepper",
+ "NumberField",
"OverflowingTextWithTooltip",
"Popover",
"ProgressBar",
@@ -69,6 +69,7 @@
"MenuItemSuggestion",
"MenuPicker",
"MetricRow",
+ "NumberStepper",
"OverflowingList",
"PhoneCountryPicker",
"SearchInput",
diff --git a/packages/twenty-ui/docs/numberFieldPartPropDescriptions.ts b/packages/twenty-ui/docs/numberFieldPartPropDescriptions.ts
new file mode 100644
index 00000000000..3b4137d0d48
--- /dev/null
+++ b/packages/twenty-ui/docs/numberFieldPartPropDescriptions.ts
@@ -0,0 +1,112 @@
+import { type ComponentProps } from 'react';
+
+import { type NumberField } from '../src/primitives/input/NumberField/NumberField';
+
+const NUMBER_FIELD_COMMON_PROP_DESCRIPTIONS = {
+ className:
+ 'Class applied to this part, or a callback receiving its NumberField state.',
+ style:
+ 'Inline styles applied to this part, or a callback receiving its NumberField state.',
+ render:
+ 'Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element.',
+};
+
+export const NUMBER_FIELD_PART_PROP_DESCRIPTIONS = {
+ Root: {
+ ...NUMBER_FIELD_COMMON_PROP_DESCRIPTIONS,
+ children: 'Composed NumberField parts and supporting content.',
+ ref: 'Ref to the root div, or the element composed through Root.render.',
+ inputRef:
+ 'Ref to the hidden native number input used for submission and validation. Use Input.ref to focus the visible text input.',
+ id: 'ID associated with the visible input. Generated when omitted.',
+ value: 'Controlled raw numeric value. Use null for an empty field.',
+ defaultValue:
+ 'Initial uncontrolled number. Omit to start empty; the public type accepts a number.',
+ locale:
+ 'Locale or locale list used to format and parse numbers. Defaults to the runtime locale.',
+ format:
+ 'Intl.NumberFormat options for display and parsing, including currency, units, percent, grouping, and precision. Explicit rounding options can normalize the committed value on blur.',
+ onValueChange:
+ 'Receives the next number or null and change details with the native event, reason, cancellation and propagation methods, and optional stepping direction.',
+ onValueCommitted:
+ 'Receives the committed number or null and generic details containing event and reason. Typing commits on blur; pointer steps and scrubbing commit on release; keyboard and wheel changes commit immediately.',
+ min: 'Inclusive minimum for stepping and native range validation.',
+ max: 'Inclusive maximum for stepping and native range validation.',
+ allowOutOfRange:
+ 'Allows typed, pasted, and autofilled values outside min and max. Native range validation still applies; step interactions remain bounded.',
+ step: 'Base amount for buttons, arrow keys, wheel, and scrubbing. Use any to disable native step validation while stepping by 1.',
+ smallStep: 'Amount used while Alt is held. Defaults to 0.1.',
+ largeStep: 'Amount used while Shift is held. Defaults to 10.',
+ snapOnStep:
+ 'Snaps step interactions to multiples of the active step. Defaults to false.',
+ allowWheelScrub:
+ 'Allows wheel adjustments while the visible input is focused and hovered. Defaults to false.',
+ name: 'Name of the raw numeric value submitted by the hidden input.',
+ form: 'ID of the form owning the hidden native number input.',
+ required: 'Requires a numeric value for native form submission.',
+ disabled:
+ 'Prevents interaction and excludes the value from form submission.',
+ readOnly: 'Prevents changes while keeping the visible input focusable.',
+ } satisfies Partial<
+ Record<keyof ComponentProps<typeof NumberField.Root>, string>
+ >,
+ Group: {
+ ...NUMBER_FIELD_COMMON_PROP_DESCRIPTIONS,
+ children: 'The visible input and any increment or decrement controls.',
+ ref: 'Ref to the group div, or the element composed through Group.render.',
+ } satisfies Partial<
+ Record<keyof ComponentProps<typeof NumberField.Group>, string>
+ >,
+ Input: {
+ ...NUMBER_FIELD_COMMON_PROP_DESCRIPTIONS,
+ ref: 'Ref to the visible native text input.',
+ render:
+ 'Composes the visible text input with an element or render callback. Forward the supplied props and ref to an input. Customize layout through Root or Group.',
+ 'aria-roledescription':
+ 'Describes the role to assistive technology. Defaults to Number field; use Field.Label, aria-label, or aria-labelledby for the accessible name.',
+ size: 'Native input size attribute. Use styles to customize visual dimensions.',
+ } satisfies Partial<
+ Record<keyof ComponentProps<typeof NumberField.Input>, string>
+ >,
+ Decrement: {
+ ...NUMBER_FIELD_COMMON_PROP_DESCRIPTIONS,
+ children:
+ 'Visible content for the decrement control. Supply its accessible name.',
+ ref: 'Ref to the decrement button, or the element composed through render.',
+ nativeButton:
+ 'Whether render composes a native button. Set false for a custom non-button element so Base UI supplies button interaction.',
+ } satisfies Partial<
+ Record<keyof ComponentProps<typeof NumberField.Decrement>, string>
+ >,
+ Increment: {
+ ...NUMBER_FIELD_COMMON_PROP_DESCRIPTIONS,
+ children:
+ 'Visible content for the increment control. Supply its accessible name.',
+ ref: 'Ref to the increment button, or the element composed through render.',
+ nativeButton:
+ 'Whether render composes a native button. Set false for a custom non-button element so Base UI supplies button interaction.',
+ } satisfies Partial<
+ Record<keyof ComponentProps<typeof NumberField.Increment>, string>
+ >,
+ ScrubArea: {
+ ...NUMBER_FIELD_COMMON_PROP_DESCRIPTIONS,
+ children:
+ 'Content the user can drag to adjust the number, plus an optional ScrubAreaCursor.',
+ ref: 'Ref to the scrub area span, or the element composed through render.',
+ direction: 'Pointer movement direction used for scrubbing.',
+ pixelSensitivity:
+ 'Pixels of pointer movement needed for a step. Larger values reduce sensitivity.',
+ teleportDistance:
+ 'Optional distance from the scrub area center at which the pointer loops around.',
+ } satisfies Partial<
+ Record<keyof ComponentProps<typeof NumberField.ScrubArea>, string>
+ >,
+ ScrubAreaCursor: {
+ ...NUMBER_FIELD_COMMON_PROP_DESCRIPTIONS,
+ children:
+ 'Custom cursor content shown during supported pointer-lock scrubbing.',
+ ref: 'Ref to the cursor span portaled to the document body while active. Null while absent.',
+ } satisfies Partial<
+ Record<keyof ComponentProps<typeof NumberField.ScrubAreaCursor>, string>
+ >,
+};
diff --git a/packages/twenty-ui/docs/numberStepperPropDescriptions.ts b/packages/twenty-ui/docs/numberStepperPropDescriptions.ts
index b9fb39b302e..0e58e97660c 100644
--- a/packages/twenty-ui/docs/numberStepperPropDescriptions.ts
+++ b/packages/twenty-ui/docs/numberStepperPropDescriptions.ts
@@ -1,12 +1,14 @@
import { type ComponentProps } from 'react';
-import { type NumberStepper } from '../src/primitives/input/NumberStepper/NumberStepper';
+import { type NumberStepper } from '../src/components/input/NumberStepper/NumberStepper';
export const NUMBER_STEPPER_PROP_DESCRIPTIONS = {
value: 'Controlled numeric value. Use null for an empty field.',
defaultValue: 'Initial number when the field owns its value.',
onValueChange:
'Called with the next number or null and event details when the numeric value changes. Clearing reports null; incomplete text does not report a number.',
+ onValueCommitted:
+ 'Called with the committed number or null and generic event details after an edit is committed. Details contain the native event and reason, without change cancellation methods.',
allowOutOfRange:
'Allows onValueChange to receive typed and pasted numbers outside the bounds. Native range validation still applies; buttons and keyboard adjustments remain bounded.',
min: 'Inclusive minimum. By default, onValueChange reports bounded numbers and out-of-range drafts normalize on blur.',
@@ -24,4 +26,6 @@ export const NUMBER_STEPPER_PROP_DESCRIPTIONS = {
ref: 'Ref to the visible input element.',
className: 'Class applied to the visible input.',
style: 'Inline styles applied to the visible input.',
+ render:
+ 'Composes the visible text input with an element or render callback. Forward the supplied props and ref to an input. Use a separate element to customize the surrounding layout.',
} satisfies Partial<Record<keyof ComponentProps<typeof NumberStepper>, string>>;
diff --git a/packages/twenty-ui/docs/public-exports.json b/packages/twenty-ui/docs/public-exports.json
index 017cb827655..c103a54a704 100644
--- a/packages/twenty-ui/docs/public-exports.json
+++ b/packages/twenty-ui/docs/public-exports.json
@@ -92,6 +92,7 @@
"LightButton": "components/input/LightButton/LightButton",
"LightIconButton": "components/input/LightIconButton/LightIconButton",
"MainButton": "components/input/MainButton/MainButton",
+ "NumberStepper": "components/input/NumberStepper/NumberStepper",
"PhoneCountryPicker": "components/input/PhoneCountryPicker/PhoneCountryPicker",
"SearchInput": "components/input/SearchInput/SearchInput"
},
@@ -106,6 +107,7 @@
"ImageInputProps": "components/input/ImageInput/types/ImageInputProps",
"LightButtonProps": "components/input/LightButton/types/LightButtonProps",
"LightIconButtonProps": "components/input/LightIconButton/types/LightIconButtonProps",
+ "NumberStepperProps": "components/input/NumberStepper/types/NumberStepperProps",
"PhoneCountryOption": "components/input/PhoneCountryPicker/types/PhoneCountryOption",
"PhoneCountryPickerOptionsProps": "components/input/PhoneCountryPicker/types/PhoneCountryPickerOptionsProps",
"PhoneCountryPickerTriggerProps": "components/input/PhoneCountryPicker/types/PhoneCountryPickerTriggerProps",
@@ -788,7 +790,7 @@
"Field": "primitives/input/Field/Field",
"Input": "primitives/input/Input/Input",
"InputGroup": "primitives/input/InputGroup/InputGroup",
- "NumberStepper": "primitives/input/NumberStepper/NumberStepper",
+ "NumberField": "primitives/input/NumberField/NumberField",
"Radio": "primitives/input/Radio/Radio",
"RadioGroup": "primitives/input/RadioGroup/RadioGroup",
"SegmentedControl": "primitives/input/SegmentedControl/SegmentedControl",
@@ -828,7 +830,24 @@
"InputGroupProps": "primitives/input/InputGroup/types/InputGroupProps",
"InputProps": "primitives/input/Input/types/InputProps",
"InputSize": "primitives/input/types/InputSize",
- "NumberStepperProps": "primitives/input/NumberStepper/types/NumberStepperProps",
+ "NumberFieldDecrementProps": "primitives/input/NumberField/types/NumberFieldDecrementProps",
+ "NumberFieldDecrementState": "primitives/input/NumberField/types/NumberFieldDecrementState",
+ "NumberFieldGroupProps": "primitives/input/NumberField/types/NumberFieldGroupProps",
+ "NumberFieldGroupState": "primitives/input/NumberField/types/NumberFieldGroupState",
+ "NumberFieldIncrementProps": "primitives/input/NumberField/types/NumberFieldIncrementProps",
+ "NumberFieldIncrementState": "primitives/input/NumberField/types/NumberFieldIncrementState",
+ "NumberFieldInputProps": "primitives/input/NumberField/types/NumberFieldInputProps",
+ "NumberFieldInputState": "primitives/input/NumberField/types/NumberFieldInputState",
+ "NumberFieldRootChangeEventDetails": "primitives/input/NumberField/types/NumberFieldRootChangeEventDetails",
+ "NumberFieldRootChangeEventReason": "primitives/input/NumberField/types/NumberFieldRootChangeEventReason",
+ "NumberFieldRootCommitEventDetails": "primitives/input/NumberField/types/NumberFieldRootCommitEventDetails",
+ "NumberFieldRootCommitEventReason": "primitives/input/NumberField/types/NumberFieldRootCommitEventReason",
+ "NumberFieldRootProps": "primitives/input/NumberField/types/NumberFieldRootProps",
+ "NumberFieldRootState": "primitives/input/NumberField/types/NumberFieldRootState",
+ "NumberFieldScrubAreaCursorProps": "primitives/input/NumberField/types/NumberFieldScrubAreaCursorProps",
+ "NumberFieldScrubAreaCursorState": "primitives/input/NumberField/types/NumberFieldScrubAreaCursorState",
+ "NumberFieldScrubAreaProps": "primitives/input/NumberField/types/NumberFieldScrubAreaProps",
+ "NumberFieldScrubAreaState": "primitives/input/NumberField/types/NumberFieldScrubAreaState",
"RadioGroupProps": "primitives/input/RadioGroup/types/RadioGroupProps",
"RadioProps": "primitives/input/Radio/types/RadioProps",
"SegmentedControlOption": "primitives/input/SegmentedControl/types/SegmentedControlOption",
diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.json
index 31483f51f3a..9b526d85ec3 100644
--- a/packages/twenty-ui/generated/components.docs.json
+++ b/packages/twenty-ui/generated/components.docs.json
@@ -2688,9 +2688,486 @@
]
},
{
- "name": "NumberStepper",
+ "name": "NumberField",
"entryPoint": "twenty-ui/primitives/input",
- "slug": "input/number-stepper",
+ "slug": "input/number-field",
+ "props": [],
+ "parts": [
+ {
+ "name": "Root",
+ "props": [
+ {
+ "name": "allowOutOfRange",
+ "type": "boolean",
+ "required": false,
+ "defaultValue": "false",
+ "description": "Allows typed, pasted, and autofilled values outside min and max. Native range validation still applies; step interactions remain bounded."
+ },
+ {
+ "name": "allowWheelScrub",
+ "type": "boolean",
+ "required": false,
+ "defaultValue": "false",
+ "description": "Allows wheel adjustments while the visible input is focused and hovered. Defaults to false."
+ },
+ {
+ "name": "children",
+ "type": "ReactNode",
+ "required": false,
+ "defaultValue": null,
+ "description": "Composed NumberField parts and supporting content."
+ },
+ {
+ "name": "className",
+ "type": "string | ((state: NumberFieldRootState) => string | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Class applied to this part, or a callback receiving its NumberField state."
+ },
+ {
+ "name": "defaultValue",
+ "type": "number",
+ "required": false,
+ "defaultValue": "empty",
+ "description": "Initial uncontrolled number. Omit to start empty; the public type accepts a number."
+ },
+ {
+ "name": "disabled",
+ "type": "boolean",
+ "required": false,
+ "defaultValue": "false",
+ "description": "Prevents interaction and excludes the value from form submission."
+ },
+ {
+ "name": "form",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "ID of the form owning the hidden native number input."
+ },
+ {
+ "name": "format",
+ "type": "NumberFormatOptions",
+ "required": false,
+ "defaultValue": null,
+ "description": "Intl.NumberFormat options for display and parsing, including currency, units, percent, grouping, and precision. Explicit rounding options can normalize the committed value on blur."
+ },
+ {
+ "name": "id",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "ID associated with the visible input. Generated when omitted."
+ },
+ {
+ "name": "inputRef",
+ "type": "Ref<HTMLInputElement>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Ref to the hidden native number input used for submission and validation. Use Input.ref to focus the visible text input."
+ },
+ {
+ "name": "largeStep",
+ "type": "number",
+ "required": false,
+ "defaultValue": "10",
+ "description": "Amount used while Shift is held. Defaults to 10."
+ },
+ {
+ "name": "locale",
+ "type": "LocalesArgument",
+ "required": false,
+ "defaultValue": null,
+ "description": "Locale or locale list used to format and parse numbers. Defaults to the runtime locale."
+ },
+ {
+ "name": "max",
+ "type": "number",
+ "required": false,
+ "defaultValue": null,
+ "description": "Inclusive maximum for stepping and native range validation."
+ },
+ {
+ "name": "min",
+ "type": "number",
+ "required": false,
+ "defaultValue": null,
+ "description": "Inclusive minimum for stepping and native range validation."
+ },
+ {
+ "name": "name",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Name of the raw numeric value submitted by the hidden input."
+ },
+ {
+ "name": "onValueChange",
+ "type": "((value: number | null, eventDetails: NumberFieldRootChangeEventDetails) => void)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Receives the next number or null and change details with the native event, reason, cancellation and propagation methods, and optional stepping direction."
+ },
+ {
+ "name": "onValueCommitted",
+ "type": "((value: number | null, eventDetails: NumberFieldRootCommitEventDetails) => void)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Receives the committed number or null and generic details containing event and reason. Typing commits on blur; pointer steps and scrubbing commit on release; keyboard and wheel changes commit immediately."
+ },
+ {
+ "name": "readOnly",
+ "type": "boolean",
+ "required": false,
+ "defaultValue": "false",
+ "description": "Prevents changes while keeping the visible input focusable."
+ },
+ {
+ "name": "ref",
+ "type": "Ref<HTMLDivElement>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Ref to the root div, or the element composed through Root.render."
+ },
+ {
+ "name": "render",
+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, NumberFieldRootState>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element."
+ },
+ {
+ "name": "required",
+ "type": "boolean",
+ "required": false,
+ "defaultValue": "false",
+ "description": "Requires a numeric value for native form submission."
+ },
+ {
+ "name": "smallStep",
+ "type": "number",
+ "required": false,
+ "defaultValue": "0.1",
+ "description": "Amount used while Alt is held. Defaults to 0.1."
+ },
+ {
+ "name": "snapOnStep",
+ "type": "boolean",
+ "required": false,
+ "defaultValue": "false",
+ "description": "Snaps step interactions to multiples of the active step. Defaults to false."
+ },
+ {
+ "name": "step",
+ "type": "number | \"any\"",
+ "required": false,
+ "defaultValue": "1",
+ "description": "Base amount for buttons, arrow keys, wheel, and scrubbing. Use any to disable native step validation while stepping by 1."
+ },
+ {
+ "name": "style",
+ "type": "CSSProperties | ((state: NumberFieldRootState) => CSSProperties | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Inline styles applied to this part, or a callback receiving its NumberField state."
+ },
+ {
+ "name": "value",
+ "type": "number | null",
+ "required": false,
+ "defaultValue": null,
+ "description": "Controlled raw numeric value. Use null for an empty field."
+ }
+ ]
+ },
+ {
+ "name": "Group",
+ "props": [
+ {
+ "name": "children",
+ "type": "ReactNode",
+ "required": false,
+ "defaultValue": null,
+ "description": "The visible input and any increment or decrement controls."
+ },
+ {
+ "name": "className",
+ "type": "string | ((state: NumberFieldGroupState) => string | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Class applied to this part, or a callback receiving its NumberField state."
+ },
+ {
+ "name": "ref",
+ "type": "Ref<HTMLDivElement>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Ref to the group div, or the element composed through Group.render."
+ },
+ {
+ "name": "render",
+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, NumberFieldGroupState>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element."
+ },
+ {
+ "name": "style",
+ "type": "CSSProperties | ((state: NumberFieldGroupState) => CSSProperties | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Inline styles applied to this part, or a callback receiving its NumberField state."
+ }
+ ]
+ },
+ {
+ "name": "Input",
+ "props": [
+ {
+ "name": "aria-roledescription",
+ "type": "string",
+ "required": false,
+ "defaultValue": "Number field",
+ "description": "Describes the role to assistive technology. Defaults to Number field; use Field.Label, aria-label, or aria-labelledby for the accessible name."
+ },
+ {
+ "name": "className",
+ "type": "string | ((state: NumberFieldInputState) => string | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Class applied to this part, or a callback receiving its NumberField state."
+ },
+ {
+ "name": "ref",
+ "type": "Ref<HTMLInputElement>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Ref to the visible native text input."
+ },
+ {
+ "name": "render",
+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, NumberFieldInputState>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Composes the visible text input with an element or render callback. Forward the supplied props and ref to an input. Customize layout through Root or Group."
+ },
+ {
+ "name": "size",
+ "type": "number",
+ "required": false,
+ "defaultValue": null,
+ "description": "Native input size attribute. Use styles to customize visual dimensions."
+ },
+ {
+ "name": "style",
+ "type": "CSSProperties | ((state: NumberFieldInputState) => CSSProperties | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Inline styles applied to this part, or a callback receiving its NumberField state."
+ }
+ ]
+ },
+ {
+ "name": "Increment",
+ "props": [
+ {
+ "name": "children",
+ "type": "ReactNode",
+ "required": false,
+ "defaultValue": null,
+ "description": "Visible content for the increment control. Supply its accessible name."
+ },
+ {
+ "name": "className",
+ "type": "string | ((state: NumberFieldIncrementState) => string | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Class applied to this part, or a callback receiving its NumberField state."
+ },
+ {
+ "name": "nativeButton",
+ "type": "boolean",
+ "required": false,
+ "defaultValue": "true",
+ "description": "Whether render composes a native button. Set false for a custom non-button element so Base UI supplies button interaction."
+ },
+ {
+ "name": "ref",
+ "type": "Ref<HTMLButtonElement>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Ref to the increment button, or the element composed through render."
+ },
+ {
+ "name": "render",
+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, NumberFieldIncrementState>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element."
+ },
+ {
+ "name": "style",
+ "type": "CSSProperties | ((state: NumberFieldIncrementState) => CSSProperties | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Inline styles applied to this part, or a callback receiving its NumberField state."
+ }
+ ]
+ },
+ {
+ "name": "Decrement",
+ "props": [
+ {
+ "name": "children",
+ "type": "ReactNode",
+ "required": false,
+ "defaultValue": null,
+ "description": "Visible content for the decrement control. Supply its accessible name."
+ },
+ {
+ "name": "className",
+ "type": "string | ((state: NumberFieldDecrementState) => string | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Class applied to this part, or a callback receiving its NumberField state."
+ },
+ {
+ "name": "nativeButton",
+ "type": "boolean",
+ "required": false,
+ "defaultValue": "true",
+ "description": "Whether render composes a native button. Set false for a custom non-button element so Base UI supplies button interaction."
+ },
+ {
+ "name": "ref",
+ "type": "Ref<HTMLButtonElement>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Ref to the decrement button, or the element composed through render."
+ },
+ {
+ "name": "render",
+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, NumberFieldDecrementState>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element."
+ },
+ {
+ "name": "style",
+ "type": "CSSProperties | ((state: NumberFieldDecrementState) => CSSProperties | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Inline styles applied to this part, or a callback receiving its NumberField state."
+ }
+ ]
+ },
+ {
+ "name": "ScrubArea",
+ "props": [
+ {
+ "name": "children",
+ "type": "ReactNode",
+ "required": false,
+ "defaultValue": null,
+ "description": "Content the user can drag to adjust the number, plus an optional ScrubAreaCursor."
+ },
+ {
+ "name": "className",
+ "type": "string | ((state: NumberFieldScrubAreaState) => string | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Class applied to this part, or a callback receiving its NumberField state."
+ },
+ {
+ "name": "direction",
+ "type": "\"horizontal\" | \"vertical\"",
+ "required": false,
+ "defaultValue": "horizontal",
+ "description": "Pointer movement direction used for scrubbing."
+ },
+ {
+ "name": "pixelSensitivity",
+ "type": "number",
+ "required": false,
+ "defaultValue": "2",
+ "description": "Pixels of pointer movement needed for a step. Larger values reduce sensitivity."
+ },
+ {
+ "name": "ref",
+ "type": "Ref<HTMLSpanElement>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Ref to the scrub area span, or the element composed through render."
+ },
+ {
+ "name": "render",
+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, NumberFieldScrubAreaState>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element."
+ },
+ {
+ "name": "style",
+ "type": "CSSProperties | ((state: NumberFieldScrubAreaState) => CSSProperties | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Inline styles applied to this part, or a callback receiving its NumberField state."
+ },
+ {
+ "name": "teleportDistance",
+ "type": "number",
+ "required": false,
+ "defaultValue": null,
+ "description": "Optional distance from the scrub area center at which the pointer loops around."
+ }
+ ]
+ },
+ {
+ "name": "ScrubAreaCursor",
+ "props": [
+ {
+ "name": "children",
+ "type": "ReactNode",
+ "required": false,
+ "defaultValue": null,
+ "description": "Custom cursor content shown during supported pointer-lock scrubbing."
+ },
+ {
+ "name": "className",
+ "type": "string | ((state: NumberFieldScrubAreaCursorState) => string | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Class applied to this part, or a callback receiving its NumberField state."
+ },
+ {
+ "name": "ref",
+ "type": "Ref<HTMLSpanElement>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Ref to the cursor span portaled to the document body while active. Null while absent."
+ },
+ {
+ "name": "render",
+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, NumberFieldScrubAreaCursorState>",
+ "required": false,
+ "defaultValue": null,
+ "description": "Composes this part with an element or render callback. Forward the supplied props and ref to the corresponding DOM element."
+ },
+ {
+ "name": "style",
+ "type": "CSSProperties | ((state: NumberFieldScrubAreaCursorState) => CSSProperties | undefined)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Inline styles applied to this part, or a callback receiving its NumberField state."
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "NumberStepper",
+ "entryPoint": "twenty-ui/components/input",
+ "slug": "components/input/number-stepper",
"props": [
{
"name": "allowOutOfRange",
@@ -2783,6 +3260,13 @@
"defaultValue": null,
"description": "Called with the next number or null and event details when the numeric value changes. Clearing reports null; incomplete text does not report a number."
},
+ {
+ "name": "onValueCommitted",
+ "type": "((value: number | null, eventDetails: NumberFieldRootCommitEventDetails) => void)",
+ "required": false,
+ "defaultValue": null,
+ "description": "Called with the committed number or null and generic event details after an edit is committed. Details contain the native event and reason, without change cancellation methods."
+ },
{
"name": "readOnly",
"type": "boolean",
@@ -2802,7 +3286,7 @@
"type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, NumberFieldInputState>",
"required": false,
"defaultValue": null,
- "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
+ "description": "Composes the visible text input with an element or render callback. Forward the supplied props and ref to an input. Use a separate element to customize the surrounding layout."
},
{
"name": "required",
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/NumberStepper.module.scss b/packages/twenty-ui/src/components/input/NumberStepper/NumberStepper.module.scss
similarity index 100%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/NumberStepper.module.scss
rename to packages/twenty-ui/src/components/input/NumberStepper/NumberStepper.module.scss
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/NumberStepper.module.scss.d.ts b/packages/twenty-ui/src/components/input/NumberStepper/NumberStepper.module.scss.d.ts
similarity index 100%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/NumberStepper.module.scss.d.ts
rename to packages/twenty-ui/src/components/input/NumberStepper/NumberStepper.module.scss.d.ts
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/NumberStepper.tsx b/packages/twenty-ui/src/components/input/NumberStepper/NumberStepper.tsx
similarity index 92%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/NumberStepper.tsx
rename to packages/twenty-ui/src/components/input/NumberStepper/NumberStepper.tsx
index d31af2479e9..7856f15e8e9 100644
--- a/packages/twenty-ui/src/primitives/input/NumberStepper/NumberStepper.tsx
+++ b/packages/twenty-ui/src/components/input/NumberStepper/NumberStepper.tsx
@@ -1,4 +1,3 @@
-import { NumberField } from '@base-ui/react/number-field';
import { useControlled } from '@base-ui/utils/useControlled';
import { useValueAsRef } from '@base-ui/utils/useValueAsRef';
import { clsx } from 'clsx';
@@ -6,6 +5,8 @@ import { clsx } from 'clsx';
import { IconMinus, IconPlus } from '@ui/icon';
import { Button } from '@ui/primitives/input/Button/Button';
import inputStyles from '@ui/primitives/input/Input/Input.module.scss';
+import { NumberField } from '@ui/primitives/input/NumberField/NumberField';
+import { type NumberFieldRootProps } from '@ui/primitives/input/NumberField/types/NumberFieldRootProps';
import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';
import { NUMBER_STEPPER_FORMAT } from './internal/constants/NumberStepperFormat';
@@ -17,6 +18,7 @@ export const NumberStepper = ({
value,
defaultValue,
onValueChange,
+ onValueCommitted,
allowOutOfRange = false,
min,
max,
@@ -42,7 +44,7 @@ export const NumberStepper = ({
const currentValueRef = useValueAsRef(resolvedValue);
const handleValueChange: NonNullable<
- NumberField.Root.Props['onValueChange']
+ NumberFieldRootProps['onValueChange']
> = (nextValue, eventDetails) => {
if (nextValue === currentValueRef.current) {
return;
@@ -73,6 +75,7 @@ export const NumberStepper = ({
<NumberField.Root
value={resolvedValue}
onValueChange={handleValueChange}
+ onValueCommitted={onValueCommitted}
min={min}
max={max}
allowOutOfRange={allowOutOfRange}
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/ControlledNumberStepperExample.tsx b/packages/twenty-ui/src/components/input/NumberStepper/__stories__/ControlledNumberStepperExample.tsx
similarity index 100%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/ControlledNumberStepperExample.tsx
rename to packages/twenty-ui/src/components/input/NumberStepper/__stories__/ControlledNumberStepperExample.tsx
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/NumberStepper.forms.stories.tsx b/packages/twenty-ui/src/components/input/NumberStepper/__stories__/NumberStepper.forms.stories.tsx
similarity index 100%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/NumberStepper.forms.stories.tsx
rename to packages/twenty-ui/src/components/input/NumberStepper/__stories__/NumberStepper.forms.stories.tsx
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/NumberStepper.interactions.stories.tsx b/packages/twenty-ui/src/components/input/NumberStepper/__stories__/NumberStepper.interactions.stories.tsx
similarity index 70%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/NumberStepper.interactions.stories.tsx
rename to packages/twenty-ui/src/components/input/NumberStepper/__stories__/NumberStepper.interactions.stories.tsx
index 2edbc52eb9c..4c21b665be3 100644
--- a/packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/NumberStepper.interactions.stories.tsx
+++ b/packages/twenty-ui/src/components/input/NumberStepper/__stories__/NumberStepper.interactions.stories.tsx
@@ -328,21 +328,70 @@ export const GroupedInput: Story = {
};
export const UneditedPrecision: Story = {
- args: { defaultValue: 0.1 + 0.2 },
+ args: {
+ defaultValue: 0.1 + 0.2,
+ onValueChange: fn<NonNullable<NumberStepperProps['onValueChange']>>(
+ (_nextValue, eventDetails) => eventDetails.cancel(),
+ ),
+ onValueCommitted: fn(),
+ },
render: (args) => <ControlledNumberStepperExample {...args} />,
play: async ({ canvasElement, args }) => {
- const input = within(canvasElement).getByRole('textbox', {
- name: 'Quantity',
- });
+ const canvas = within(canvasElement);
+ const input = canvas.getByRole('textbox', { name: 'Quantity' });
+ const increase = canvas.getByRole('button', { name: 'Increase value' });
+ const pointerInteraction = userEvent.setup();
await expect(input).toHaveValue('0.3');
await userEvent.click(input);
await userEvent.tab();
await expect(input).toHaveValue('0.3');
await expect(args.onValueChange).not.toHaveBeenCalled();
+ await expect(args.onValueCommitted).not.toHaveBeenCalled();
+
+ await pointerInteraction.pointer({
+ target: increase,
+ keys: '[MouseLeft>]',
+ });
+ await expect(args.onValueChange).toHaveBeenCalledTimes(1);
+ await expect(args.onValueChange).toHaveBeenLastCalledWith(
+ 1.3,
+ expect.objectContaining({
+ reason: 'increment-press',
+ isCanceled: true,
+ event: expect.objectContaining({ type: 'pointerdown' }),
+ }),
+ );
+ await expect(args.onValueCommitted).not.toHaveBeenCalled();
+ await pointerInteraction.pointer({
+ target: increase,
+ keys: '[/MouseLeft]',
+ });
+ await expect(input).toHaveValue('0.3');
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(1);
+ await expect(args.onValueCommitted).toHaveBeenLastCalledWith(
+ 0.1 + 0.2,
+ expect.objectContaining({
+ reason: 'increment-press',
+ event: expect.objectContaining({ type: 'pointerup' }),
+ }),
+ );
+ await expect(args.onValueCommitted).not.toHaveBeenCalledWith(
+ 0.3,
+ expect.anything(),
+ );
+ await userEvent.tab();
+ await expect(input).toHaveValue('0.3');
+ await expect(args.onValueChange).toHaveBeenCalledTimes(1);
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(1);
},
};
+export const UneditedUncontrolledPrecision: Story = {
+ ...UneditedPrecision,
+ render: (args) => <NumberStepper {...args} />,
+};
+
export const CanceledChange: Story = {
args: {
onValueChange: fn<NonNullable<NumberStepperProps['onValueChange']>>(
@@ -352,31 +401,135 @@ export const CanceledChange: Story = {
}
},
),
+ onValueCommitted: fn(),
},
render: (args) => <ControlledNumberStepperExample {...args} />,
play: async ({ canvasElement, args }) => {
const canvas = within(canvasElement);
const input = canvas.getByRole('textbox', { name: 'Quantity' });
+ const increase = canvas.getByRole('button', { name: 'Increase value' });
+ const pointerInteraction = userEvent.setup();
- await userEvent.click(
- canvas.getByRole('button', { name: 'Increase value' }),
- );
+ await pointerInteraction.pointer({
+ target: increase,
+ keys: '[MouseLeft>]',
+ });
await expect(input).toHaveValue('1');
await expect(args.onValueChange).toHaveBeenCalledTimes(1);
await expect(args.onValueChange).toHaveBeenLastCalledWith(
2,
- expect.objectContaining({ isCanceled: true }),
+ expect.objectContaining({
+ reason: 'increment-press',
+ isCanceled: true,
+ direction: 1,
+ event: expect.objectContaining({ type: 'pointerdown' }),
+ }),
);
+ await expect(args.onValueCommitted).not.toHaveBeenCalled();
+ await pointerInteraction.pointer({
+ target: increase,
+ keys: '[/MouseLeft]',
+ });
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(1);
+ await expect(args.onValueCommitted).toHaveBeenLastCalledWith(
+ 1,
+ expect.objectContaining({
+ reason: 'increment-press',
+ event: expect.objectContaining({ type: 'pointerup' }),
+ }),
+ );
+ await userEvent.tab();
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(1);
await userEvent.click(input);
await userEvent.keyboard('{ArrowUp}');
await expect(input).toHaveValue('1');
await expect(args.onValueChange).toHaveBeenCalledTimes(2);
+ await expect(args.onValueChange).toHaveBeenLastCalledWith(
+ 2,
+ expect.objectContaining({
+ reason: 'keyboard',
+ isCanceled: true,
+ event: expect.objectContaining({ type: 'keydown', key: 'ArrowUp' }),
+ }),
+ );
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(1);
await userEvent.keyboard('{ArrowDown}');
await expect(input).toHaveValue('0');
await expect(args.onValueChange).toHaveBeenCalledTimes(3);
await expect(args.onValueChange).toHaveBeenLastCalledWith(
0,
- expect.objectContaining({ isCanceled: false }),
+ expect.objectContaining({
+ reason: 'keyboard',
+ isCanceled: false,
+ event: expect.objectContaining({ type: 'keydown', key: 'ArrowDown' }),
+ }),
+ );
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(2);
+ await expect(args.onValueCommitted).toHaveBeenLastCalledWith(
+ 0,
+ expect.objectContaining({
+ reason: 'keyboard',
+ event: expect.objectContaining({ type: 'keydown', key: 'ArrowDown' }),
+ }),
+ );
+ await userEvent.tab();
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(2);
+
+ await userEvent.tripleClick(input);
+ await userEvent.keyboard('2');
+ await expect(input).toHaveValue('2');
+ await expect(args.onValueChange).toHaveBeenCalledTimes(4);
+ await expect(args.onValueChange).toHaveBeenLastCalledWith(
+ 2,
+ expect.objectContaining({
+ reason: 'input-change',
+ isCanceled: true,
+ event: expect.objectContaining({ type: 'input' }),
+ }),
+ );
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(2);
+ await userEvent.tab();
+ await expect(args.onValueChange).toHaveBeenCalledTimes(5);
+ await expect(args.onValueChange).toHaveBeenLastCalledWith(
+ 2,
+ expect.objectContaining({
+ reason: 'input-blur',
+ isCanceled: true,
+ event: expect.objectContaining({ type: 'focusout' }),
+ }),
+ );
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(2);
+ await expect(args.onValueCommitted).not.toHaveBeenCalledWith(
+ 2,
+ expect.anything(),
+ );
+ },
+};
+
+export const CanceledUncontrolledChange: Story = {
+ ...CanceledChange,
+ render: (args) => <NumberStepper {...args} />,
+};
+
+export const ValueCommit: Story = {
+ args: { onValueCommitted: fn() },
+ play: async ({ canvasElement, args }) => {
+ const input = within(canvasElement).getByRole('textbox', {
+ name: 'Quantity',
+ });
+
+ await userEvent.clear(input);
+ await userEvent.type(input, '2');
+ await expect(args.onValueChange).toHaveBeenLastCalledWith(
+ 2,
+ expect.objectContaining({ reason: 'input-change' }),
+ );
+ await expect(args.onValueCommitted).not.toHaveBeenCalled();
+ await userEvent.tab();
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(1);
+ await expect(args.onValueCommitted).toHaveBeenCalledWith(
+ 2,
+ expect.objectContaining({ reason: 'input-blur' }),
);
},
};
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/NumberStepper.stories.tsx b/packages/twenty-ui/src/components/input/NumberStepper/__stories__/NumberStepper.stories.tsx
similarity index 100%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/NumberStepper.stories.tsx
rename to packages/twenty-ui/src/components/input/NumberStepper/__stories__/NumberStepper.stories.tsx
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/NumberStepperFieldExample.tsx b/packages/twenty-ui/src/components/input/NumberStepper/__stories__/NumberStepperFieldExample.tsx
similarity index 100%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/NumberStepperFieldExample.tsx
rename to packages/twenty-ui/src/components/input/NumberStepper/__stories__/NumberStepperFieldExample.tsx
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/NumberStepperFormExample.tsx b/packages/twenty-ui/src/components/input/NumberStepper/__stories__/NumberStepperFormExample.tsx
similarity index 100%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/__stories__/NumberStepperFormExample.tsx
rename to packages/twenty-ui/src/components/input/NumberStepper/__stories__/NumberStepperFormExample.tsx
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/__tests__/NumberStepper.test.tsx b/packages/twenty-ui/src/components/input/NumberStepper/__tests__/NumberStepper.test.tsx
similarity index 100%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/__tests__/NumberStepper.test.tsx
rename to packages/twenty-ui/src/components/input/NumberStepper/__tests__/NumberStepper.test.tsx
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/internal/constants/NumberStepperFormat.ts b/packages/twenty-ui/src/components/input/NumberStepper/internal/constants/NumberStepperFormat.ts
similarity index 100%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/internal/constants/NumberStepperFormat.ts
rename to packages/twenty-ui/src/components/input/NumberStepper/internal/constants/NumberStepperFormat.ts
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/internal/utils/isBlurRoundingOfCurrentValue.ts b/packages/twenty-ui/src/components/input/NumberStepper/internal/utils/isBlurRoundingOfCurrentValue.ts
similarity index 75%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/internal/utils/isBlurRoundingOfCurrentValue.ts
rename to packages/twenty-ui/src/components/input/NumberStepper/internal/utils/isBlurRoundingOfCurrentValue.ts
index 394c4151796..bf4e6cdbb88 100644
--- a/packages/twenty-ui/src/primitives/input/NumberStepper/internal/utils/isBlurRoundingOfCurrentValue.ts
+++ b/packages/twenty-ui/src/components/input/NumberStepper/internal/utils/isBlurRoundingOfCurrentValue.ts
@@ -1,12 +1,13 @@
-import { type NumberField } from '@base-ui/react/number-field';
import { formatNumber } from '@base-ui/utils/formatNumber';
+import { type NumberFieldRootChangeEventReason } from '@ui/primitives/input/NumberField/types/NumberFieldRootChangeEventReason';
+
import { NUMBER_STEPPER_FORMAT } from '../constants/NumberStepperFormat';
type IsBlurRoundingOfCurrentValueArgs = {
nextValue: number | null;
currentValue: number | null;
- reason: NumberField.Root.ChangeEventReason;
+ reason: NumberFieldRootChangeEventReason;
};
export const isBlurRoundingOfCurrentValue = ({
diff --git a/packages/twenty-ui/src/primitives/input/NumberStepper/types/NumberStepperProps.ts b/packages/twenty-ui/src/components/input/NumberStepper/types/NumberStepperProps.ts
similarity index 63%
rename from packages/twenty-ui/src/primitives/input/NumberStepper/types/NumberStepperProps.ts
rename to packages/twenty-ui/src/components/input/NumberStepper/types/NumberStepperProps.ts
index 693bcc041e2..d6ad49f1a46 100644
--- a/packages/twenty-ui/src/primitives/input/NumberStepper/types/NumberStepperProps.ts
+++ b/packages/twenty-ui/src/components/input/NumberStepper/types/NumberStepperProps.ts
@@ -1,7 +1,8 @@
-import { type NumberField } from '@base-ui/react/number-field';
+import { type NumberFieldInputProps } from '@ui/primitives/input/NumberField/types/NumberFieldInputProps';
+import { type NumberFieldRootProps } from '@ui/primitives/input/NumberField/types/NumberFieldRootProps';
export type NumberStepperProps = Omit<
- NumberField.Input.Props,
+ NumberFieldInputProps,
| 'children'
| 'defaultValue'
| 'disabled'
@@ -17,7 +18,7 @@ export type NumberStepperProps = Omit<
| 'value'
> &
Pick<
- NumberField.Root.Props,
+ NumberFieldRootProps,
| 'allowOutOfRange'
| 'defaultValue'
| 'disabled'
@@ -25,6 +26,7 @@ export type NumberStepperProps = Omit<
| 'min'
| 'name'
| 'onValueChange'
+ | 'onValueCommitted'
| 'readOnly'
| 'required'
| 'value'
diff --git a/packages/twenty-ui/src/components/input/index.ts b/packages/twenty-ui/src/components/input/index.ts
index 170cef151c9..71e61d07c74 100644
--- a/packages/twenty-ui/src/components/input/index.ts
+++ b/packages/twenty-ui/src/components/input/index.ts
@@ -24,6 +24,8 @@ export type { LightButtonProps } from './LightButton/types/LightButtonProps';
export { LightIconButton } from './LightIconButton/LightIconButton';
export type { LightIconButtonProps } from './LightIconButton/types/LightIconButtonProps';
export { MainButton } from './MainButton/MainButton';
+export { NumberStepper } from './NumberStepper/NumberStepper';
+export type { NumberStepperProps } from './NumberStepper/types/NumberStepperProps';
export { PhoneCountryPicker } from './PhoneCountryPicker/PhoneCountryPicker';
export type { PhoneCountryOption } from './PhoneCountryPicker/types/PhoneCountryOption';
export type { PhoneCountryPickerOptionsProps } from './PhoneCountryPicker/types/PhoneCountryPickerOptionsProps';
diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/__stories__/Dropdown.picker.stories.tsx b/packages/twenty-ui/src/components/navigation/Dropdown/__stories__/Dropdown.picker.stories.tsx
index ccf948425b3..32d64e094f0 100644
--- a/packages/twenty-ui/src/components/navigation/Dropdown/__stories__/Dropdown.picker.stories.tsx
+++ b/packages/twenty-ui/src/components/navigation/Dropdown/__stories__/Dropdown.picker.stories.tsx
@@ -593,7 +593,7 @@ export const DisabledLinkOption: Story = {
await userEvent.click(link);
await expect(onSelectDisabledOption).not.toHaveBeenCalled();
await expect(document.URL).toBe(initialLocation);
- await expect(body.getByRole('dialog')).toBeVisible();
+ await waitFor(() => expect(body.getByRole('dialog')).toBeVisible());
await userEvent.keyboard('{Escape}');
await waitFor(() =>
expect(body.queryByRole('dialog')).not.toBeInTheDocument(),
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/NumberField.module.scss b/packages/twenty-ui/src/primitives/input/NumberField/NumberField.module.scss
new file mode 100644
index 00000000000..797bd2ca337
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/NumberField.module.scss
@@ -0,0 +1,15 @@
+.group {
+ align-items: center;
+ display: inline-flex;
+ gap: var(--t-spacing-1);
+}
+
+.button {
+ &[data-readonly] {
+ --tw-button-active: var(--tw-button-background);
+ --tw-button-hover: var(--tw-button-background);
+
+ cursor: default;
+ opacity: 0.5;
+ }
+}
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/NumberField.module.scss.d.ts b/packages/twenty-ui/src/primitives/input/NumberField/NumberField.module.scss.d.ts
new file mode 100644
index 00000000000..c6fc7cc10ff
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/NumberField.module.scss.d.ts
@@ -0,0 +1,5 @@
+declare const classNames: {
+ readonly group: 'group';
+ readonly button: 'button';
+};
+export default classNames;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/NumberField.tsx b/packages/twenty-ui/src/primitives/input/NumberField/NumberField.tsx
new file mode 100644
index 00000000000..7f6c94635bd
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/NumberField.tsx
@@ -0,0 +1,16 @@
+import { NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+import { NumberFieldDecrement } from './internal/NumberFieldDecrement';
+import { NumberFieldGroup } from './internal/NumberFieldGroup';
+import { NumberFieldIncrement } from './internal/NumberFieldIncrement';
+import { NumberFieldInput } from './internal/NumberFieldInput';
+
+export const NumberField = {
+ Root: NumberFieldPrimitive.Root,
+ Group: NumberFieldGroup,
+ Input: NumberFieldInput,
+ Increment: NumberFieldIncrement,
+ Decrement: NumberFieldDecrement,
+ ScrubArea: NumberFieldPrimitive.ScrubArea,
+ ScrubAreaCursor: NumberFieldPrimitive.ScrubAreaCursor,
+};
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/__stories__/ControlledNumberFieldInteractionExample.tsx b/packages/twenty-ui/src/primitives/input/NumberField/__stories__/ControlledNumberFieldInteractionExample.tsx
new file mode 100644
index 00000000000..4425c9b7da5
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/__stories__/ControlledNumberFieldInteractionExample.tsx
@@ -0,0 +1,28 @@
+import { useState } from 'react';
+
+import { type NumberFieldRootProps } from '../types/NumberFieldRootProps';
+import { NumberFieldInteractionExample } from './NumberFieldInteractionExample';
+
+export const ControlledNumberFieldInteractionExample = ({
+ defaultValue,
+ onValueChange,
+ ...props
+}: NumberFieldRootProps) => {
+ const [value, setValue] = useState<number | null>(defaultValue ?? null);
+
+ return (
+ <NumberFieldInteractionExample
+ {...props}
+ value={value}
+ onValueChange={(nextValue, eventDetails) => {
+ onValueChange?.(nextValue, eventDetails);
+
+ if (eventDetails.isCanceled) {
+ return;
+ }
+
+ setValue(nextValue);
+ }}
+ />
+ );
+};
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberField.interactions.stories.tsx b/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberField.interactions.stories.tsx
new file mode 100644
index 00000000000..d66dee6eeaf
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberField.interactions.stories.tsx
@@ -0,0 +1,383 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { expect, fireEvent, fn, userEvent, within } from 'storybook/test';
+
+import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';
+
+import { NumberField } from '../NumberField';
+import { type NumberFieldRootProps } from '../types/NumberFieldRootProps';
+import { ControlledNumberFieldInteractionExample } from './ControlledNumberFieldInteractionExample';
+import { NumberFieldFormInteractionExample } from './NumberFieldFormInteractionExample';
+import { NumberFieldInteractionExample } from './NumberFieldInteractionExample';
+import { NumberFieldScrubInteractionExample } from './NumberFieldScrubInteractionExample';
+
+const meta: Meta<typeof NumberField.Root> = {
+ title: 'UI/Input/NumberField/Interactions',
+ component: NumberField.Root,
+ tags: ['!autodocs'],
+ decorators: [ComponentDecorator],
+ parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },
+ args: {
+ defaultValue: 1,
+ locale: 'en-US',
+ onValueChange: fn(),
+ onValueCommitted: fn(),
+ },
+ render: (args) => <NumberFieldInteractionExample {...args} />,
+};
+
+export default meta;
+type Story = StoryObj<typeof NumberField.Root>;
+
+export const LocaleFormatting: Story = {
+ args: {
+ defaultValue: 1234.5,
+ locale: 'de-DE',
+ format: { minimumFractionDigits: 2, maximumFractionDigits: 2 },
+ },
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+ const input = canvas.getByRole('textbox', { name: 'Quantity' });
+
+ await expect(input).toHaveValue('1.234,50');
+ await userEvent.clear(input);
+ await userEvent.type(input, '12,75');
+ await expect(input).toHaveValue('12,75');
+ await expect(args.onValueChange).toHaveBeenLastCalledWith(
+ 12.75,
+ expect.objectContaining({
+ reason: 'input-change',
+ event: expect.objectContaining({ type: 'input' }),
+ }),
+ );
+ await expect(args.onValueCommitted).not.toHaveBeenCalled();
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Finish editing' }),
+ );
+ await expect(input).toHaveValue('12,75');
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(1);
+ await expect(args.onValueCommitted).toHaveBeenCalledWith(
+ 12.75,
+ expect.objectContaining({ reason: 'input-blur' }),
+ );
+ },
+};
+
+export const ControlledEmptyValue: Story = {
+ args: { defaultValue: undefined },
+ render: (args) => <ControlledNumberFieldInteractionExample {...args} />,
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+ const input = canvas.getByRole('textbox', { name: 'Quantity' });
+ const finishEditing = canvas.getByRole('button', {
+ name: 'Finish editing',
+ });
+
+ await expect(input).toHaveValue('');
+ await userEvent.click(input);
+ await userEvent.click(finishEditing);
+ await expect(args.onValueChange).not.toHaveBeenCalled();
+ await expect(args.onValueCommitted).not.toHaveBeenCalled();
+ await userEvent.type(input, '3');
+ await userEvent.clear(input);
+ await expect(input).toHaveValue('');
+ await expect(args.onValueChange).toHaveBeenLastCalledWith(
+ null,
+ expect.objectContaining({ reason: 'input-clear' }),
+ );
+ await expect(args.onValueCommitted).not.toHaveBeenCalled();
+ await userEvent.click(finishEditing);
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(1);
+ await expect(args.onValueCommitted).toHaveBeenCalledWith(
+ null,
+ expect.objectContaining({ reason: 'input-clear' }),
+ );
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Increase value' }),
+ );
+ await expect(input).toHaveValue('0');
+ await expect(args.onValueCommitted).toHaveBeenLastCalledWith(
+ 0,
+ expect.objectContaining({ reason: 'increment-press' }),
+ );
+ },
+};
+
+export const CanceledControlledChange: Story = {
+ args: {
+ onValueChange: fn<NonNullable<NumberFieldRootProps['onValueChange']>>(
+ (value, details) => {
+ if (value === 2) {
+ details.cancel();
+ }
+ },
+ ),
+ },
+ render: (args) => <ControlledNumberFieldInteractionExample {...args} />,
+ play: async ({ canvasElement, args }) => {
+ const input = within(canvasElement).getByRole('textbox', {
+ name: 'Quantity',
+ });
+
+ await userEvent.click(input);
+ await userEvent.keyboard('{ArrowUp}');
+ await expect(input).toHaveValue('1');
+ await expect(args.onValueChange).toHaveBeenCalledTimes(1);
+ await expect(args.onValueChange).toHaveBeenCalledWith(
+ 2,
+ expect.objectContaining({ reason: 'keyboard', isCanceled: true }),
+ );
+ await expect(args.onValueCommitted).not.toHaveBeenCalled();
+ await userEvent.keyboard('{ArrowDown}');
+ await expect(input).toHaveValue('0');
+ await expect(args.onValueChange).toHaveBeenLastCalledWith(
+ 0,
+ expect.objectContaining({ reason: 'keyboard', direction: -1 }),
+ );
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(1);
+ await expect(args.onValueCommitted).toHaveBeenCalledWith(
+ 0,
+ expect.objectContaining({ reason: 'keyboard' }),
+ );
+ },
+};
+
+export const ModifierStepsAndBounds: Story = {
+ args: {
+ defaultValue: 1.25,
+ step: 'any',
+ smallStep: 0.25,
+ largeStep: 5,
+ min: 0,
+ max: 20,
+ },
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+ const input = canvas.getByRole('textbox', { name: 'Quantity' });
+
+ await userEvent.click(input);
+ await userEvent.keyboard('{ArrowUp}');
+ await expect(input).toHaveValue('2.25');
+ await userEvent.keyboard('{Shift>}{ArrowUp}{/Shift}');
+ await expect(input).toHaveValue('7.25');
+ await userEvent.keyboard('{Alt>}{ArrowDown}{/Alt}');
+ await expect(input).toHaveValue('7');
+ await userEvent.keyboard('{End}{ArrowUp}');
+ await expect(input).toHaveValue('20');
+ await expect(
+ canvas.getByRole('button', { name: 'Increase value' }),
+ ).toBeDisabled();
+ await userEvent.keyboard('{Home}{ArrowDown}');
+ await expect(input).toHaveValue('0');
+ await expect(
+ canvas.getByRole('button', { name: 'Decrease value' }),
+ ).toBeDisabled();
+ await expect(args.onValueChange).toHaveBeenCalledTimes(5);
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(5);
+ await expect(args.onValueChange).toHaveBeenNthCalledWith(
+ 3,
+ 7,
+ expect.objectContaining({ reason: 'keyboard', direction: -1 }),
+ );
+ },
+};
+
+export const SnapOnStep: Story = {
+ args: { defaultValue: 1.1, step: 0.5, snapOnStep: true },
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+ const input = canvas.getByRole('textbox', { name: 'Quantity' });
+
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Increase value' }),
+ );
+ await expect(input).toHaveValue('1.5');
+ await userEvent.click(input);
+ await userEvent.keyboard('{ArrowDown}');
+ await expect(input).toHaveValue('1');
+ await expect(args.onValueCommitted).toHaveBeenNthCalledWith(
+ 1,
+ 1.5,
+ expect.objectContaining({ reason: 'increment-press' }),
+ );
+ await expect(args.onValueCommitted).toHaveBeenLastCalledWith(
+ 1,
+ expect.objectContaining({ reason: 'keyboard' }),
+ );
+ },
+};
+
+export const DisabledAndReadOnly: Story = {
+ render: (args) => (
+ <>
+ <NumberFieldInteractionExample
+ {...args}
+ label="Disabled quantity"
+ disabled
+ />
+ <NumberFieldInteractionExample
+ {...args}
+ label="Read only quantity"
+ readOnly
+ />
+ </>
+ ),
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+ const disabledInput = canvas.getByRole('textbox', {
+ name: 'Disabled quantity',
+ });
+ const readOnlyInput = canvas.getByRole('textbox', {
+ name: 'Read only quantity',
+ });
+
+ await expect(disabledInput).toBeDisabled();
+ await expect(readOnlyInput).toHaveAttribute('readonly');
+ await userEvent.type(disabledInput, '9');
+ await userEvent.click(readOnlyInput);
+ await expect(readOnlyInput).toHaveFocus();
+ await userEvent.keyboard('9{ArrowUp}{Home}{End}');
+ for (const button of canvas.getAllByRole('button', { name: /value/ })) {
+ await userEvent.click(button);
+ }
+ await expect(disabledInput).toHaveValue('1');
+ await expect(readOnlyInput).toHaveValue('1');
+ await expect(args.onValueChange).not.toHaveBeenCalled();
+ await expect(args.onValueCommitted).not.toHaveBeenCalled();
+ },
+};
+
+export const NativeFormRefsAndComposition: Story = {
+ args: {
+ defaultValue: undefined,
+ locale: 'de-DE',
+ step: 'any',
+ min: 0,
+ required: true,
+ },
+ render: (args) => <NumberFieldFormInteractionExample {...args} />,
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const input = canvas.getByRole('textbox', { name: 'Quantity' });
+ const form = canvas.getByRole<HTMLFormElement>('form', {
+ name: 'Quantity form',
+ });
+
+ await expect(input).toBeRequired();
+ await expect(input).toHaveClass('empty-control');
+ await expect(input).toHaveAccessibleDescription(
+ 'Enter the amount to save.',
+ );
+ await expect(form.checkValidity()).toBe(false);
+ await userEvent.click(canvas.getByText('Quantity', { selector: 'label' }));
+ await expect(input).toHaveFocus();
+ await userEvent.type(input, '12,5');
+ await expect(form.checkValidity()).toBe(true);
+ await expect(input).toHaveClass('filled-control');
+ await expect(input).toHaveAttribute('data-quantity', '12.5');
+ await expect(
+ canvas.getByRole('group', { name: 'Quantity controls' }).parentElement,
+ ).toHaveAttribute('data-quantity', '12.5');
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Save quantity' }),
+ );
+ await expect(canvas.getByLabelText('Saved quantity')).toHaveTextContent(
+ '12.5',
+ );
+ await expect([...new FormData(form).entries()]).toEqual([
+ ['quantity', '12.5'],
+ ]);
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Inspect refs and focus' }),
+ );
+ await expect(canvas.getByLabelText('Ref targets')).toHaveTextContent(
+ 'DIV/text/number/true',
+ );
+ await expect(input).toHaveFocus();
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Increase value' }),
+ );
+ await expect(input).toHaveValue('13,5');
+ await expect(
+ canvas.getByRole('group', { name: 'Quantity controls' }).tagName,
+ ).toBe('SECTION');
+ },
+};
+
+export const Scrubbing: Story = {
+ args: { defaultValue: 10, min: 0, max: 20 },
+ render: (args) => <NumberFieldScrubInteractionExample {...args} />,
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+ const scrubArea = canvas.getByLabelText('Scrub quantity');
+ const input = canvas.getByRole('textbox', { name: 'Quantity' });
+
+ await fireEvent.pointerDown(scrubArea, {
+ pointerType: 'touch',
+ pointerId: 1,
+ button: 0,
+ });
+ await expect(scrubArea).toHaveAttribute('data-scrubbing', 'true');
+ await expect(
+ within(document.body).queryByLabelText('Quantity scrub cursor'),
+ ).not.toBeInTheDocument();
+ await fireEvent.pointerMove(scrubArea, {
+ pointerType: 'touch',
+ pointerId: 1,
+ movementX: 4,
+ });
+ await expect(input).toHaveValue('14');
+ await expect(args.onValueChange).toHaveBeenLastCalledWith(
+ 14,
+ expect.objectContaining({ reason: 'scrub', direction: 1 }),
+ );
+ await expect(args.onValueCommitted).not.toHaveBeenCalled();
+ await fireEvent.pointerMove(scrubArea, {
+ pointerType: 'touch',
+ pointerId: 1,
+ movementX: 30,
+ });
+ await expect(input).toHaveValue('20');
+ await fireEvent.pointerUp(scrubArea, {
+ pointerType: 'touch',
+ pointerId: 1,
+ });
+ await expect(scrubArea).toHaveAttribute('data-scrubbing', 'false');
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(1);
+ await expect(args.onValueCommitted).toHaveBeenCalledWith(
+ 20,
+ expect.objectContaining({
+ reason: 'scrub',
+ event: expect.objectContaining({ type: 'pointerup' }),
+ }),
+ );
+ await fireEvent.pointerUp(scrubArea, {
+ pointerType: 'touch',
+ pointerId: 1,
+ });
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(1);
+ },
+};
+
+export const WheelScrubbing: Story = {
+ args: { defaultValue: 10, allowWheelScrub: true, smallStep: 0.25 },
+ play: async ({ canvasElement, args }) => {
+ const input = within(canvasElement).getByRole('textbox', {
+ name: 'Quantity',
+ });
+
+ await userEvent.click(input);
+ await userEvent.hover(input);
+ await fireEvent.wheel(input, { deltaY: -1, altKey: true });
+ await expect(input).toHaveValue('10.25');
+ await expect(args.onValueChange).toHaveBeenCalledTimes(1);
+ await expect(args.onValueChange).toHaveBeenCalledWith(
+ 10.25,
+ expect.objectContaining({ reason: 'wheel', direction: 1 }),
+ );
+ await expect(args.onValueCommitted).toHaveBeenCalledTimes(1);
+ await expect(args.onValueCommitted).toHaveBeenCalledWith(
+ 10.25,
+ expect.objectContaining({ reason: 'wheel' }),
+ );
+ },
+};
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberField.stories.tsx b/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberField.stories.tsx
new file mode 100644
index 00000000000..9e966177a1a
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberField.stories.tsx
@@ -0,0 +1,98 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+
+import { IconMinus, IconPlus } from '@ui/icon';
+import { Field } from '@ui/primitives/input/Field/Field';
+import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';
+
+import { NumberField } from '../NumberField';
+
+const meta = {
+ title: 'UI/Input/NumberField',
+ component: NumberField.Root,
+ decorators: [ComponentDecorator],
+ parameters: {
+ a11y: A11Y_DEFER_COLOR_CONTRAST,
+ container: { width: 280 },
+ },
+ args: { defaultValue: 3, min: 0, max: 10 },
+ render: (args) => (
+ <Field.Root>
+ <Field.Label>Quantity</Field.Label>
+ <NumberField.Root {...args}>
+ <NumberField.Group>
+ <NumberField.Decrement aria-label="Decrease quantity">
+ <IconMinus size={16} />
+ </NumberField.Decrement>
+ <NumberField.Input />
+ <NumberField.Increment aria-label="Increase quantity">
+ <IconPlus size={16} />
+ </NumberField.Increment>
+ </NumberField.Group>
+ </NumberField.Root>
+ <Field.Description>Choose up to ten items.</Field.Description>
+ </Field.Root>
+ ),
+} satisfies Meta<typeof NumberField.Root>;
+
+export default meta;
+type Story = StoryObj<typeof meta>;
+
+export const Default: Story = {};
+
+export const Empty: Story = {
+ args: { defaultValue: undefined },
+};
+
+export const Disabled: Story = {
+ args: { disabled: true },
+};
+
+export const ReadOnly: Story = {
+ args: { readOnly: true },
+};
+
+export const LocaleCurrency: Story = {
+ args: {
+ defaultValue: 1234.5,
+ min: 0,
+ max: undefined,
+ locale: 'de-DE',
+ format: { style: 'currency', currency: 'EUR' },
+ step: 0.5,
+ smallStep: 0.01,
+ largeStep: 10,
+ },
+ render: (args) => (
+ <Field.Root>
+ <Field.Label>Amount in euros</Field.Label>
+ <NumberField.Root {...args} name="amount">
+ <NumberField.Input />
+ </NumberField.Root>
+ <Field.Description>German locale with euro formatting.</Field.Description>
+ </Field.Root>
+ ),
+};
+
+export const WithScrubbing: Story = {
+ args: { defaultValue: 240, min: 0, max: 1000, step: 1 },
+ render: (args) => (
+ <Field.Root>
+ <NumberField.Root {...args}>
+ <NumberField.ScrubArea style={{ cursor: 'ew-resize' }}>
+ <Field.Label>Width</Field.Label>
+ <NumberField.ScrubAreaCursor>↔</NumberField.ScrubAreaCursor>
+ </NumberField.ScrubArea>
+ <NumberField.Group>
+ <NumberField.Decrement aria-label="Decrease width">
+ <IconMinus size={16} />
+ </NumberField.Decrement>
+ <NumberField.Input />
+ <NumberField.Increment aria-label="Increase width">
+ <IconPlus size={16} />
+ </NumberField.Increment>
+ </NumberField.Group>
+ </NumberField.Root>
+ <Field.Description>Drag the width label to adjust it.</Field.Description>
+ </Field.Root>
+ ),
+};
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberFieldFormInteractionExample.tsx b/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberFieldFormInteractionExample.tsx
new file mode 100644
index 00000000000..18c6fe3a8c1
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberFieldFormInteractionExample.tsx
@@ -0,0 +1,83 @@
+import { useId, useRef, useState } from 'react';
+
+import { Button } from '@ui/primitives/input/Button/Button';
+import { Field } from '@ui/primitives/input/Field/Field';
+
+import { NumberField } from '../NumberField';
+import { type NumberFieldRootProps } from '../types/NumberFieldRootProps';
+
+export const NumberFieldFormInteractionExample = (
+ props: NumberFieldRootProps,
+) => {
+ const formId = useId();
+ const rootRef = useRef<HTMLDivElement>(null);
+ const hiddenInputRef = useRef<HTMLInputElement>(null);
+ const visibleInputRef = useRef<HTMLInputElement>(null);
+ const [savedQuantity, setSavedQuantity] = useState('Not saved');
+ const [refTargets, setRefTargets] = useState('Not inspected');
+
+ return (
+ <>
+ <Field.Root>
+ <Field.Label>Quantity</Field.Label>
+ <NumberField.Root
+ {...props}
+ ref={rootRef}
+ inputRef={hiddenInputRef}
+ form={formId}
+ name="quantity"
+ render={(rootProps, state) => (
+ <div {...rootProps} data-quantity={state.value ?? 'empty'} />
+ )}
+ >
+ <NumberField.Group
+ render={<section aria-label="Quantity controls" />}
+ >
+ <NumberField.Input
+ ref={visibleInputRef}
+ className={(state) =>
+ state.value === null ? 'empty-control' : 'filled-control'
+ }
+ render={(inputProps, state) => (
+ <input {...inputProps} data-quantity={state.value ?? 'empty'} />
+ )}
+ />
+ <NumberField.Increment
+ nativeButton={false}
+ render={<span />}
+ aria-label="Increase value"
+ >
+ +
+ </NumberField.Increment>
+ </NumberField.Group>
+ </NumberField.Root>
+ <Field.Description>Enter the amount to save.</Field.Description>
+ </Field.Root>
+ <form
+ id={formId}
+ aria-label="Quantity form"
+ onSubmit={(event) => {
+ event.preventDefault();
+ setSavedQuantity(
+ String(new FormData(event.currentTarget).get('quantity') ?? ''),
+ );
+ }}
+ >
+ <Button type="submit">Save quantity</Button>
+ </form>
+ <Button
+ type="button"
+ onClick={() => {
+ setRefTargets(
+ `${rootRef.current?.tagName}/${visibleInputRef.current?.type}/${hiddenInputRef.current?.type}/${hiddenInputRef.current?.form?.id === formId}`,
+ );
+ visibleInputRef.current?.focus();
+ }}
+ >
+ Inspect refs and focus
+ </Button>
+ <output aria-label="Saved quantity">{savedQuantity}</output>
+ <output aria-label="Ref targets">{refTargets}</output>
+ </>
+ );
+};
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberFieldInteractionExample.tsx b/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberFieldInteractionExample.tsx
new file mode 100644
index 00000000000..e85c9847129
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberFieldInteractionExample.tsx
@@ -0,0 +1,31 @@
+import { Button } from '@ui/primitives/input/Button/Button';
+import { Field } from '@ui/primitives/input/Field/Field';
+
+import { NumberField } from '../NumberField';
+import { type NumberFieldRootProps } from '../types/NumberFieldRootProps';
+
+export const NumberFieldInteractionExample = ({
+ label = 'Quantity',
+ ...props
+}: NumberFieldRootProps & { label?: string }) => (
+ <>
+ <Field.Root>
+ <Field.Label>{label}</Field.Label>
+ <NumberField.Root {...props}>
+ <NumberField.Group>
+ <NumberField.Decrement aria-label="Decrease value">
+ −
+ </NumberField.Decrement>
+ <NumberField.Input />
+ <NumberField.Increment aria-label="Increase value">
+ +
+ </NumberField.Increment>
+ </NumberField.Group>
+ </NumberField.Root>
+ <Field.Description>
+ Enter a quantity or use the controls.
+ </Field.Description>
+ </Field.Root>
+ <Button type="button">Finish editing</Button>
+ </>
+);
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberFieldScrubInteractionExample.tsx b/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberFieldScrubInteractionExample.tsx
new file mode 100644
index 00000000000..7477be67b5a
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/__stories__/NumberFieldScrubInteractionExample.tsx
@@ -0,0 +1,34 @@
+import { Field } from '@ui/primitives/input/Field/Field';
+
+import { NumberField } from '../NumberField';
+import { type NumberFieldRootProps } from '../types/NumberFieldRootProps';
+
+export const NumberFieldScrubInteractionExample = (
+ props: NumberFieldRootProps,
+) => (
+ <Field.Root>
+ <NumberField.Root
+ {...props}
+ render={(rootProps, state) => (
+ <div {...rootProps} data-scrubbing={String(state.scrubbing)} />
+ )}
+ >
+ <NumberField.ScrubArea
+ pixelSensitivity={1}
+ aria-label="Scrub quantity"
+ render={(scrubProps, state) => (
+ <span {...scrubProps} data-scrubbing={String(state.scrubbing)} />
+ )}
+ >
+ <Field.Label>Quantity</Field.Label>
+ <NumberField.ScrubAreaCursor aria-label="Quantity scrub cursor">
+ ↔
+ </NumberField.ScrubAreaCursor>
+ </NumberField.ScrubArea>
+ <NumberField.Input />
+ </NumberField.Root>
+ <Field.Description>
+ Drag the label to change the quantity.
+ </Field.Description>
+ </Field.Root>
+);
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/__tests__/NumberField.test.tsx b/packages/twenty-ui/src/primitives/input/NumberField/__tests__/NumberField.test.tsx
new file mode 100644
index 00000000000..cd1e4741dff
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/__tests__/NumberField.test.tsx
@@ -0,0 +1,61 @@
+import { type ReactNode } from 'react';
+
+import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';
+import inputStyles from '@ui/primitives/input/Input/Input.module.scss';
+
+import { NumberField } from '../NumberField';
+import styles from '../NumberField.module.scss';
+
+const RootWrapper = ({ children }: { children: ReactNode }) => (
+ <NumberField.Root defaultValue={1}>{children}</NumberField.Root>
+);
+
+runComponentConformance({
+ name: 'NumberField.Root',
+ element: <NumberField.Root />,
+ refInstanceOf: HTMLDivElement,
+ renderPropTagName: 'div',
+});
+
+runComponentConformance({
+ name: 'NumberField.Group',
+ element: <NumberField.Group />,
+ wrapper: RootWrapper,
+ refInstanceOf: HTMLDivElement,
+ ownClassName: styles.group,
+ renderPropTagName: 'div',
+});
+
+runComponentConformance({
+ name: 'NumberField.Input',
+ element: <NumberField.Input aria-label="Quantity" />,
+ wrapper: RootWrapper,
+ refInstanceOf: HTMLInputElement,
+ ownClassName: inputStyles.input,
+ renderPropTagName: 'input',
+});
+
+runComponentConformance({
+ name: 'NumberField.Increment',
+ element: <NumberField.Increment aria-label="Increase value" />,
+ wrapper: RootWrapper,
+ refInstanceOf: HTMLButtonElement,
+ ownClassName: styles.button,
+ renderPropTagName: 'button',
+});
+
+runComponentConformance({
+ name: 'NumberField.Decrement',
+ element: <NumberField.Decrement aria-label="Decrease value" />,
+ wrapper: RootWrapper,
+ refInstanceOf: HTMLButtonElement,
+ ownClassName: styles.button,
+ renderPropTagName: 'button',
+});
+
+runComponentConformance({
+ name: 'NumberField.ScrubArea',
+ element: <NumberField.ScrubArea />,
+ wrapper: RootWrapper,
+ refInstanceOf: HTMLSpanElement,
+});
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/__tests__/NumberField.types.test.tsx b/packages/twenty-ui/src/primitives/input/NumberField/__tests__/NumberField.types.test.tsx
new file mode 100644
index 00000000000..92412b48f2b
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/__tests__/NumberField.types.test.tsx
@@ -0,0 +1,59 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+import { expectTypeOf, it } from 'vitest';
+
+import { NumberField } from '../NumberField';
+import { type NumberFieldDecrementProps } from '../types/NumberFieldDecrementProps';
+import { type NumberFieldDecrementState } from '../types/NumberFieldDecrementState';
+import { type NumberFieldGroupProps } from '../types/NumberFieldGroupProps';
+import { type NumberFieldGroupState } from '../types/NumberFieldGroupState';
+import { type NumberFieldIncrementProps } from '../types/NumberFieldIncrementProps';
+import { type NumberFieldIncrementState } from '../types/NumberFieldIncrementState';
+import { type NumberFieldInputProps } from '../types/NumberFieldInputProps';
+import { type NumberFieldInputState } from '../types/NumberFieldInputState';
+import { type NumberFieldRootChangeEventDetails } from '../types/NumberFieldRootChangeEventDetails';
+import { type NumberFieldRootCommitEventDetails } from '../types/NumberFieldRootCommitEventDetails';
+import { type NumberFieldRootProps } from '../types/NumberFieldRootProps';
+import { type NumberFieldRootState } from '../types/NumberFieldRootState';
+import { type NumberFieldScrubAreaCursorProps } from '../types/NumberFieldScrubAreaCursorProps';
+import { type NumberFieldScrubAreaCursorState } from '../types/NumberFieldScrubAreaCursorState';
+import { type NumberFieldScrubAreaProps } from '../types/NumberFieldScrubAreaProps';
+import { type NumberFieldScrubAreaState } from '../types/NumberFieldScrubAreaState';
+
+it('retains all upstream part props and states', () => {
+ expectTypeOf<NumberFieldRootProps>().toEqualTypeOf<NumberFieldPrimitive.Root.Props>();
+ expectTypeOf<NumberFieldRootState>().toEqualTypeOf<NumberFieldPrimitive.Root.State>();
+ expectTypeOf<NumberFieldGroupProps>().toEqualTypeOf<NumberFieldPrimitive.Group.Props>();
+ expectTypeOf<NumberFieldGroupState>().toEqualTypeOf<NumberFieldPrimitive.Group.State>();
+ expectTypeOf<NumberFieldInputProps>().toEqualTypeOf<NumberFieldPrimitive.Input.Props>();
+ expectTypeOf<NumberFieldInputState>().toEqualTypeOf<NumberFieldPrimitive.Input.State>();
+ expectTypeOf<NumberFieldIncrementProps>().toEqualTypeOf<NumberFieldPrimitive.Increment.Props>();
+ expectTypeOf<NumberFieldIncrementState>().toEqualTypeOf<NumberFieldPrimitive.Increment.State>();
+ expectTypeOf<NumberFieldDecrementProps>().toEqualTypeOf<NumberFieldPrimitive.Decrement.Props>();
+ expectTypeOf<NumberFieldDecrementState>().toEqualTypeOf<NumberFieldPrimitive.Decrement.State>();
+ expectTypeOf<NumberFieldScrubAreaProps>().toEqualTypeOf<NumberFieldPrimitive.ScrubArea.Props>();
+ expectTypeOf<NumberFieldScrubAreaState>().toEqualTypeOf<NumberFieldPrimitive.ScrubArea.State>();
+ expectTypeOf<NumberFieldScrubAreaCursorProps>().toEqualTypeOf<NumberFieldPrimitive.ScrubAreaCursor.Props>();
+ expectTypeOf<NumberFieldScrubAreaCursorState>().toEqualTypeOf<NumberFieldPrimitive.ScrubAreaCursor.State>();
+});
+
+it('infers nullable values and distinct change and commit event details', () => {
+ <NumberField.Root
+ value={null}
+ step="any"
+ onValueChange={(value, details) => {
+ expectTypeOf(value).toEqualTypeOf<number | null>();
+ expectTypeOf(details).toEqualTypeOf<NumberFieldRootChangeEventDetails>();
+ expectTypeOf(
+ details,
+ ).toEqualTypeOf<NumberFieldPrimitive.Root.ChangeEventDetails>();
+ details.cancel();
+ }}
+ onValueCommitted={(value, details) => {
+ expectTypeOf(value).toEqualTypeOf<number | null>();
+ expectTypeOf(details).toEqualTypeOf<NumberFieldRootCommitEventDetails>();
+ expectTypeOf(
+ details,
+ ).toEqualTypeOf<NumberFieldPrimitive.Root.CommitEventDetails>();
+ }}
+ />;
+});
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/internal/NumberFieldDecrement.tsx b/packages/twenty-ui/src/primitives/input/NumberField/internal/NumberFieldDecrement.tsx
new file mode 100644
index 00000000000..ce9aa23feed
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/internal/NumberFieldDecrement.tsx
@@ -0,0 +1,21 @@
+import { NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+import { clsx } from 'clsx';
+
+import buttonStyles from '@ui/primitives/input/Button/Button.module.scss';
+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';
+
+import styles from '../NumberField.module.scss';
+import { type NumberFieldDecrementProps } from '../types/NumberFieldDecrementProps';
+
+export const NumberFieldDecrement = ({
+ className,
+ ...props
+}: NumberFieldDecrementProps) => (
+ <NumberFieldPrimitive.Decrement
+ {...props}
+ className={mergeClassNames(
+ clsx(buttonStyles.button, styles.button),
+ className,
+ )}
+ />
+);
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/internal/NumberFieldGroup.tsx b/packages/twenty-ui/src/primitives/input/NumberField/internal/NumberFieldGroup.tsx
new file mode 100644
index 00000000000..318b7d0155c
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/internal/NumberFieldGroup.tsx
@@ -0,0 +1,16 @@
+import { NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';
+
+import styles from '../NumberField.module.scss';
+import { type NumberFieldGroupProps } from '../types/NumberFieldGroupProps';
+
+export const NumberFieldGroup = ({
+ className,
+ ...props
+}: NumberFieldGroupProps) => (
+ <NumberFieldPrimitive.Group
+ {...props}
+ className={mergeClassNames(styles.group, className)}
+ />
+);
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/internal/NumberFieldIncrement.tsx b/packages/twenty-ui/src/primitives/input/NumberField/internal/NumberFieldIncrement.tsx
new file mode 100644
index 00000000000..459ce33a9f7
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/internal/NumberFieldIncrement.tsx
@@ -0,0 +1,21 @@
+import { NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+import { clsx } from 'clsx';
+
+import buttonStyles from '@ui/primitives/input/Button/Button.module.scss';
+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';
+
+import styles from '../NumberField.module.scss';
+import { type NumberFieldIncrementProps } from '../types/NumberFieldIncrementProps';
+
+export const NumberFieldIncrement = ({
+ className,
+ ...props
+}: NumberFieldIncrementProps) => (
+ <NumberFieldPrimitive.Increment
+ {...props}
+ className={mergeClassNames(
+ clsx(buttonStyles.button, styles.button),
+ className,
+ )}
+ />
+);
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/internal/NumberFieldInput.tsx b/packages/twenty-ui/src/primitives/input/NumberField/internal/NumberFieldInput.tsx
new file mode 100644
index 00000000000..21fc8331842
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/internal/NumberFieldInput.tsx
@@ -0,0 +1,16 @@
+import { NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+import inputStyles from '@ui/primitives/input/Input/Input.module.scss';
+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';
+
+import { type NumberFieldInputProps } from '../types/NumberFieldInputProps';
+
+export const NumberFieldInput = ({
+ className,
+ ...props
+}: NumberFieldInputProps) => (
+ <NumberFieldPrimitive.Input
+ {...props}
+ className={mergeClassNames(inputStyles.input, className)}
+ />
+);
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldDecrementProps.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldDecrementProps.ts
new file mode 100644
index 00000000000..e8aeb3674cd
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldDecrementProps.ts
@@ -0,0 +1,3 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldDecrementProps = NumberFieldPrimitive.Decrement.Props;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldDecrementState.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldDecrementState.ts
new file mode 100644
index 00000000000..1fe14ec16b6
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldDecrementState.ts
@@ -0,0 +1,3 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldDecrementState = NumberFieldPrimitive.Decrement.State;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldGroupProps.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldGroupProps.ts
new file mode 100644
index 00000000000..781ebb5396f
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldGroupProps.ts
@@ -0,0 +1,3 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldGroupProps = NumberFieldPrimitive.Group.Props;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldGroupState.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldGroupState.ts
new file mode 100644
index 00000000000..a03b3a3f2e0
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldGroupState.ts
@@ -0,0 +1,3 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldGroupState = NumberFieldPrimitive.Group.State;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldIncrementProps.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldIncrementProps.ts
new file mode 100644
index 00000000000..97557f34ff0
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldIncrementProps.ts
@@ -0,0 +1,3 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldIncrementProps = NumberFieldPrimitive.Increment.Props;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldIncrementState.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldIncrementState.ts
new file mode 100644
index 00000000000..b180766287f
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldIncrementState.ts
@@ -0,0 +1,3 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldIncrementState = NumberFieldPrimitive.Increment.State;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldInputProps.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldInputProps.ts
new file mode 100644
index 00000000000..f7231c91798
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldInputProps.ts
@@ -0,0 +1,3 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldInputProps = NumberFieldPrimitive.Input.Props;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldInputState.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldInputState.ts
new file mode 100644
index 00000000000..f94aa78c035
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldInputState.ts
@@ -0,0 +1,3 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldInputState = NumberFieldPrimitive.Input.State;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootChangeEventDetails.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootChangeEventDetails.ts
new file mode 100644
index 00000000000..3afa15d85c2
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootChangeEventDetails.ts
@@ -0,0 +1,4 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldRootChangeEventDetails =
+ NumberFieldPrimitive.Root.ChangeEventDetails;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootChangeEventReason.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootChangeEventReason.ts
new file mode 100644
index 00000000000..b7d1b2f5b6a
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootChangeEventReason.ts
@@ -0,0 +1,4 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldRootChangeEventReason =
+ NumberFieldPrimitive.Root.ChangeEventReason;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootCommitEventDetails.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootCommitEventDetails.ts
new file mode 100644
index 00000000000..7f213fc64b8
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootCommitEventDetails.ts
@@ -0,0 +1,4 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldRootCommitEventDetails =
+ NumberFieldPrimitive.Root.CommitEventDetails;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootCommitEventReason.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootCommitEventReason.ts
new file mode 100644
index 00000000000..94d1fdc04ae
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootCommitEventReason.ts
@@ -0,0 +1,4 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldRootCommitEventReason =
+ NumberFieldPrimitive.Root.CommitEventReason;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootProps.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootProps.ts
new file mode 100644
index 00000000000..53838c6ea23
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootProps.ts
@@ -0,0 +1,3 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldRootProps = NumberFieldPrimitive.Root.Props;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootState.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootState.ts
new file mode 100644
index 00000000000..beb8248297a
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldRootState.ts
@@ -0,0 +1,3 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldRootState = NumberFieldPrimitive.Root.State;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldScrubAreaCursorProps.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldScrubAreaCursorProps.ts
new file mode 100644
index 00000000000..244d28ec432
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldScrubAreaCursorProps.ts
@@ -0,0 +1,4 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldScrubAreaCursorProps =
+ NumberFieldPrimitive.ScrubAreaCursor.Props;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldScrubAreaCursorState.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldScrubAreaCursorState.ts
new file mode 100644
index 00000000000..2b676c6b350
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldScrubAreaCursorState.ts
@@ -0,0 +1,4 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldScrubAreaCursorState =
+ NumberFieldPrimitive.ScrubAreaCursor.State;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldScrubAreaProps.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldScrubAreaProps.ts
new file mode 100644
index 00000000000..688caa00919
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldScrubAreaProps.ts
@@ -0,0 +1,3 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldScrubAreaProps = NumberFieldPrimitive.ScrubArea.Props;
diff --git a/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldScrubAreaState.ts b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldScrubAreaState.ts
new file mode 100644
index 00000000000..daeea778a94
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/NumberField/types/NumberFieldScrubAreaState.ts
@@ -0,0 +1,3 @@
+import { type NumberField as NumberFieldPrimitive } from '@base-ui/react/number-field';
+
+export type NumberFieldScrubAreaState = NumberFieldPrimitive.ScrubArea.State;
diff --git a/packages/twenty-ui/src/primitives/input/index.ts b/packages/twenty-ui/src/primitives/input/index.ts
index 0cb627875fb..28098dae399 100644
--- a/packages/twenty-ui/src/primitives/input/index.ts
+++ b/packages/twenty-ui/src/primitives/input/index.ts
@@ -43,8 +43,25 @@ export { Input } from './Input/Input';
export type { InputProps } from './Input/types/InputProps';
export { InputGroup } from './InputGroup/InputGroup';
export type { InputGroupProps } from './InputGroup/types/InputGroupProps';
-export { NumberStepper } from './NumberStepper/NumberStepper';
-export type { NumberStepperProps } from './NumberStepper/types/NumberStepperProps';
+export { NumberField } from './NumberField/NumberField';
+export type { NumberFieldDecrementProps } from './NumberField/types/NumberFieldDecrementProps';
+export type { NumberFieldDecrementState } from './NumberField/types/NumberFieldDecrementState';
+export type { NumberFieldGroupProps } from './NumberField/types/NumberFieldGroupProps';
+export type { NumberFieldGroupState } from './NumberField/types/NumberFieldGroupState';
+export type { NumberFieldIncrementProps } from './NumberField/types/NumberFieldIncrementProps';
+export type { NumberFieldIncrementState } from './NumberField/types/NumberFieldIncrementState';
+export type { NumberFieldInputProps } from './NumberField/types/NumberFieldInputProps';
+export type { NumberFieldInputState } from './NumberField/types/NumberFieldInputState';
+export type { NumberFieldRootChangeEventDetails } from './NumberField/types/NumberFieldRootChangeEventDetails';
+export type { NumberFieldRootChangeEventReason } from './NumberField/types/NumberFieldRootChangeEventReason';
+export type { NumberFieldRootCommitEventDetails } from './NumberField/types/NumberFieldRootCommitEventDetails';
+export type { NumberFieldRootCommitEventReason } from './NumberField/types/NumberFieldRootCommitEventReason';
+export type { NumberFieldRootProps } from './NumberField/types/NumberFieldRootProps';
+export type { NumberFieldRootState } from './NumberField/types/NumberFieldRootState';
+export type { NumberFieldScrubAreaCursorProps } from './NumberField/types/NumberFieldScrubAreaCursorProps';
+export type { NumberFieldScrubAreaCursorState } from './NumberField/types/NumberFieldScrubAreaCursorState';
+export type { NumberFieldScrubAreaProps } from './NumberField/types/NumberFieldScrubAreaProps';
+export type { NumberFieldScrubAreaState } from './NumberField/types/NumberFieldScrubAreaState';
export { Radio } from './Radio/Radio';
export type { RadioProps } from './Radio/types/RadioProps';
export { RadioGroup } from './RadioGroup/RadioGroup';
diff --git a/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.tsx b/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.tsx
index 0e390ac8cfe..6fa62743850 100644
--- a/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.tsx
+++ b/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.tsx
@@ -1,7 +1,7 @@
import { DirectionProvider } from '@base-ui/react/direction-provider';
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { useState } from 'react';
-import { expect, userEvent, within } from 'storybook/test';
+import { expect, userEvent, waitFor, within } from 'storybook/test';
import { Tag } from '@ui/primitives/data-display/Tag/Tag';
import { IconInfoCircle } from '@ui/icon';
@@ -209,11 +209,13 @@ export const KeepMounted: Story = {
render: (args) => <TabsExample tabProps={args} keepMounted />,
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
+ const overviewPanel = canvas.getByRole('tabpanel', { name: 'Overview' });
await userEvent.type(
canvas.getByRole('textbox', { name: 'Draft note' }),
'A saved draft',
);
await userEvent.click(canvas.getByRole('tab', { name: 'Activity' }));
+ await waitFor(() => expect(overviewPanel).not.toBeVisible());
await userEvent.tab();
await expect(
canvas.getByRole('tabpanel', { name: 'Activity' }),