kaleido-ui 0.1.11 → 0.1.13

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.
@@ -4137,28 +4137,34 @@ function RouteChoiceCard({
4137
4137
  recommended,
4138
4138
  onClick
4139
4139
  }) {
4140
+ const { disabled = false, disabledReason } = route;
4140
4141
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
4141
4142
  "button",
4142
4143
  {
4143
4144
  type: "button",
4144
4145
  "data-testid": `withdraw-route-${route.account.toLowerCase()}`,
4145
4146
  onClick,
4147
+ disabled,
4148
+ "aria-disabled": disabled,
4149
+ title: disabled ? disabledReason : void 0,
4146
4150
  className: cn(
4147
4151
  "w-full rounded-2xl border p-4 text-left transition-all",
4148
- selected ? "border-primary/30 bg-primary/10" : "border-border bg-white/4 hover:border-white/20 hover:bg-white/6"
4152
+ disabled ? "cursor-not-allowed border-danger/15 bg-danger/5 opacity-60" : selected ? "border-primary/30 bg-primary/10" : "border-border bg-white/4 hover:border-white/20 hover:bg-white/6"
4149
4153
  ),
4150
4154
  children: [
4151
4155
  /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
4152
4156
  /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
4153
4157
  /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-center gap-2", children: [
4154
4158
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "text-sm font-bold text-white", children: route.accountTitle }),
4155
- recommended && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "rounded-full border border-primary/20 bg-primary/10 px-2 py-0.5 text-xxs font-bold uppercase tracking-wider text-primary", children: "Recommended" })
4159
+ recommended && !disabled && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "rounded-full border border-primary/20 bg-primary/10 px-2 py-0.5 text-xxs font-bold uppercase tracking-wider text-primary", children: "Recommended" }),
4160
+ disabled && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "rounded-full border border-danger/20 bg-danger/10 px-2 py-0.5 text-xxs font-bold uppercase tracking-wider text-danger", children: "Insufficient" })
4156
4161
  ] }),
4157
4162
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "mt-1 text-xs text-white/45", children: route.methodLabel })
4158
4163
  ] }),
4159
4164
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "text-xxs font-bold uppercase tracking-wider text-white/35", children: route.feeHint })
4160
4165
  ] }),
4161
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "mt-3 text-xs leading-relaxed text-muted-foreground", children: route.summary })
4166
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "mt-3 text-xs leading-relaxed text-muted-foreground", children: route.summary }),
4167
+ disabled && disabledReason && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "mt-2 text-xxs leading-relaxed text-danger/80", children: disabledReason })
4162
4168
  ]
4163
4169
  }
4164
4170
  );
@@ -5402,7 +5408,9 @@ function DepositPreGeneration({
5402
5408
  amount,
5403
5409
  handleAmountChange,
5404
5410
  getUnitLabel,
5405
- generateInvoice
5411
+ generateInvoice,
5412
+ needsColorableUtxos = false,
5413
+ onOpenCreateUtxos
5406
5414
  }) {
5407
5415
  const method = METHOD_META2[currentMethod];
5408
5416
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "space-y-3", children: [
@@ -5507,13 +5515,20 @@ function DepositPreGeneration({
5507
5515
  }
5508
5516
  )
5509
5517
  ] }),
5510
- !isAutoGenerate && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Button, { variant: "cta", size: "cta", onClick: generateInvoice, disabled: loading, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [
5518
+ needsColorableUtxos && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(AlertBanner, { variant: "warning", children: [
5519
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "mb-0.5 text-xs font-bold text-warning", children: "Colorable UTXOs Required" }),
5520
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "text-tiny text-warning/70", children: "To receive RGB assets on-chain you need at least one uncolored UTXO. Create some now and the invoice will be generated automatically." })
5521
+ ] }),
5522
+ !isAutoGenerate && (needsColorableUtxos && onOpenCreateUtxos ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Button, { variant: "cta", size: "cta", onClick: onOpenCreateUtxos, disabled: loading, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [
5523
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "material-symbols-outlined text-icon-md", children: "add_circle" }),
5524
+ "Create Colorable UTXOs"
5525
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Button, { variant: "cta", size: "cta", onClick: generateInvoice, disabled: loading, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [
5511
5526
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "material-symbols-outlined animate-spin text-icon-md", children: "progress_activity" }),
5512
5527
  "Generating..."
5513
5528
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [
5514
5529
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "material-symbols-outlined text-icon-md", children: "qr_code_2" }),
5515
5530
  "Generate Address"
5516
- ] }) })
5531
+ ] }) }))
5517
5532
  ] });
5518
5533
  }
5519
5534
 
@@ -5893,7 +5908,9 @@ function DepositInvoiceGeneration({
5893
5908
  arkSubMode,
5894
5909
  setArkSubMode,
5895
5910
  btcSelectedAccount,
5896
- gen
5911
+ gen,
5912
+ needsColorableUtxos,
5913
+ onOpenCreateUtxos
5897
5914
  }) {
5898
5915
  const {
5899
5916
  amount,
@@ -6114,7 +6131,9 @@ function DepositInvoiceGeneration({
6114
6131
  amount,
6115
6132
  handleAmountChange,
6116
6133
  getUnitLabel,
6117
- generateInvoice
6134
+ generateInvoice,
6135
+ needsColorableUtxos,
6136
+ onOpenCreateUtxos
6118
6137
  }
6119
6138
  ) : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
6120
6139
  DepositGeneratedView,
@@ -804,6 +804,10 @@ interface WithdrawRouteOption<TAccount extends string = string> {
804
804
  accountTitle: string;
805
805
  methodLabel: string;
806
806
  feeHint: string;
807
+ /** When true, the route is unavailable (e.g. insufficient liquidity) and not clickable. */
808
+ disabled?: boolean;
809
+ /** Short reason shown under the disabled card. Pair with `disabled`. */
810
+ disabledReason?: string;
807
811
  }
808
812
  interface WithdrawRouteSummary {
809
813
  method: string;
@@ -1163,8 +1167,15 @@ interface DepositPreGenerationProps {
1163
1167
  handleAmountChange: (event: ChangeEvent<HTMLInputElement>) => void;
1164
1168
  getUnitLabel: () => string;
1165
1169
  generateInvoice: () => Promise<void>;
1170
+ /**
1171
+ * RGB on-chain only: true when the user needs to create at least one
1172
+ * uncolored UTXO before an invoice can be generated.
1173
+ */
1174
+ needsColorableUtxos?: boolean;
1175
+ /** Invoked by the inline "Create Colorable UTXOs" CTA. */
1176
+ onOpenCreateUtxos?: () => void;
1166
1177
  }
1167
- declare function DepositPreGeneration({ selectedAsset, isBtc, network, net, selectedAccount, currentMethod, channelsLoading, showChannelWarning, showLiquidityWarning, isAutoGenerate, loading, usePrivacy, setUsePrivacy, amount, handleAmountChange, getUnitLabel, generateInvoice, }: DepositPreGenerationProps): react_jsx_runtime.JSX.Element;
1178
+ declare function DepositPreGeneration({ selectedAsset, isBtc, network, net, selectedAccount, currentMethod, channelsLoading, showChannelWarning, showLiquidityWarning, isAutoGenerate, loading, usePrivacy, setUsePrivacy, amount, handleAmountChange, getUnitLabel, generateInvoice, needsColorableUtxos, onOpenCreateUtxos, }: DepositPreGenerationProps): react_jsx_runtime.JSX.Element;
1168
1179
 
1169
1180
  interface DepositSelectionAsset {
1170
1181
  asset_id: string;
@@ -1246,8 +1257,15 @@ interface DepositInvoiceGenerationProps {
1246
1257
  setArkSubMode: (mode: 'ark' | 'boarding') => void;
1247
1258
  btcSelectedAccount: DepositAccountId;
1248
1259
  gen: DepositGenerationController;
1260
+ /**
1261
+ * RGB on-chain only: when true, the pre-generation step shows a warning
1262
+ * banner and swaps the Generate CTA for "Create Colorable UTXOs". Wire
1263
+ * `onOpenCreateUtxos` to open your own RGB UTXO creation modal.
1264
+ */
1265
+ needsColorableUtxos?: boolean;
1266
+ onOpenCreateUtxos?: () => void;
1249
1267
  }
1250
- declare function DepositInvoiceGeneration({ handleBack, handleDone, selectedAsset, selectedAssetId, isNewAsset, channelsLoading, channels, network, setNetwork, isLightningAvailable, isRgbConnected, isSparkConnected, isArkadeConnected, isSparkLightning, maxDepositAmount, usePrivacy, setUsePrivacy, walletChoice, setWalletChoice, arkSubMode, setArkSubMode, btcSelectedAccount, gen, }: DepositInvoiceGenerationProps): react_jsx_runtime.JSX.Element;
1268
+ declare function DepositInvoiceGeneration({ handleBack, handleDone, selectedAsset, selectedAssetId, isNewAsset, channelsLoading, channels, network, setNetwork, isLightningAvailable, isRgbConnected, isSparkConnected, isArkadeConnected, isSparkLightning, maxDepositAmount, usePrivacy, setUsePrivacy, walletChoice, setWalletChoice, arkSubMode, setArkSubMode, btcSelectedAccount, gen, needsColorableUtxos, onOpenCreateUtxos, }: DepositInvoiceGenerationProps): react_jsx_runtime.JSX.Element;
1251
1269
 
1252
1270
  type ToasterToast = ToastProps & {
1253
1271
  id: string;
@@ -804,6 +804,10 @@ interface WithdrawRouteOption<TAccount extends string = string> {
804
804
  accountTitle: string;
805
805
  methodLabel: string;
806
806
  feeHint: string;
807
+ /** When true, the route is unavailable (e.g. insufficient liquidity) and not clickable. */
808
+ disabled?: boolean;
809
+ /** Short reason shown under the disabled card. Pair with `disabled`. */
810
+ disabledReason?: string;
807
811
  }
808
812
  interface WithdrawRouteSummary {
809
813
  method: string;
@@ -1163,8 +1167,15 @@ interface DepositPreGenerationProps {
1163
1167
  handleAmountChange: (event: ChangeEvent<HTMLInputElement>) => void;
1164
1168
  getUnitLabel: () => string;
1165
1169
  generateInvoice: () => Promise<void>;
1170
+ /**
1171
+ * RGB on-chain only: true when the user needs to create at least one
1172
+ * uncolored UTXO before an invoice can be generated.
1173
+ */
1174
+ needsColorableUtxos?: boolean;
1175
+ /** Invoked by the inline "Create Colorable UTXOs" CTA. */
1176
+ onOpenCreateUtxos?: () => void;
1166
1177
  }
1167
- declare function DepositPreGeneration({ selectedAsset, isBtc, network, net, selectedAccount, currentMethod, channelsLoading, showChannelWarning, showLiquidityWarning, isAutoGenerate, loading, usePrivacy, setUsePrivacy, amount, handleAmountChange, getUnitLabel, generateInvoice, }: DepositPreGenerationProps): react_jsx_runtime.JSX.Element;
1178
+ declare function DepositPreGeneration({ selectedAsset, isBtc, network, net, selectedAccount, currentMethod, channelsLoading, showChannelWarning, showLiquidityWarning, isAutoGenerate, loading, usePrivacy, setUsePrivacy, amount, handleAmountChange, getUnitLabel, generateInvoice, needsColorableUtxos, onOpenCreateUtxos, }: DepositPreGenerationProps): react_jsx_runtime.JSX.Element;
1168
1179
 
1169
1180
  interface DepositSelectionAsset {
1170
1181
  asset_id: string;
@@ -1246,8 +1257,15 @@ interface DepositInvoiceGenerationProps {
1246
1257
  setArkSubMode: (mode: 'ark' | 'boarding') => void;
1247
1258
  btcSelectedAccount: DepositAccountId;
1248
1259
  gen: DepositGenerationController;
1260
+ /**
1261
+ * RGB on-chain only: when true, the pre-generation step shows a warning
1262
+ * banner and swaps the Generate CTA for "Create Colorable UTXOs". Wire
1263
+ * `onOpenCreateUtxos` to open your own RGB UTXO creation modal.
1264
+ */
1265
+ needsColorableUtxos?: boolean;
1266
+ onOpenCreateUtxos?: () => void;
1249
1267
  }
1250
- declare function DepositInvoiceGeneration({ handleBack, handleDone, selectedAsset, selectedAssetId, isNewAsset, channelsLoading, channels, network, setNetwork, isLightningAvailable, isRgbConnected, isSparkConnected, isArkadeConnected, isSparkLightning, maxDepositAmount, usePrivacy, setUsePrivacy, walletChoice, setWalletChoice, arkSubMode, setArkSubMode, btcSelectedAccount, gen, }: DepositInvoiceGenerationProps): react_jsx_runtime.JSX.Element;
1268
+ declare function DepositInvoiceGeneration({ handleBack, handleDone, selectedAsset, selectedAssetId, isNewAsset, channelsLoading, channels, network, setNetwork, isLightningAvailable, isRgbConnected, isSparkConnected, isArkadeConnected, isSparkLightning, maxDepositAmount, usePrivacy, setUsePrivacy, walletChoice, setWalletChoice, arkSubMode, setArkSubMode, btcSelectedAccount, gen, needsColorableUtxos, onOpenCreateUtxos, }: DepositInvoiceGenerationProps): react_jsx_runtime.JSX.Element;
1251
1269
 
1252
1270
  type ToasterToast = ToastProps & {
1253
1271
  id: string;
package/dist/web/index.js CHANGED
@@ -3982,28 +3982,34 @@ function RouteChoiceCard({
3982
3982
  recommended,
3983
3983
  onClick
3984
3984
  }) {
3985
+ const { disabled = false, disabledReason } = route;
3985
3986
  return /* @__PURE__ */ jsxs33(
3986
3987
  "button",
3987
3988
  {
3988
3989
  type: "button",
3989
3990
  "data-testid": `withdraw-route-${route.account.toLowerCase()}`,
3990
3991
  onClick,
3992
+ disabled,
3993
+ "aria-disabled": disabled,
3994
+ title: disabled ? disabledReason : void 0,
3991
3995
  className: cn(
3992
3996
  "w-full rounded-2xl border p-4 text-left transition-all",
3993
- selected ? "border-primary/30 bg-primary/10" : "border-border bg-white/4 hover:border-white/20 hover:bg-white/6"
3997
+ disabled ? "cursor-not-allowed border-danger/15 bg-danger/5 opacity-60" : selected ? "border-primary/30 bg-primary/10" : "border-border bg-white/4 hover:border-white/20 hover:bg-white/6"
3994
3998
  ),
3995
3999
  children: [
3996
4000
  /* @__PURE__ */ jsxs33("div", { className: "flex items-start justify-between gap-3", children: [
3997
4001
  /* @__PURE__ */ jsxs33("div", { children: [
3998
4002
  /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2", children: [
3999
4003
  /* @__PURE__ */ jsx45("span", { className: "text-sm font-bold text-white", children: route.accountTitle }),
4000
- recommended && /* @__PURE__ */ jsx45("span", { className: "rounded-full border border-primary/20 bg-primary/10 px-2 py-0.5 text-xxs font-bold uppercase tracking-wider text-primary", children: "Recommended" })
4004
+ recommended && !disabled && /* @__PURE__ */ jsx45("span", { className: "rounded-full border border-primary/20 bg-primary/10 px-2 py-0.5 text-xxs font-bold uppercase tracking-wider text-primary", children: "Recommended" }),
4005
+ disabled && /* @__PURE__ */ jsx45("span", { className: "rounded-full border border-danger/20 bg-danger/10 px-2 py-0.5 text-xxs font-bold uppercase tracking-wider text-danger", children: "Insufficient" })
4001
4006
  ] }),
4002
4007
  /* @__PURE__ */ jsx45("p", { className: "mt-1 text-xs text-white/45", children: route.methodLabel })
4003
4008
  ] }),
4004
4009
  /* @__PURE__ */ jsx45("span", { className: "text-xxs font-bold uppercase tracking-wider text-white/35", children: route.feeHint })
4005
4010
  ] }),
4006
- /* @__PURE__ */ jsx45("p", { className: "mt-3 text-xs leading-relaxed text-muted-foreground", children: route.summary })
4011
+ /* @__PURE__ */ jsx45("p", { className: "mt-3 text-xs leading-relaxed text-muted-foreground", children: route.summary }),
4012
+ disabled && disabledReason && /* @__PURE__ */ jsx45("p", { className: "mt-2 text-xxs leading-relaxed text-danger/80", children: disabledReason })
4007
4013
  ]
4008
4014
  }
4009
4015
  );
@@ -5247,7 +5253,9 @@ function DepositPreGeneration({
5247
5253
  amount,
5248
5254
  handleAmountChange,
5249
5255
  getUnitLabel,
5250
- generateInvoice
5256
+ generateInvoice,
5257
+ needsColorableUtxos = false,
5258
+ onOpenCreateUtxos
5251
5259
  }) {
5252
5260
  const method = METHOD_META2[currentMethod];
5253
5261
  return /* @__PURE__ */ jsxs44("div", { className: "space-y-3", children: [
@@ -5352,13 +5360,20 @@ function DepositPreGeneration({
5352
5360
  }
5353
5361
  )
5354
5362
  ] }),
5355
- !isAutoGenerate && /* @__PURE__ */ jsx57(Button, { variant: "cta", size: "cta", onClick: generateInvoice, disabled: loading, children: loading ? /* @__PURE__ */ jsxs44("span", { className: "flex items-center justify-center gap-2", children: [
5363
+ needsColorableUtxos && /* @__PURE__ */ jsxs44(AlertBanner, { variant: "warning", children: [
5364
+ /* @__PURE__ */ jsx57("p", { className: "mb-0.5 text-xs font-bold text-warning", children: "Colorable UTXOs Required" }),
5365
+ /* @__PURE__ */ jsx57("p", { className: "text-tiny text-warning/70", children: "To receive RGB assets on-chain you need at least one uncolored UTXO. Create some now and the invoice will be generated automatically." })
5366
+ ] }),
5367
+ !isAutoGenerate && (needsColorableUtxos && onOpenCreateUtxos ? /* @__PURE__ */ jsx57(Button, { variant: "cta", size: "cta", onClick: onOpenCreateUtxos, disabled: loading, children: /* @__PURE__ */ jsxs44("span", { className: "flex items-center justify-center gap-2", children: [
5368
+ /* @__PURE__ */ jsx57("span", { className: "material-symbols-outlined text-icon-md", children: "add_circle" }),
5369
+ "Create Colorable UTXOs"
5370
+ ] }) }) : /* @__PURE__ */ jsx57(Button, { variant: "cta", size: "cta", onClick: generateInvoice, disabled: loading, children: loading ? /* @__PURE__ */ jsxs44("span", { className: "flex items-center justify-center gap-2", children: [
5356
5371
  /* @__PURE__ */ jsx57("span", { className: "material-symbols-outlined animate-spin text-icon-md", children: "progress_activity" }),
5357
5372
  "Generating..."
5358
5373
  ] }) : /* @__PURE__ */ jsxs44("span", { className: "flex items-center justify-center gap-2", children: [
5359
5374
  /* @__PURE__ */ jsx57("span", { className: "material-symbols-outlined text-icon-md", children: "qr_code_2" }),
5360
5375
  "Generate Address"
5361
- ] }) })
5376
+ ] }) }))
5362
5377
  ] });
5363
5378
  }
5364
5379
 
@@ -5738,7 +5753,9 @@ function DepositInvoiceGeneration({
5738
5753
  arkSubMode,
5739
5754
  setArkSubMode,
5740
5755
  btcSelectedAccount,
5741
- gen
5756
+ gen,
5757
+ needsColorableUtxos,
5758
+ onOpenCreateUtxos
5742
5759
  }) {
5743
5760
  const {
5744
5761
  amount,
@@ -5959,7 +5976,9 @@ function DepositInvoiceGeneration({
5959
5976
  amount,
5960
5977
  handleAmountChange,
5961
5978
  getUnitLabel,
5962
- generateInvoice
5979
+ generateInvoice,
5980
+ needsColorableUtxos,
5981
+ onOpenCreateUtxos
5963
5982
  }
5964
5983
  ) : /* @__PURE__ */ jsx59(
5965
5984
  DepositGeneratedView,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaleido-ui",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
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",