@sustaina/shared-ui 1.54.0 → 1.54.2

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/index.d.mts CHANGED
@@ -1721,6 +1721,14 @@ type InputProps = Omit<InputPrimitiveProps, "size" | "prefix"> & VariantProps<ty
1721
1721
  validationIcon?: React$1.ReactNode;
1722
1722
  validationMessageProps?: React$1.HTMLAttributes<HTMLParagraphElement>;
1723
1723
  onValueChange?: (value: string) => void;
1724
+ showPrefixDivider?: boolean;
1725
+ showSuffixDivider?: boolean;
1726
+ prefixWidth?: number | string;
1727
+ suffixWidth?: number | string;
1728
+ prefixMinWidth?: number | string;
1729
+ suffixMinWidth?: number | string;
1730
+ prefixMaxWidth?: number | string;
1731
+ suffixMaxWidth?: number | string;
1724
1732
  };
1725
1733
 
1726
1734
  type InputCustomInputProps = Omit<InputProps, "type" | "value" | "defaultValue" | "onValueChange" | "prefix" | "suffix"> & {
@@ -1735,9 +1743,12 @@ type InputNumberProps = NumericFormatProps<InputProps> & {
1735
1743
  min?: number;
1736
1744
  max?: number;
1737
1745
  onStepChange?: (value: number) => void;
1738
- autoFormatDecimal?: boolean;
1746
+ fillDecimalOnBlur?: boolean;
1747
+ truncateDecimalOnBlur?: boolean;
1748
+ maxIntegerDigits?: number;
1749
+ invalid?: boolean;
1739
1750
  };
1740
- declare const InputNumber: ({ customInputProps, showStepper, step, min, max, onStepChange, onValueChange, value, defaultValue, disabled, onBlur, isAllowed: isAllowedProp, autoFormatDecimal, decimalScale: decimalScaleProp, fixedDecimalScale: fixedDecimalScaleProp, ...props }: InputNumberProps) => react_jsx_runtime.JSX.Element;
1751
+ declare const InputNumber: ({ customInputProps, showStepper, step, min, max, onStepChange, onValueChange, value, defaultValue, disabled, onBlur, isAllowed: isAllowedProp, fillDecimalOnBlur, truncateDecimalOnBlur, maxIntegerDigits, invalid, decimalScale: decimalScaleProp, fixedDecimalScale: fixedDecimalScaleProp, ...props }: InputNumberProps) => react_jsx_runtime.JSX.Element;
1741
1752
 
1742
1753
  type PermissionAction = "CREATE" | "READ" | "EDIT" | "DELETE" | "NOTIFY" | "CREATE_DRAFT" | "REQUIRE_SITE";
1743
1754
  type PermissionString = `${string}.${PermissionAction}`;
package/dist/index.d.ts CHANGED
@@ -1721,6 +1721,14 @@ type InputProps = Omit<InputPrimitiveProps, "size" | "prefix"> & VariantProps<ty
1721
1721
  validationIcon?: React$1.ReactNode;
1722
1722
  validationMessageProps?: React$1.HTMLAttributes<HTMLParagraphElement>;
1723
1723
  onValueChange?: (value: string) => void;
1724
+ showPrefixDivider?: boolean;
1725
+ showSuffixDivider?: boolean;
1726
+ prefixWidth?: number | string;
1727
+ suffixWidth?: number | string;
1728
+ prefixMinWidth?: number | string;
1729
+ suffixMinWidth?: number | string;
1730
+ prefixMaxWidth?: number | string;
1731
+ suffixMaxWidth?: number | string;
1724
1732
  };
1725
1733
 
1726
1734
  type InputCustomInputProps = Omit<InputProps, "type" | "value" | "defaultValue" | "onValueChange" | "prefix" | "suffix"> & {
@@ -1735,9 +1743,12 @@ type InputNumberProps = NumericFormatProps<InputProps> & {
1735
1743
  min?: number;
1736
1744
  max?: number;
1737
1745
  onStepChange?: (value: number) => void;
1738
- autoFormatDecimal?: boolean;
1746
+ fillDecimalOnBlur?: boolean;
1747
+ truncateDecimalOnBlur?: boolean;
1748
+ maxIntegerDigits?: number;
1749
+ invalid?: boolean;
1739
1750
  };
1740
- declare const InputNumber: ({ customInputProps, showStepper, step, min, max, onStepChange, onValueChange, value, defaultValue, disabled, onBlur, isAllowed: isAllowedProp, autoFormatDecimal, decimalScale: decimalScaleProp, fixedDecimalScale: fixedDecimalScaleProp, ...props }: InputNumberProps) => react_jsx_runtime.JSX.Element;
1751
+ declare const InputNumber: ({ customInputProps, showStepper, step, min, max, onStepChange, onValueChange, value, defaultValue, disabled, onBlur, isAllowed: isAllowedProp, fillDecimalOnBlur, truncateDecimalOnBlur, maxIntegerDigits, invalid, decimalScale: decimalScaleProp, fixedDecimalScale: fixedDecimalScaleProp, ...props }: InputNumberProps) => react_jsx_runtime.JSX.Element;
1741
1752
 
1742
1753
  type PermissionAction = "CREATE" | "READ" | "EDIT" | "DELETE" | "NOTIFY" | "CREATE_DRAFT" | "REQUIRE_SITE";
1743
1754
  type PermissionString = `${string}.${PermissionAction}`;
package/dist/index.js CHANGED
@@ -5227,6 +5227,7 @@ function DatePicker({
5227
5227
  "h-9 w-full p-0 text-sm font-normal rounded-md transition-all duration-150",
5228
5228
  "border border-transparent",
5229
5229
  !inCurrentMonth && "opacity-50 pointer-events-none",
5230
+ disabled && inCurrentMonth && "opacity-50 pointer-events-none cursor-event-none",
5230
5231
  selected || isRangeStart || isRangeEnd ? "bg-[#379a2a] text-white" : "bg-white text-black hover:border-[#379a2a] hover:bg-green-50 active:bg-green-100",
5231
5232
  isInRange && !isRangeStart && !isRangeEnd && "bg-green-50 border-green-200"
5232
5233
  ),
@@ -15694,6 +15695,63 @@ var Truncated = ({
15694
15695
  );
15695
15696
  };
15696
15697
  var truncated_default = Truncated;
15698
+
15699
+ // src/components/inputNumber/helper.ts
15700
+ var createSourceInfo = (event) => ({
15701
+ event,
15702
+ source: event ? "event" : "prop"
15703
+ });
15704
+ var parseToNumber = (val) => {
15705
+ if (typeof val === "number") return val;
15706
+ if (typeof val === "string" && val !== "") {
15707
+ const parsed = parseFloat(val);
15708
+ if (!isNaN(parsed)) return parsed;
15709
+ }
15710
+ return void 0;
15711
+ };
15712
+ var truncateToFixed = (num, scale) => {
15713
+ if (scale === 0) return Math.trunc(num).toString();
15714
+ const sign = num < 0 ? "-" : "";
15715
+ const abs = Math.abs(num);
15716
+ const str = abs.toString();
15717
+ const dotIndex = str.indexOf(".");
15718
+ let intPart;
15719
+ let fracPart;
15720
+ if (dotIndex === -1) {
15721
+ intPart = str;
15722
+ fracPart = "";
15723
+ } else {
15724
+ intPart = str.slice(0, dotIndex);
15725
+ fracPart = str.slice(dotIndex + 1, dotIndex + 1 + scale);
15726
+ }
15727
+ fracPart = fracPart.padEnd(scale, "0");
15728
+ return `${sign}${intPart}.${fracPart}`;
15729
+ };
15730
+ var truncateStringToFixed = (str, scale) => {
15731
+ const trimmed = str.trim();
15732
+ if (trimmed === "" || trimmed === "-") return "0" + (scale > 0 ? "." + "0".repeat(scale) : "");
15733
+ const negative = trimmed.startsWith("-");
15734
+ const unsigned = negative ? trimmed.slice(1) : trimmed;
15735
+ const dotIndex = unsigned.indexOf(".");
15736
+ let intPart;
15737
+ let fracPart;
15738
+ if (dotIndex === -1) {
15739
+ intPart = unsigned || "0";
15740
+ fracPart = "";
15741
+ } else {
15742
+ intPart = unsigned.slice(0, dotIndex) || "0";
15743
+ fracPart = unsigned.slice(dotIndex + 1, dotIndex + 1 + scale);
15744
+ }
15745
+ if (scale === 0) return (negative ? "-" : "") + intPart;
15746
+ fracPart = fracPart.padEnd(scale, "0");
15747
+ return (negative ? "-" : "") + intPart + "." + fracPart;
15748
+ };
15749
+ var clamp = (value, min, max) => {
15750
+ if (max !== void 0 && value > max) return max;
15751
+ if (min !== void 0 && value < min) return min;
15752
+ return value;
15753
+ };
15754
+ var resolveCssSize = (value) => value !== void 0 ? typeof value === "number" ? `${value}px` : value : void 0;
15697
15755
  var InputPrimitive2 = React__namespace.forwardRef(
15698
15756
  ({ className, type = "text", ...props }, ref) => {
15699
15757
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -15702,7 +15760,7 @@ var InputPrimitive2 = React__namespace.forwardRef(
15702
15760
  ref,
15703
15761
  type,
15704
15762
  className: cn(
15705
- "placeholder:text-neutral-400 text-neutral-900 flex h-10 w-full min-w-0 items-center rounded-lg border bg-white px-4 text-sm transition-colors outline-none file:inline-flex file:h-7 file:rounded-md file:border-0 file:bg-transparent file:px-2 file:text-sm file:font-medium hover:border-neutral-500 focus-visible:border-neutral-900 focus-visible:ring-0 disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-400 disabled:border-neutral-200 aria-invalid:border-destructive",
15763
+ "placeholder:text-neutral-400 text-neutral-900 flex h-10 w-full min-w-0 items-center rounded-lg border bg-white px-4 text-sm transition-colors outline-none file:inline-flex file:h-7 file:rounded-md file:border-0 file:bg-transparent file:px-2 file:text-sm file:font-medium hover:border-neutral-500 focus-visible:border-neutral-900 focus-visible:ring-0 disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-400 disabled:border-neutral-200 aria-invalid:border-destructive aria-invalid:hover:border-destructive aria-invalid:focus-visible:border-destructive",
15706
15764
  className
15707
15765
  ),
15708
15766
  ...props
@@ -15733,6 +15791,26 @@ var inputVariants2 = classVarianceAuthority.cva("", {
15733
15791
  appearance: "filled"
15734
15792
  }
15735
15793
  });
15794
+ var wrapperBorderVariants = classVarianceAuthority.cva(
15795
+ "flex items-center overflow-hidden border bg-white transition-colors",
15796
+ {
15797
+ variants: {
15798
+ controlSize: {
15799
+ sm: "h-9 rounded-md text-sm",
15800
+ md: "h-10 rounded-lg text-sm",
15801
+ lg: "h-12 rounded-xl text-base"
15802
+ },
15803
+ appearance: {
15804
+ filled: "border-neutral-200 hover:border-neutral-500 focus-within:border-neutral-900",
15805
+ unfilled: "border-neutral-300 hover:border-neutral-500 focus-within:border-neutral-900"
15806
+ }
15807
+ },
15808
+ defaultVariants: {
15809
+ controlSize: "sm",
15810
+ appearance: "filled"
15811
+ }
15812
+ }
15813
+ );
15736
15814
  var Input2 = React__namespace.forwardRef(
15737
15815
  ({
15738
15816
  className,
@@ -15753,6 +15831,14 @@ var Input2 = React__namespace.forwardRef(
15753
15831
  validationIcon,
15754
15832
  validationMessageProps,
15755
15833
  onValueChange,
15834
+ showPrefixDivider,
15835
+ showSuffixDivider,
15836
+ prefixWidth,
15837
+ suffixWidth,
15838
+ prefixMinWidth,
15839
+ suffixMinWidth,
15840
+ prefixMaxWidth,
15841
+ suffixMaxWidth,
15756
15842
  type = "text",
15757
15843
  ...rest
15758
15844
  }, ref) => {
@@ -15776,11 +15862,14 @@ var Input2 = React__namespace.forwardRef(
15776
15862
  );
15777
15863
  const resolvedAriaInvalid = typeof ariaInvalid === "string" ? ariaInvalid : ariaInvalid ? true : void 0;
15778
15864
  const describedBy = validationMessage ? [ariaDescribedByProp, messageId].filter(Boolean).join(" ") : ariaDescribedByProp;
15779
- const controlWrapperClassName = cn(
15780
- "relative inline-flex items-center",
15781
- isFullWidth ? "w-full" : "w-fit",
15782
- !validationMessage && wrapperClassName
15783
- );
15865
+ const resolvedPrefixWidth = resolveCssSize(prefixWidth);
15866
+ const resolvedSuffixWidth = resolveCssSize(suffixWidth);
15867
+ const resolvedPrefixMinWidth = resolveCssSize(prefixMinWidth);
15868
+ const resolvedSuffixMinWidth = resolveCssSize(suffixMinWidth);
15869
+ const resolvedPrefixMaxWidth = resolveCssSize(prefixMaxWidth);
15870
+ const resolvedSuffixMaxWidth = resolveCssSize(suffixMaxWidth);
15871
+ const hasPrefixDimension = resolvedPrefixWidth || resolvedPrefixMinWidth || resolvedPrefixMaxWidth;
15872
+ const hasSuffixDimension = resolvedSuffixWidth || resolvedSuffixMinWidth || resolvedSuffixMaxWidth;
15784
15873
  const inputElement = /* @__PURE__ */ jsxRuntime.jsx(
15785
15874
  InputPrimitive2,
15786
15875
  {
@@ -15789,9 +15878,8 @@ var Input2 = React__namespace.forwardRef(
15789
15878
  "data-slot": "input",
15790
15879
  className: cn(
15791
15880
  inputVariants2({ controlSize, fullWidth: isFullWidth, appearance }),
15792
- hasPrefix && "pl-10",
15793
- hasSuffix && "pr-10",
15794
- className
15881
+ // Only apply padding offsets in the legacy (non-flex) path
15882
+ !hasPrefix && !hasSuffix && className
15795
15883
  ),
15796
15884
  "aria-invalid": resolvedAriaInvalid,
15797
15885
  "aria-describedby": describedBy || void 0,
@@ -15809,29 +15897,78 @@ var Input2 = React__namespace.forwardRef(
15809
15897
  addonSuffix,
15810
15898
  loading && (loadingIcon ?? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 16, variant: "muted" }))
15811
15899
  ] });
15812
- const inputWithAffixes = /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "input-wrapper", className: controlWrapperClassName, children: [
15900
+ const flexWrapperClassName = cn(
15901
+ wrapperBorderVariants({ controlSize, appearance }),
15902
+ isFullWidth ? "w-full" : "w-fit",
15903
+ rest.disabled && "bg-sus-secondary-gray-3 border-sus-secondary-gray-5 hover:border-sus-secondary-gray-5",
15904
+ resolvedAriaInvalid && "border-destructive hover:border-destructive focus-within:border-destructive",
15905
+ !validationMessage && wrapperClassName
15906
+ );
15907
+ const divider = /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "addon-divider", className: "self-stretch w-px shrink-0 bg-neutral-200" });
15908
+ const flexInput = /* @__PURE__ */ jsxRuntime.jsx(
15909
+ InputPrimitive2,
15910
+ {
15911
+ ref,
15912
+ type,
15913
+ "data-slot": "input",
15914
+ className: cn(
15915
+ "flex-1 min-w-0 h-full border-0 rounded-none bg-transparent px-3 outline-none ring-0",
15916
+ "placeholder:text-neutral-400 text-neutral-900 text-sm transition-colors",
15917
+ "focus-visible:ring-0 focus-visible:border-0",
15918
+ "disabled:cursor-not-allowed disabled:bg-transparent disabled:text-neutral-400",
15919
+ className
15920
+ ),
15921
+ "aria-invalid": resolvedAriaInvalid,
15922
+ "aria-describedby": describedBy || void 0,
15923
+ onChange: handleChange,
15924
+ ...inputProps
15925
+ }
15926
+ );
15927
+ const inputWithAffixes = /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "input-wrapper", className: cn("group/input-wrapper", flexWrapperClassName), children: [
15813
15928
  hasPrefix && /* @__PURE__ */ jsxRuntime.jsx(
15814
15929
  "span",
15815
15930
  {
15816
15931
  ...prefixRest,
15932
+ "data-slot": "addon-prefix",
15817
15933
  className: cn(
15818
- "absolute left-3 top-1/2 -translate-y-1/2 inline-flex items-center text-muted-foreground",
15934
+ "shrink-0 inline-flex items-center px-3 text-sm text-muted-foreground",
15935
+ hasPrefixDimension ? "overflow-hidden" : "whitespace-nowrap",
15936
+ rest.disabled && "text-neutral-400",
15819
15937
  !prefixInteractive && "pointer-events-none",
15820
15938
  prefixClassName
15821
15939
  ),
15940
+ style: hasPrefixDimension ? {
15941
+ ...resolvedPrefixWidth && { width: resolvedPrefixWidth },
15942
+ ...resolvedPrefixMinWidth && { minWidth: resolvedPrefixMinWidth },
15943
+ ...resolvedPrefixMaxWidth && { maxWidth: resolvedPrefixMaxWidth },
15944
+ boxSizing: "border-box",
15945
+ ...prefixRest?.style
15946
+ } : prefixRest?.style,
15822
15947
  children: addonPrefix
15823
15948
  }
15824
15949
  ),
15825
- inputElement,
15950
+ hasPrefix && showPrefixDivider && divider,
15951
+ flexInput,
15952
+ hasSuffix && showSuffixDivider && divider,
15826
15953
  hasSuffix && /* @__PURE__ */ jsxRuntime.jsx(
15827
15954
  "span",
15828
15955
  {
15829
15956
  ...suffixRest,
15957
+ "data-slot": "addon-suffix",
15830
15958
  className: cn(
15831
- "absolute right-3 top-1/2 -translate-y-1/2 inline-flex items-center gap-2 text-muted-foreground",
15959
+ "shrink-0 inline-flex items-center gap-2 px-3 text-sm text-muted-foreground",
15960
+ hasSuffixDimension ? "overflow-hidden" : "whitespace-nowrap",
15961
+ rest.disabled && "text-neutral-400",
15832
15962
  !suffixInteractive && "pointer-events-none",
15833
15963
  suffixClassName
15834
15964
  ),
15965
+ style: hasSuffixDimension ? {
15966
+ ...resolvedSuffixWidth && { width: resolvedSuffixWidth },
15967
+ ...resolvedSuffixMinWidth && { minWidth: resolvedSuffixMinWidth },
15968
+ ...resolvedSuffixMaxWidth && { maxWidth: resolvedSuffixMaxWidth },
15969
+ boxSizing: "border-box",
15970
+ ...suffixRest?.style
15971
+ } : suffixRest?.style,
15835
15972
  children: suffixContent
15836
15973
  }
15837
15974
  )
@@ -15857,63 +15994,7 @@ var Input2 = React__namespace.forwardRef(
15857
15994
  }
15858
15995
  );
15859
15996
  Input2.displayName = "Input";
15860
-
15861
- // src/components/inputNumber/helper.ts
15862
- var createSourceInfo = (event) => ({
15863
- event,
15864
- source: event ? "event" : "prop"
15865
- });
15866
- var parseToNumber = (val) => {
15867
- if (typeof val === "number") return val;
15868
- if (typeof val === "string" && val !== "") {
15869
- const parsed = parseFloat(val);
15870
- if (!isNaN(parsed)) return parsed;
15871
- }
15872
- return void 0;
15873
- };
15874
- var truncateToFixed = (num, scale) => {
15875
- if (scale === 0) return Math.trunc(num).toString();
15876
- const sign = num < 0 ? "-" : "";
15877
- const abs = Math.abs(num);
15878
- const str = abs.toString();
15879
- const dotIndex = str.indexOf(".");
15880
- let intPart;
15881
- let fracPart;
15882
- if (dotIndex === -1) {
15883
- intPart = str;
15884
- fracPart = "";
15885
- } else {
15886
- intPart = str.slice(0, dotIndex);
15887
- fracPart = str.slice(dotIndex + 1, dotIndex + 1 + scale);
15888
- }
15889
- fracPart = fracPart.padEnd(scale, "0");
15890
- return `${sign}${intPart}.${fracPart}`;
15891
- };
15892
- var truncateStringToFixed = (str, scale) => {
15893
- const trimmed = str.trim();
15894
- if (trimmed === "" || trimmed === "-") return "0" + (scale > 0 ? "." + "0".repeat(scale) : "");
15895
- const negative = trimmed.startsWith("-");
15896
- const unsigned = negative ? trimmed.slice(1) : trimmed;
15897
- const dotIndex = unsigned.indexOf(".");
15898
- let intPart;
15899
- let fracPart;
15900
- if (dotIndex === -1) {
15901
- intPart = unsigned || "0";
15902
- fracPart = "";
15903
- } else {
15904
- intPart = unsigned.slice(0, dotIndex) || "0";
15905
- fracPart = unsigned.slice(dotIndex + 1, dotIndex + 1 + scale);
15906
- }
15907
- if (scale === 0) return (negative ? "-" : "") + intPart;
15908
- fracPart = fracPart.padEnd(scale, "0");
15909
- return (negative ? "-" : "") + intPart + "." + fracPart;
15910
- };
15911
- var clamp = (value, min, max) => {
15912
- if (max !== void 0 && value > max) return max;
15913
- if (min !== void 0 && value < min) return min;
15914
- return value;
15915
- };
15916
- function useAutoFormatDecimal({
15997
+ function useFillDecimalOnBlur({
15917
15998
  enabled,
15918
15999
  decimalScale,
15919
16000
  value,
@@ -15935,7 +16016,7 @@ function useAutoFormatDecimal({
15935
16016
  if (blurScale !== void 0 && !isUserEditingRef.current) {
15936
16017
  setFormattedValue(truncateToFixed(parsed, blurScale));
15937
16018
  }
15938
- } else if (value === void 0 || value === null || value === "") {
16019
+ } else if (value === null || value === "") {
15939
16020
  setFormattedValue(void 0);
15940
16021
  }
15941
16022
  }, [value, enabled, blurScale]);
@@ -15990,11 +16071,15 @@ var InputNumber = ({
15990
16071
  disabled,
15991
16072
  onBlur,
15992
16073
  isAllowed: isAllowedProp,
15993
- autoFormatDecimal = false,
16074
+ fillDecimalOnBlur = false,
16075
+ truncateDecimalOnBlur = false,
16076
+ maxIntegerDigits,
16077
+ invalid,
15994
16078
  decimalScale: decimalScaleProp,
15995
16079
  fixedDecimalScale: fixedDecimalScaleProp,
15996
16080
  ...props
15997
16081
  }) => {
16082
+ const blurFormatEnabled = fillDecimalOnBlur || truncateDecimalOnBlur;
15998
16083
  const [internalValue, setInternalValue] = React__namespace.useState(
15999
16084
  () => parseToNumber(value) ?? parseToNumber(defaultValue)
16000
16085
  );
@@ -16009,12 +16094,24 @@ var InputNumber = ({
16009
16094
  }
16010
16095
  isBlurClampedRef.current = false;
16011
16096
  }, [value]);
16012
- const autoFormat = useAutoFormatDecimal({
16013
- enabled: autoFormatDecimal,
16097
+ const autoFormat = useFillDecimalOnBlur({
16098
+ enabled: blurFormatEnabled,
16014
16099
  decimalScale: decimalScaleProp,
16015
16100
  value,
16016
16101
  defaultValue
16017
16102
  });
16103
+ const isAllowed = React__namespace.useMemo(() => {
16104
+ if (maxIntegerDigits === void 0 && !isAllowedProp) return void 0;
16105
+ return (values) => {
16106
+ if (maxIntegerDigits !== void 0) {
16107
+ const raw = values.value;
16108
+ const unsigned = raw.replace(/^-/, "");
16109
+ const intPart = unsigned.split(".")[0].replace(/^0+/, "") || "0";
16110
+ if (intPart.length > maxIntegerDigits) return false;
16111
+ }
16112
+ return isAllowedProp ? isAllowedProp(values) : true;
16113
+ };
16114
+ }, [maxIntegerDigits, isAllowedProp]);
16018
16115
  const notifyChange = React__namespace.useCallback(
16019
16116
  (newValue, event) => {
16020
16117
  internalValueRef.current = newValue;
@@ -16079,16 +16176,16 @@ var InputNumber = ({
16079
16176
  );
16080
16177
  onStepChange?.(clamped);
16081
16178
  }
16082
- if (autoFormatDecimal && autoFormat.blurScale !== void 0) {
16083
- const rawStr = wasClamped ? String(clamped) : rawValueRef.current || "0";
16179
+ if (blurFormatEnabled && autoFormat.blurScale !== void 0) {
16180
+ const rawStr = wasClamped ? String(clamped) : rawValueRef.current || String(clamped);
16084
16181
  autoFormat.onBlur(truncateStringToFixed(rawStr, autoFormat.blurScale));
16085
16182
  } else {
16086
16183
  autoFormat.resetEditing();
16087
16184
  }
16088
16185
  },
16089
- [onBlur, autoFormatDecimal, autoFormat, min, max, onValueChange, onStepChange]
16186
+ [onBlur, blurFormatEnabled, autoFormat, min, max, onValueChange, onStepChange]
16090
16187
  );
16091
- const effectiveValue = autoFormat.formattedValue !== void 0 ? autoFormat.formattedValue : isBlurClampedRef.current || stepper.changed || autoFormatDecimal ? internalValue : value;
16188
+ const effectiveValue = autoFormat.formattedValue !== void 0 ? autoFormat.formattedValue : isBlurClampedRef.current || stepper.changed || blurFormatEnabled ? internalValue : value;
16092
16189
  const buttonClass = cn(
16093
16190
  "flex items-center justify-center h-3 w-5 transition-colors outline-none",
16094
16191
  "text-neutral-400 hover:text-neutral-600 active:text-neutral-900",
@@ -16102,14 +16199,12 @@ var InputNumber = ({
16102
16199
  defaultValue,
16103
16200
  onValueChange: handleValueChange,
16104
16201
  onBlur: handleBlur,
16105
- ...isAllowedProp && { isAllowed: isAllowedProp },
16106
- ...!autoFormatDecimal && {
16107
- decimalScale: decimalScaleProp,
16108
- fixedDecimalScale: fixedDecimalScaleProp
16109
- },
16202
+ ...isAllowed && { isAllowed },
16203
+ ...truncateDecimalOnBlur ? {} : fillDecimalOnBlur ? { decimalScale: decimalScaleProp } : { decimalScale: decimalScaleProp, fixedDecimalScale: fixedDecimalScaleProp },
16110
16204
  ...autoFormat.formattedValue !== void 0 && { valueIsNumericString: true },
16111
16205
  ...props,
16112
16206
  disabled,
16207
+ invalid,
16113
16208
  ...customInputProps,
16114
16209
  addonSuffix: showStepper ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col -space-y-px", children: [
16115
16210
  /* @__PURE__ */ jsxRuntime.jsx(