kaleido-ui 0.1.74 → 0.1.76

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.
@@ -4765,9 +4765,17 @@ function WithdrawAmountInput({
4765
4765
  feeRate,
4766
4766
  setFeeRate,
4767
4767
  feeRates,
4768
+ feeRateMode,
4769
+ setFeeRateMode,
4770
+ customFeeRate,
4771
+ setCustomFeeRate,
4772
+ effectiveFeeRateSatPerVb,
4773
+ estimatedFee,
4768
4774
  donation,
4769
4775
  setDonation
4770
4776
  }) {
4777
+ const customFeeEnabled = typeof setFeeRateMode === "function";
4778
+ const activeFeeMode = feeRateMode ?? feeRate;
4771
4779
  const unitLabel = selectedAssetId === "BTC" ? "sats" : selectedAssetTicker ?? "units";
4772
4780
  const showAmountInput = addressType === "bitcoin" || addressType === "spark" || addressType === "arkade" || addressType === "lightning-address" || addressType === "lnurl-pay" || addressType === "rgb" && !decodedRgbInvoice?.assignment?.value || addressType === "lightning" && !decodedLnInvoice?.amount && !decodedLnInvoice?.asset_amount;
4773
4781
  const enteredNum = parseFloat(amount.replace(/[^\d.-]/g, "") || "0") || 0;
@@ -4846,7 +4854,58 @@ function WithdrawAmountInput({
4846
4854
  ] }),
4847
4855
  (addressType === "bitcoin" || addressType === "rgb") && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "space-y-2", children: [
4848
4856
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { className: "ml-1 text-xs font-bold uppercase tracking-wider text-muted-foreground", children: "Fee Rate" }),
4849
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "grid grid-cols-3 gap-3", children: ["slow", "normal", "fast"].map((rate) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
4857
+ customFeeEnabled ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
4858
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "grid grid-cols-4 gap-2", children: ["slow", "normal", "fast", "custom"].map((mode) => {
4859
+ const selected = activeFeeMode === mode;
4860
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
4861
+ "button",
4862
+ {
4863
+ type: "button",
4864
+ onClick: () => {
4865
+ setFeeRateMode?.(mode);
4866
+ if (mode !== "custom") setFeeRate(mode);
4867
+ },
4868
+ className: `group relative overflow-hidden rounded-xl border px-2 py-3 shadow-sm transition-all active:scale-[0.98] ${selected ? "border-primary/40 bg-primary/10" : "border-border bg-card/40 hover:border-primary/40"}`,
4869
+ children: [
4870
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
4871
+ "span",
4872
+ {
4873
+ className: `block text-xs font-bold capitalize ${selected ? "text-primary" : "text-muted-foreground group-hover:text-primary"}`,
4874
+ children: mode
4875
+ }
4876
+ ),
4877
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
4878
+ "span",
4879
+ {
4880
+ className: `mt-0.5 block text-xxs font-medium ${selected ? "text-primary/70" : "text-white/40 group-hover:text-white/70"}`,
4881
+ children: mode === "custom" ? "sat/vB" : `${feeRates[mode]} sat/vB`
4882
+ }
4883
+ )
4884
+ ]
4885
+ },
4886
+ mode
4887
+ );
4888
+ }) }),
4889
+ activeFeeMode === "custom" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
4890
+ "input",
4891
+ {
4892
+ type: "text",
4893
+ inputMode: "decimal",
4894
+ placeholder: `${feeRates[feeRate]} (${feeRate})`,
4895
+ value: customFeeRate ?? "",
4896
+ onChange: (event) => setCustomFeeRate?.(event.target.value.replace(/[^\d.]/g, "")),
4897
+ className: "w-full rounded-xl bg-card px-4 py-3 text-sm text-white shadow-inner transition-all focus:outline focus:outline-2 focus:outline-primary/50"
4898
+ }
4899
+ ),
4900
+ typeof estimatedFee === "number" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("p", { className: "ml-1 text-xs text-muted-foreground", children: [
4901
+ "Using ",
4902
+ effectiveFeeRateSatPerVb,
4903
+ " sat/vB \xB7 ~",
4904
+ estimatedFee.toLocaleString(),
4905
+ " ",
4906
+ "sats est. fee"
4907
+ ] })
4908
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "grid grid-cols-3 gap-3", children: ["slow", "normal", "fast"].map((rate) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
4850
4909
  "button",
4851
4910
  {
4852
4911
  type: "button",
@@ -7208,7 +7267,10 @@ var NETWORK_CONFIG = {
7208
7267
  border: "border-network-bitcoin/40",
7209
7268
  qrBorder: "border-network-bitcoin/30",
7210
7269
  qrGlow: qrGlowStyle(colors.network.bitcoin),
7211
- icon: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "material-symbols-outlined text-icon-xs leading-none", children: "currency_bitcoin" })
7270
+ // On-chain uses a chain-link glyph rather than the coin the coin reads
7271
+ // as "the BTC asset", whereas this row is specifically the *on-chain* (L1)
7272
+ // receive rail alongside Lightning/Spark/Arkade, so a chain mark disambiguates.
7273
+ icon: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "material-symbols-outlined text-icon-xs leading-none", children: "link" })
7212
7274
  },
7213
7275
  lightning: {
7214
7276
  label: "Lightning",
@@ -886,10 +886,23 @@ interface WithdrawAmountInputProps {
886
886
  normal: number;
887
887
  fast: number;
888
888
  };
889
+ /**
890
+ * Optional custom fee-rate mode. When `setFeeRateMode` is provided the fee
891
+ * selector gains a fourth "Custom" option with a sat/vB input; otherwise it
892
+ * renders the plain slow/normal/fast presets (backward compatible).
893
+ */
894
+ feeRateMode?: 'slow' | 'normal' | 'fast' | 'custom';
895
+ setFeeRateMode?: (mode: 'slow' | 'normal' | 'fast' | 'custom') => void;
896
+ customFeeRate?: string;
897
+ setCustomFeeRate?: (value: string) => void;
898
+ /** Resolved sat/vB actually used (preset or custom), for the estimate line. */
899
+ effectiveFeeRateSatPerVb?: number;
900
+ /** Estimated total fee in sats, for the estimate line. */
901
+ estimatedFee?: number;
889
902
  donation: boolean;
890
903
  setDonation: (value: boolean) => void;
891
904
  }
892
- declare function WithdrawAmountInput({ addressType, amount, handleAmountChange, handleSetMax, selectedAssetId, selectedAssetTicker, formattedBalance, decodedLnInvoice, decodedRgbInvoice, lnurlPayData, witnessAmountSat, setWitnessAmountSat, feeRate, setFeeRate, feeRates, donation, setDonation, }: WithdrawAmountInputProps): react_jsx_runtime.JSX.Element;
905
+ declare function WithdrawAmountInput({ addressType, amount, handleAmountChange, handleSetMax, selectedAssetId, selectedAssetTicker, formattedBalance, decodedLnInvoice, decodedRgbInvoice, lnurlPayData, witnessAmountSat, setWitnessAmountSat, feeRate, setFeeRate, feeRates, feeRateMode, setFeeRateMode, customFeeRate, setCustomFeeRate, effectiveFeeRateSatPerVb, estimatedFee, donation, setDonation, }: WithdrawAmountInputProps): react_jsx_runtime.JSX.Element;
893
906
 
894
907
  interface WithdrawInvoiceAsset {
895
908
  asset_id: string;
@@ -886,10 +886,23 @@ interface WithdrawAmountInputProps {
886
886
  normal: number;
887
887
  fast: number;
888
888
  };
889
+ /**
890
+ * Optional custom fee-rate mode. When `setFeeRateMode` is provided the fee
891
+ * selector gains a fourth "Custom" option with a sat/vB input; otherwise it
892
+ * renders the plain slow/normal/fast presets (backward compatible).
893
+ */
894
+ feeRateMode?: 'slow' | 'normal' | 'fast' | 'custom';
895
+ setFeeRateMode?: (mode: 'slow' | 'normal' | 'fast' | 'custom') => void;
896
+ customFeeRate?: string;
897
+ setCustomFeeRate?: (value: string) => void;
898
+ /** Resolved sat/vB actually used (preset or custom), for the estimate line. */
899
+ effectiveFeeRateSatPerVb?: number;
900
+ /** Estimated total fee in sats, for the estimate line. */
901
+ estimatedFee?: number;
889
902
  donation: boolean;
890
903
  setDonation: (value: boolean) => void;
891
904
  }
892
- declare function WithdrawAmountInput({ addressType, amount, handleAmountChange, handleSetMax, selectedAssetId, selectedAssetTicker, formattedBalance, decodedLnInvoice, decodedRgbInvoice, lnurlPayData, witnessAmountSat, setWitnessAmountSat, feeRate, setFeeRate, feeRates, donation, setDonation, }: WithdrawAmountInputProps): react_jsx_runtime.JSX.Element;
905
+ declare function WithdrawAmountInput({ addressType, amount, handleAmountChange, handleSetMax, selectedAssetId, selectedAssetTicker, formattedBalance, decodedLnInvoice, decodedRgbInvoice, lnurlPayData, witnessAmountSat, setWitnessAmountSat, feeRate, setFeeRate, feeRates, feeRateMode, setFeeRateMode, customFeeRate, setCustomFeeRate, effectiveFeeRateSatPerVb, estimatedFee, donation, setDonation, }: WithdrawAmountInputProps): react_jsx_runtime.JSX.Element;
893
906
 
894
907
  interface WithdrawInvoiceAsset {
895
908
  asset_id: string;
package/dist/web/index.js CHANGED
@@ -4587,9 +4587,17 @@ function WithdrawAmountInput({
4587
4587
  feeRate,
4588
4588
  setFeeRate,
4589
4589
  feeRates,
4590
+ feeRateMode,
4591
+ setFeeRateMode,
4592
+ customFeeRate,
4593
+ setCustomFeeRate,
4594
+ effectiveFeeRateSatPerVb,
4595
+ estimatedFee,
4590
4596
  donation,
4591
4597
  setDonation
4592
4598
  }) {
4599
+ const customFeeEnabled = typeof setFeeRateMode === "function";
4600
+ const activeFeeMode = feeRateMode ?? feeRate;
4593
4601
  const unitLabel = selectedAssetId === "BTC" ? "sats" : selectedAssetTicker ?? "units";
4594
4602
  const showAmountInput = addressType === "bitcoin" || addressType === "spark" || addressType === "arkade" || addressType === "lightning-address" || addressType === "lnurl-pay" || addressType === "rgb" && !decodedRgbInvoice?.assignment?.value || addressType === "lightning" && !decodedLnInvoice?.amount && !decodedLnInvoice?.asset_amount;
4595
4603
  const enteredNum = parseFloat(amount.replace(/[^\d.-]/g, "") || "0") || 0;
@@ -4668,7 +4676,58 @@ function WithdrawAmountInput({
4668
4676
  ] }),
4669
4677
  (addressType === "bitcoin" || addressType === "rgb") && /* @__PURE__ */ jsxs33("div", { className: "space-y-2", children: [
4670
4678
  /* @__PURE__ */ jsx46("label", { className: "ml-1 text-xs font-bold uppercase tracking-wider text-muted-foreground", children: "Fee Rate" }),
4671
- /* @__PURE__ */ jsx46("div", { className: "grid grid-cols-3 gap-3", children: ["slow", "normal", "fast"].map((rate) => /* @__PURE__ */ jsxs33(
4679
+ customFeeEnabled ? /* @__PURE__ */ jsxs33(Fragment9, { children: [
4680
+ /* @__PURE__ */ jsx46("div", { className: "grid grid-cols-4 gap-2", children: ["slow", "normal", "fast", "custom"].map((mode) => {
4681
+ const selected = activeFeeMode === mode;
4682
+ return /* @__PURE__ */ jsxs33(
4683
+ "button",
4684
+ {
4685
+ type: "button",
4686
+ onClick: () => {
4687
+ setFeeRateMode?.(mode);
4688
+ if (mode !== "custom") setFeeRate(mode);
4689
+ },
4690
+ className: `group relative overflow-hidden rounded-xl border px-2 py-3 shadow-sm transition-all active:scale-[0.98] ${selected ? "border-primary/40 bg-primary/10" : "border-border bg-card/40 hover:border-primary/40"}`,
4691
+ children: [
4692
+ /* @__PURE__ */ jsx46(
4693
+ "span",
4694
+ {
4695
+ className: `block text-xs font-bold capitalize ${selected ? "text-primary" : "text-muted-foreground group-hover:text-primary"}`,
4696
+ children: mode
4697
+ }
4698
+ ),
4699
+ /* @__PURE__ */ jsx46(
4700
+ "span",
4701
+ {
4702
+ className: `mt-0.5 block text-xxs font-medium ${selected ? "text-primary/70" : "text-white/40 group-hover:text-white/70"}`,
4703
+ children: mode === "custom" ? "sat/vB" : `${feeRates[mode]} sat/vB`
4704
+ }
4705
+ )
4706
+ ]
4707
+ },
4708
+ mode
4709
+ );
4710
+ }) }),
4711
+ activeFeeMode === "custom" && /* @__PURE__ */ jsx46(
4712
+ "input",
4713
+ {
4714
+ type: "text",
4715
+ inputMode: "decimal",
4716
+ placeholder: `${feeRates[feeRate]} (${feeRate})`,
4717
+ value: customFeeRate ?? "",
4718
+ onChange: (event) => setCustomFeeRate?.(event.target.value.replace(/[^\d.]/g, "")),
4719
+ className: "w-full rounded-xl bg-card px-4 py-3 text-sm text-white shadow-inner transition-all focus:outline focus:outline-2 focus:outline-primary/50"
4720
+ }
4721
+ ),
4722
+ typeof estimatedFee === "number" && /* @__PURE__ */ jsxs33("p", { className: "ml-1 text-xs text-muted-foreground", children: [
4723
+ "Using ",
4724
+ effectiveFeeRateSatPerVb,
4725
+ " sat/vB \xB7 ~",
4726
+ estimatedFee.toLocaleString(),
4727
+ " ",
4728
+ "sats est. fee"
4729
+ ] })
4730
+ ] }) : /* @__PURE__ */ jsx46("div", { className: "grid grid-cols-3 gap-3", children: ["slow", "normal", "fast"].map((rate) => /* @__PURE__ */ jsxs33(
4672
4731
  "button",
4673
4732
  {
4674
4733
  type: "button",
@@ -7030,7 +7089,10 @@ var NETWORK_CONFIG = {
7030
7089
  border: "border-network-bitcoin/40",
7031
7090
  qrBorder: "border-network-bitcoin/30",
7032
7091
  qrGlow: qrGlowStyle(colors.network.bitcoin),
7033
- icon: /* @__PURE__ */ jsx73("span", { className: "material-symbols-outlined text-icon-xs leading-none", children: "currency_bitcoin" })
7092
+ // On-chain uses a chain-link glyph rather than the coin the coin reads
7093
+ // as "the BTC asset", whereas this row is specifically the *on-chain* (L1)
7094
+ // receive rail alongside Lightning/Spark/Arkade, so a chain mark disambiguates.
7095
+ icon: /* @__PURE__ */ jsx73("span", { className: "material-symbols-outlined text-icon-xs leading-none", children: "link" })
7034
7096
  },
7035
7097
  lightning: {
7036
7098
  label: "Lightning",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaleido-ui",
3
- "version": "0.1.74",
3
+ "version": "0.1.76",
4
4
  "description": "KaleidoSwap shared UI library — design tokens, web components (Tailwind + Radix), and React Native components extending WDK UI Kit",
5
5
  "license": "MIT",
6
6
  "type": "module",