Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

feat: replace slider field to input number for bigInt

dev_wandry8cc0f7dc5abe
diff --git a/components/docs/component-customizer.tsx b/components/docs/component-customizer.tsx
index 0128d778..65e9051b 100644
--- a/components/docs/component-customizer.tsx
+++ b/components/docs/component-customizer.tsx
@@ -2,6 +2,7 @@
import { Select as SelectPrimitive } from "@base-ui/react/select";
import { ChevronDownIcon } from "lucide-react";
+import { useEffect, useRef, useState } from "react";
import { ElasticSlider } from "@/components/ui/elastic-slider";
import { Label } from "@/components/ui/label";
import { SelectContent, SelectItem } from "@/components/ui/select";
@@ -68,6 +69,63 @@ function SelectPill({
);
}
+function NumberInputPill({
+ id,
+ ctrl,
+ value,
+ onChange,
+}: {
+ id: string;
+ ctrl: Extract<ControlType, { type: "number-input" }>;
+ value: number;
+ onChange: (value: number) => void;
+}) {
+ const [draft, setDraft] = useState(String(value));
+ const committed = useRef(value);
+
+ useEffect(() => {
+ if (value !== committed.current) {
+ committed.current = value;
+ setDraft(String(value));
+ }
+ }, [value]);
+
+ const commit = (raw: string) => {
+ if (raw === "" || raw === "-") return;
+ const n = Number(raw);
+ if (Number.isNaN(n)) return;
+ const clamped = Math.min(ctrl.max, Math.max(ctrl.min, n));
+ committed.current = clamped;
+ onChange(clamped);
+ };
+
+ return (
+ <div className={PILL}>
+ <Label
+ htmlFor={id}
+ className="shrink-0 font-medium text-muted-foreground"
+ >
+ {ctrl.label}
+ </Label>
+ <input
+ id={id}
+ type="number"
+ inputMode="numeric"
+ min={ctrl.min}
+ max={ctrl.max}
+ step={ctrl.step}
+ value={draft}
+ onChange={(e) => {
+ setDraft(e.target.value);
+ commit(e.target.value);
+ }}
+ onBlur={() => setDraft(String(committed.current))}
+ className="min-w-0 flex-1 bg-transparent text-right font-mono text-sm font-medium text-foreground outline-none placeholder:text-muted-foreground/50 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
+ />
+ </div>
+ );
+}
+
function Control({
id,
ctrl,
@@ -94,6 +152,16 @@ function Control({
/>
);
+ case "number-input":
+ return (
+ <NumberInputPill
+ id={id}
+ ctrl={ctrl}
+ value={value as number}
+ onChange={onChange}
+ />
+ );
+
case "select":
return (
<SelectPill id={id} ctrl={ctrl} value={value as string} onChange={onChange} />
diff --git a/lib/customizer-config.ts b/lib/customizer-config.ts
index 91a107ff..800a5c47 100644
--- a/lib/customizer-config.ts
+++ b/lib/customizer-config.ts
@@ -10,6 +10,14 @@ export type ControlType =
step: number;
label: string;
}
+ | {
+ type: "number-input";
+ default: number;
+ min: number;
+ max: number;
+ step: number;
+ label: string;
+ }
| { type: "color"; default: string; label: string }
| { type: "select"; default: string; options: string[]; label: string }
| { type: "boolean"; default: boolean; label: string };
diff --git a/lib/ui-preview-internals.tsx b/lib/ui-preview-internals.tsx
index cab0a206..084136b3 100644
--- a/lib/ui-preview-internals.tsx
+++ b/lib/ui-preview-internals.tsx
@@ -38,7 +38,7 @@ export function buildParsers(name: string, controls: ControlConfig) {
urlKeys[key] = `${prefix}_${key}`;
if (ctrl.type === "text") {
parsers[key] = parseAsString.withDefault(ctrl.default);
- } else if (ctrl.type === "number") {
+ } else if (ctrl.type === "number" || ctrl.type === "number-input") {
parsers[key] = parseAsFloat.withDefault(ctrl.default);
} else if (ctrl.type === "color") {
parsers[key] = parseAsString.withDefault(ctrl.default);
diff --git a/registry/remocn/confetti/config.ts b/registry/remocn/confetti/config.ts
index 9f35fea1..447a7919 100644
--- a/registry/remocn/confetti/config.ts
+++ b/registry/remocn/confetti/config.ts
@@ -37,7 +37,7 @@ export const confettiConfig: ComponentConfig = {
label: "Size",
},
seed: {
- type: "number",
+ type: "number-input",
default: 1,
min: 1,
max: 9999,
diff --git a/registry/remocn/dashboard-populate/config.ts b/registry/remocn/dashboard-populate/config.ts
index 18fcdb8b..769320b8 100644
--- a/registry/remocn/dashboard-populate/config.ts
+++ b/registry/remocn/dashboard-populate/config.ts
@@ -10,7 +10,7 @@ export const dashboardPopulateConfig: ComponentConfig = {
label: "Accent color",
},
kpiTarget: {
- type: "number",
+ type: "number-input",
default: 128400,
min: 1000,
max: 1000000,
diff --git a/registry/remocn/github-stars/config.ts b/registry/remocn/github-stars/config.ts
index da64d1f2..6864f18d 100644
--- a/registry/remocn/github-stars/config.ts
+++ b/registry/remocn/github-stars/config.ts
@@ -15,7 +15,7 @@ export const githubStarsConfig: ComponentConfig = {
label: "Repository",
},
totalStars: {
- type: "number",
+ type: "number-input",
default: 24813,
min: 0,
max: 500000,
diff --git a/registry/remocn/number-wheel/config.ts b/registry/remocn/number-wheel/config.ts
index d120e2c3..de5068f2 100644
--- a/registry/remocn/number-wheel/config.ts
+++ b/registry/remocn/number-wheel/config.ts
@@ -5,7 +5,7 @@ export const numberWheelConfig: ComponentConfig = {
importPath: "@/components/remocn/number-wheel",
controls: {
from: {
- type: "number",
+ type: "number-input",
default: 0,
min: 0,
max: 1000000,
@@ -13,7 +13,7 @@ export const numberWheelConfig: ComponentConfig = {
label: "From",
},
to: {
- type: "number",
+ type: "number-input",
default: 24813,
min: 0,
max: 1000000,
diff --git a/registry/remocn/rolling-number/config.ts b/registry/remocn/rolling-number/config.ts
index b0aa0dce..e60cfe75 100644
--- a/registry/remocn/rolling-number/config.ts
+++ b/registry/remocn/rolling-number/config.ts
@@ -5,7 +5,7 @@ export const rollingNumberConfig: ComponentConfig = {
importPath: "@/components/remocn/rolling-number",
controls: {
from: {
- type: "number",
+ type: "number-input",
default: 0,
min: 0,
max: 1000000,
@@ -13,7 +13,7 @@ export const rollingNumberConfig: ComponentConfig = {
label: "From",
},
to: {
- type: "number",
+ type: "number-input",
default: 24813,
min: 0,
max: 1000000,
diff --git a/registry/remocn/x-followers-overview/config.ts b/registry/remocn/x-followers-overview/config.ts
index d642b01d..31eeaf93 100644
--- a/registry/remocn/x-followers-overview/config.ts
+++ b/registry/remocn/x-followers-overview/config.ts
@@ -5,7 +5,7 @@ export const xFollowersOverviewConfig: ComponentConfig = {
importPath: "@/components/remocn/x-followers-overview",
controls: {
totalFollowers: {
- type: "number",
+ type: "number-input",
default: 1709,
min: 0,
max: 10000000,