@remotion/design 4.0.384 → 4.0.386

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Counter.d.ts CHANGED
@@ -2,8 +2,9 @@ import React from 'react';
2
2
  interface CounterProps {
3
3
  readonly count: number;
4
4
  readonly setCount: (count: number) => void;
5
- readonly minCount?: number;
6
- readonly step?: number;
5
+ readonly minCount: number;
6
+ readonly step: number;
7
+ readonly incrementStep: number;
7
8
  }
8
9
  export declare const Counter: React.FC<CounterProps>;
9
10
  export {};
package/dist/Counter.js CHANGED
@@ -20,22 +20,26 @@ const buttonContainer = {
20
20
  alignItems: 'center',
21
21
  cursor: 'pointer',
22
22
  };
23
- export const Counter = ({ count, setCount, minCount = 0, step = 1, }) => {
23
+ const MAX_COUNT = 9999999;
24
+ export const Counter = ({ count, setCount, minCount, step, incrementStep, }) => {
24
25
  const decrement = () => {
25
26
  if (count > minCount) {
26
- setCount(Math.max(minCount, count - step));
27
+ setCount(Math.max(minCount, count - incrementStep));
27
28
  }
28
29
  };
29
30
  const increment = () => {
30
- setCount(count + step);
31
+ const nextValue = count + incrementStep;
32
+ const roundedValue = Math.round(nextValue / incrementStep) * incrementStep;
33
+ setCount(Math.min(MAX_COUNT, roundedValue));
31
34
  };
32
- return (_jsxs(Card, { style: container, className: cn('w-[140px] flex flex-row overflow-hidden'), children: [_jsx("input", { className: 'fontbrand text-2xl font-medium min-w-[80px] border-0 text-end outline-0 text-text overflow-hidden flex-1 px-0 py-0 pr-2 w-full h-full tabular-nums', type: "number", onClick: (e) => e.currentTarget.select(), value: count, onChange: (e) => {
35
+ const shrink = String(count).length > 6;
36
+ return (_jsxs(Card, { style: container, className: cn('w-[140px] flex flex-row overflow-hidden'), children: [_jsx("input", { className: cn('fontbrand font-medium min-w-[80px] border-0 text-end outline-0 text-text overflow-hidden flex-1 px-0 py-0 pr-2 w-full h-full tabular-nums', shrink ? 'text-lg' : 'text-2xl'), type: "number", value: count, onClick: (e) => e.currentTarget.select(), onChange: (e) => {
33
37
  if (e.target.value.trim() === '') {
34
38
  setCount(step === 1 ? 1 : minCount);
35
39
  return;
36
40
  }
37
41
  const inputValue = parseInt(e.target.value, 10);
38
- const validValue = Math.max(inputValue, minCount);
42
+ const validValue = Math.min(MAX_COUNT, Math.max(inputValue, minCount));
39
43
  // For steps > 1, round to the nearest valid step
40
44
  if (step > 1) {
41
45
  const roundedValue = Math.round(validValue / step) * step;
@@ -498,36 +498,41 @@ var buttonContainer = {
498
498
  alignItems: "center",
499
499
  cursor: "pointer"
500
500
  };
501
+ var MAX_COUNT = 9999999;
501
502
  var Counter = ({
502
503
  count,
503
504
  setCount,
504
- minCount = 0,
505
- step = 1
505
+ minCount,
506
+ step,
507
+ incrementStep
506
508
  }) => {
507
509
  const decrement = () => {
508
510
  if (count > minCount) {
509
- setCount(Math.max(minCount, count - step));
511
+ setCount(Math.max(minCount, count - incrementStep));
510
512
  }
511
513
  };
512
514
  const increment = () => {
513
- setCount(count + step);
515
+ const nextValue = count + incrementStep;
516
+ const roundedValue = Math.round(nextValue / incrementStep) * incrementStep;
517
+ setCount(Math.min(MAX_COUNT, roundedValue));
514
518
  };
519
+ const shrink = String(count).length > 6;
515
520
  return /* @__PURE__ */ jsxs3(Card, {
516
521
  style: container,
517
522
  className: cn("w-[140px] flex flex-row overflow-hidden"),
518
523
  children: [
519
524
  /* @__PURE__ */ jsx7("input", {
520
- className: "fontbrand text-2xl font-medium min-w-[80px] border-0 text-end outline-0 text-text overflow-hidden flex-1 px-0 py-0 pr-2 w-full h-full tabular-nums",
525
+ className: cn("fontbrand font-medium min-w-[80px] border-0 text-end outline-0 text-text overflow-hidden flex-1 px-0 py-0 pr-2 w-full h-full tabular-nums", shrink ? "text-lg" : "text-2xl"),
521
526
  type: "number",
522
- onClick: (e) => e.currentTarget.select(),
523
527
  value: count,
528
+ onClick: (e) => e.currentTarget.select(),
524
529
  onChange: (e) => {
525
530
  if (e.target.value.trim() === "") {
526
531
  setCount(step === 1 ? 1 : minCount);
527
532
  return;
528
533
  }
529
534
  const inputValue = parseInt(e.target.value, 10);
530
- const validValue = Math.max(inputValue, minCount);
535
+ const validValue = Math.min(MAX_COUNT, Math.max(inputValue, minCount));
531
536
  if (step > 1) {
532
537
  const roundedValue = Math.round(validValue / step) * step;
533
538
  setCount(Math.max(roundedValue, minCount));
package/dist/tailwind.css CHANGED
@@ -339,6 +339,9 @@
339
339
  .flex-1 {
340
340
  flex: 1;
341
341
  }
342
+ .shrink {
343
+ flex-shrink: 1;
344
+ }
342
345
  .transform {
343
346
  transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y);
344
347
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/design",
3
- "version": "4.0.384",
3
+ "version": "4.0.386",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/esm/index.mjs",
@@ -19,11 +19,11 @@
19
19
  "make": "tsc -d && bun --env-file=../.env.bundle bundle.ts"
20
20
  },
21
21
  "dependencies": {
22
- "@remotion/paths": "4.0.384",
23
- "@remotion/shapes": "4.0.384",
24
- "@remotion/svg-3d-engine": "4.0.384",
22
+ "@remotion/paths": "4.0.386",
23
+ "@remotion/shapes": "4.0.386",
24
+ "@remotion/svg-3d-engine": "4.0.386",
25
25
  "clsx": "^2.1.1",
26
- "remotion": "4.0.384",
26
+ "remotion": "4.0.386",
27
27
  "@radix-ui/react-select": "2.1.1",
28
28
  "lucide-react": "0.439.0"
29
29
  },
@@ -32,7 +32,7 @@
32
32
  "react-dom": ">=16.8.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@remotion/eslint-config-internal": "4.0.384",
35
+ "@remotion/eslint-config-internal": "4.0.386",
36
36
  "eslint": "9.19.0",
37
37
  "react": "19.2.1",
38
38
  "react-dom": "19.2.1",