@pactor-app/ui 1.26.0 → 1.27.0

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.
@@ -4334,6 +4334,14 @@ function applyPrecision(value, precision) {
4334
4334
  const factor = 10 ** precision;
4335
4335
  return Math.round(value * factor) / factor;
4336
4336
  }
4337
+ function decimalPlaces(value) {
4338
+ if (!Number.isFinite(value)) return 0;
4339
+ const str = String(value);
4340
+ const eIndex = str.indexOf("e-");
4341
+ if (eIndex !== -1) return Number(str.slice(eIndex + 2));
4342
+ const dot = str.indexOf(".");
4343
+ return dot === -1 ? 0 : str.length - dot - 1;
4344
+ }
4337
4345
  function toDisplayText(value) {
4338
4346
  return typeof value === "number" && Number.isFinite(value) ? String(value) : "";
4339
4347
  }
@@ -4382,7 +4390,8 @@ function NumberInput({
4382
4390
  };
4383
4391
  const stepBy = (direction) => {
4384
4392
  const base = externalValue ?? 0;
4385
- const next = applyPrecision(clamp(base + direction * step, min, max), precision);
4393
+ const effectivePrecision = typeof precision === "number" ? precision : Math.max(decimalPlaces(step), decimalPlaces(base));
4394
+ const next = applyPrecision(clamp(base + direction * step, min, max), effectivePrecision);
4386
4395
  setText(toDisplayText(next));
4387
4396
  commit(next);
4388
4397
  };
@@ -7781,6 +7781,14 @@ function applyPrecision(value, precision) {
7781
7781
  const factor = 10 ** precision;
7782
7782
  return Math.round(value * factor) / factor;
7783
7783
  }
7784
+ function decimalPlaces(value) {
7785
+ if (!Number.isFinite(value)) return 0;
7786
+ const str = String(value);
7787
+ const eIndex = str.indexOf("e-");
7788
+ if (eIndex !== -1) return Number(str.slice(eIndex + 2));
7789
+ const dot = str.indexOf(".");
7790
+ return dot === -1 ? 0 : str.length - dot - 1;
7791
+ }
7784
7792
  function toDisplayText(value) {
7785
7793
  return typeof value === "number" && Number.isFinite(value) ? String(value) : "";
7786
7794
  }
@@ -7829,7 +7837,8 @@ function NumberInput({
7829
7837
  };
7830
7838
  const stepBy = (direction) => {
7831
7839
  const base = externalValue ?? 0;
7832
- const next = applyPrecision(clamp(base + direction * step, min, max), precision);
7840
+ const effectivePrecision = typeof precision === "number" ? precision : Math.max(decimalPlaces(step), decimalPlaces(base));
7841
+ const next = applyPrecision(clamp(base + direction * step, min, max), effectivePrecision);
7833
7842
  setText(toDisplayText(next));
7834
7843
  commit(next);
7835
7844
  };
@@ -154,7 +154,7 @@ import {
154
154
  inferKind,
155
155
  registerBuiltinComponents,
156
156
  useFormContext
157
- } from "../chunk-HSQJWJDS.js";
157
+ } from "../chunk-NQJLAELF.js";
158
158
  import {
159
159
  ICONS,
160
160
  Icon,
package/dist/index.cjs CHANGED
@@ -7820,6 +7820,14 @@ function applyPrecision(value, precision) {
7820
7820
  const factor = 10 ** precision;
7821
7821
  return Math.round(value * factor) / factor;
7822
7822
  }
7823
+ function decimalPlaces(value) {
7824
+ if (!Number.isFinite(value)) return 0;
7825
+ const str = String(value);
7826
+ const eIndex = str.indexOf("e-");
7827
+ if (eIndex !== -1) return Number(str.slice(eIndex + 2));
7828
+ const dot = str.indexOf(".");
7829
+ return dot === -1 ? 0 : str.length - dot - 1;
7830
+ }
7823
7831
  function toDisplayText(value) {
7824
7832
  return typeof value === "number" && Number.isFinite(value) ? String(value) : "";
7825
7833
  }
@@ -7868,7 +7876,8 @@ function NumberInput({
7868
7876
  };
7869
7877
  const stepBy = (direction) => {
7870
7878
  const base = externalValue ?? 0;
7871
- const next = applyPrecision(clamp(base + direction * step, min, max), precision);
7879
+ const effectivePrecision = typeof precision === "number" ? precision : Math.max(decimalPlaces(step), decimalPlaces(base));
7880
+ const next = applyPrecision(clamp(base + direction * step, min, max), effectivePrecision);
7872
7881
  setText(toDisplayText(next));
7873
7882
  commit(next);
7874
7883
  };
package/dist/index.js CHANGED
@@ -154,7 +154,7 @@ import {
154
154
  inferKind,
155
155
  registerBuiltinComponents,
156
156
  useFormContext
157
- } from "./chunk-HSQJWJDS.js";
157
+ } from "./chunk-NQJLAELF.js";
158
158
  import {
159
159
  InteractionProvider,
160
160
  OVERLAY_CANCEL_PAYLOAD,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pactor-app/ui",
3
- "version": "1.26.0",
3
+ "version": "1.27.0",
4
4
  "description": "Pactor UI kit (shadcn): the single built-in UI kit — vendored shadcn/ui components (Base UI primitives + cva + tailwind-merge + lucide-react), props contracts, interaction core (OverlayManager / UiBridge) and layouts, with build-time Tailwind v4 prebuilt styles.css (zero consumer-side Tailwind config)",
5
5
  "keywords": [
6
6
  "pactor",
@@ -107,11 +107,11 @@
107
107
  "react-resizable-panels": "^4.12.3",
108
108
  "tailwind-merge": "^3.6.0",
109
109
  "vaul": "^1.1.2",
110
- "@pactor-app/core": "1.26.0",
111
- "@pactor-app/runtime": "1.26.0",
112
- "@pactor-app/permission": "1.26.0",
113
- "@pactor-app/router": "1.26.0",
114
- "@pactor-app/markdown": "1.26.0"
110
+ "@pactor-app/runtime": "1.27.0",
111
+ "@pactor-app/router": "1.27.0",
112
+ "@pactor-app/core": "1.27.0",
113
+ "@pactor-app/markdown": "1.27.0",
114
+ "@pactor-app/permission": "1.27.0"
115
115
  },
116
116
  "peerDependencies": {
117
117
  "react": ">=18",