myoperator-ui 0.0.161 → 0.0.162
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.js +24 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8498,6 +8498,8 @@ export const WalletTopup = React.forwardRef<HTMLDivElement, WalletTopupProps>(
|
|
|
8498
8498
|
voucherLinkText = "Have an offline code or voucher?",
|
|
8499
8499
|
voucherIcon = <Ticket className="size-4" />,
|
|
8500
8500
|
onVoucherClick,
|
|
8501
|
+
showVoucherInput: controlledShowVoucherInput,
|
|
8502
|
+
onShowVoucherInputChange,
|
|
8501
8503
|
voucherCode: controlledVoucherCode,
|
|
8502
8504
|
onVoucherCodeChange,
|
|
8503
8505
|
voucherCodePlaceholder = "XXXX-XXXX-XXXX",
|
|
@@ -8530,8 +8532,15 @@ export const WalletTopup = React.forwardRef<HTMLDivElement, WalletTopupProps>(
|
|
|
8530
8532
|
? controlledCustomAmount
|
|
8531
8533
|
: internalCustom;
|
|
8532
8534
|
|
|
8535
|
+
// Voucher input visibility (controlled/uncontrolled)
|
|
8536
|
+
const isVoucherInputControlled = controlledShowVoucherInput !== undefined;
|
|
8537
|
+
const [internalShowVoucherInput, setInternalShowVoucherInput] =
|
|
8538
|
+
React.useState(false);
|
|
8539
|
+
const showVoucherInput = isVoucherInputControlled
|
|
8540
|
+
? controlledShowVoucherInput
|
|
8541
|
+
: internalShowVoucherInput;
|
|
8542
|
+
|
|
8533
8543
|
// Voucher code input state
|
|
8534
|
-
const [showVoucherInput, setShowVoucherInput] = React.useState(false);
|
|
8535
8544
|
const isVoucherCodeControlled = controlledVoucherCode !== undefined;
|
|
8536
8545
|
const [internalVoucherCode, setInternalVoucherCode] = React.useState("");
|
|
8537
8546
|
const voucherCodeValue = isVoucherCodeControlled
|
|
@@ -8539,12 +8548,18 @@ export const WalletTopup = React.forwardRef<HTMLDivElement, WalletTopupProps>(
|
|
|
8539
8548
|
: internalVoucherCode;
|
|
8540
8549
|
|
|
8541
8550
|
const handleVoucherLinkClick = () => {
|
|
8542
|
-
|
|
8551
|
+
if (!isVoucherInputControlled) {
|
|
8552
|
+
setInternalShowVoucherInput(true);
|
|
8553
|
+
}
|
|
8554
|
+
onShowVoucherInputChange?.(true);
|
|
8543
8555
|
onVoucherClick?.();
|
|
8544
8556
|
};
|
|
8545
8557
|
|
|
8546
8558
|
const handleVoucherCancel = () => {
|
|
8547
|
-
|
|
8559
|
+
if (!isVoucherInputControlled) {
|
|
8560
|
+
setInternalShowVoucherInput(false);
|
|
8561
|
+
}
|
|
8562
|
+
onShowVoucherInputChange?.(false);
|
|
8548
8563
|
if (!isVoucherCodeControlled) {
|
|
8549
8564
|
setInternalVoucherCode("");
|
|
8550
8565
|
}
|
|
@@ -8827,6 +8842,12 @@ export interface WalletTopupProps {
|
|
|
8827
8842
|
/** Callback when voucher link is clicked (also toggles inline code input) */
|
|
8828
8843
|
onVoucherClick?: () => void;
|
|
8829
8844
|
|
|
8845
|
+
// Voucher input visibility
|
|
8846
|
+
/** Whether the voucher input is visible (controlled). When provided, the component won't toggle visibility internally. */
|
|
8847
|
+
showVoucherInput?: boolean;
|
|
8848
|
+
/** Callback when voucher input visibility changes (from link click or cancel) */
|
|
8849
|
+
onShowVoucherInputChange?: (show: boolean) => void;
|
|
8850
|
+
|
|
8830
8851
|
// Voucher code input
|
|
8831
8852
|
/** Voucher code value (controlled) */
|
|
8832
8853
|
voucherCode?: string;
|