@spicenet-io/spiceflow-ui 1.7.6 → 1.7.7

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.cjs.js CHANGED
@@ -1668,6 +1668,31 @@ const AssetSelectorComponent = ({
1668
1668
  ]);
1669
1669
  const handleAmountChange = (value) => {
1670
1670
  const cleanValue = parseNumericInput(value);
1671
+ if (!cleanValue) {
1672
+ setLocalAmount(cleanValue);
1673
+ if (debounceTimerRef.current) {
1674
+ clearTimeout(debounceTimerRef.current);
1675
+ }
1676
+ debounceTimerRef.current = setTimeout(() => {
1677
+ onAmountChange(cleanValue);
1678
+ }, 300);
1679
+ return;
1680
+ }
1681
+ if (selectedAsset?.asset) {
1682
+ const numAmount = parseFloat(cleanValue);
1683
+ const maxBalance = selectedAsset.asset.balanceFormatted;
1684
+ if (!isNaN(numAmount) && numAmount > maxBalance) {
1685
+ const clampedAmount = maxBalance.toString();
1686
+ setLocalAmount(clampedAmount);
1687
+ if (debounceTimerRef.current) {
1688
+ clearTimeout(debounceTimerRef.current);
1689
+ }
1690
+ debounceTimerRef.current = setTimeout(() => {
1691
+ onAmountChange(clampedAmount);
1692
+ }, 300);
1693
+ return;
1694
+ }
1695
+ }
1671
1696
  setLocalAmount(cleanValue);
1672
1697
  if (debounceTimerRef.current) {
1673
1698
  clearTimeout(debounceTimerRef.current);
package/dist/index.js CHANGED
@@ -1666,6 +1666,31 @@ const AssetSelectorComponent = ({
1666
1666
  ]);
1667
1667
  const handleAmountChange = (value) => {
1668
1668
  const cleanValue = parseNumericInput(value);
1669
+ if (!cleanValue) {
1670
+ setLocalAmount(cleanValue);
1671
+ if (debounceTimerRef.current) {
1672
+ clearTimeout(debounceTimerRef.current);
1673
+ }
1674
+ debounceTimerRef.current = setTimeout(() => {
1675
+ onAmountChange(cleanValue);
1676
+ }, 300);
1677
+ return;
1678
+ }
1679
+ if (selectedAsset?.asset) {
1680
+ const numAmount = parseFloat(cleanValue);
1681
+ const maxBalance = selectedAsset.asset.balanceFormatted;
1682
+ if (!isNaN(numAmount) && numAmount > maxBalance) {
1683
+ const clampedAmount = maxBalance.toString();
1684
+ setLocalAmount(clampedAmount);
1685
+ if (debounceTimerRef.current) {
1686
+ clearTimeout(debounceTimerRef.current);
1687
+ }
1688
+ debounceTimerRef.current = setTimeout(() => {
1689
+ onAmountChange(clampedAmount);
1690
+ }, 300);
1691
+ return;
1692
+ }
1693
+ }
1669
1694
  setLocalAmount(cleanValue);
1670
1695
  if (debounceTimerRef.current) {
1671
1696
  clearTimeout(debounceTimerRef.current);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spicenet-io/spiceflow-ui",
3
- "version": "1.7.6",
3
+ "version": "1.7.7",
4
4
  "description": "Spiceflow UI SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",