Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

call conditionally instead of defining a default value

Sultanab7795e9bf24
diff --git a/packages/design-system/src/components/primitives/numeric-gesture-control.ts b/packages/design-system/src/components/primitives/numeric-gesture-control.ts
index c7433069ab..76438fd2ed 100644
--- a/packages/design-system/src/components/primitives/numeric-gesture-control.ts
+++ b/packages/design-system/src/components/primitives/numeric-gesture-control.ts
@@ -48,8 +48,8 @@ export const numericScrubControl = (
maxValue = Number.MAX_SAFE_INTEGER,
initialValue = 0,
direction = "horizontal",
- onValueInput = () => null,
- onValueChange = () => null,
+ onValueInput,
+ onValueChange,
}: NumericScrubOptions
) => {
const eventNames = ["pointerup", "pointerdown", "pointermove"] as const;
@@ -82,7 +82,7 @@ export const numericScrubControl = (
state.offset = 0;
handleCursor(targetNode.ownerDocument.documentElement, false);
exitPointerLock(state, event, targetNode);
- onValueChange({
+ onValueChange?.({
target: targetNode,
value: state.value,
preventDefault: () => event.preventDefault(),
@@ -105,7 +105,7 @@ export const numericScrubControl = (
if (state.value < minValue) state.value = minValue;
else if (state.value > maxValue) state.value = maxValue;
state.offset += movement * state.velocity;
- onValueInput({
+ onValueInput?.({
target: targetNode,
value: state.value,
preventDefault: () => event.preventDefault(),