@veevarts/design-system 1.12.5 → 1.12.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 +36 -11
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4946 -3779
- package/dist/patterns/CashTenderForm/CashTenderForm.d.ts +4 -0
- package/dist/patterns/CashTenderForm/__test__/CashTenderForm.test.d.ts +4 -0
- package/dist/patterns/CashTenderForm/index.d.ts +9 -0
- package/dist/patterns/CashTenderForm/types.d.ts +85 -0
- package/dist/patterns/CheckTenderForm/CheckTenderForm.d.ts +4 -0
- package/dist/patterns/CheckTenderForm/__test__/CheckTenderForm.test.d.ts +4 -0
- package/dist/patterns/CheckTenderForm/index.d.ts +9 -0
- package/dist/patterns/CheckTenderForm/types.d.ts +52 -0
- package/dist/patterns/ConfirmDialog/ConfirmDialog.d.ts +21 -0
- package/dist/patterns/ConfirmDialog/index.d.ts +2 -0
- package/dist/patterns/LoadingOverlay/LoadingOverlay.d.ts +18 -0
- package/dist/patterns/LoadingOverlay/index.d.ts +2 -0
- package/dist/patterns/ModalShell/ModalShell.d.ts +40 -0
- package/dist/patterns/ModalShell/index.d.ts +2 -0
- package/dist/patterns/OtherTenderForm/OtherTenderForm.d.ts +4 -0
- package/dist/patterns/OtherTenderForm/__test__/OtherTenderForm.test.d.ts +4 -0
- package/dist/patterns/OtherTenderForm/index.d.ts +8 -0
- package/dist/patterns/OtherTenderForm/types.d.ts +53 -0
- package/dist/patterns/PaymentCashChangeBanner/PaymentCashChangeBanner.d.ts +35 -0
- package/dist/patterns/PaymentCashChangeBanner/index.d.ts +2 -0
- package/dist/patterns/PaymentSubAmountInput/PaymentSubAmountInput.d.ts +44 -0
- package/dist/patterns/PaymentSubAmountInput/index.d.ts +2 -0
- package/dist/patterns/PaymentSuccessView/PaymentSuccessView.d.ts +30 -0
- package/dist/patterns/PaymentSuccessView/index.d.ts +2 -0
- package/dist/patterns/PaymentTotalBanner/PaymentTotalBanner.d.ts +15 -0
- package/dist/patterns/PaymentTotalBanner/index.d.ts +2 -0
- package/dist/patterns/SplitPaymentSummary/SplitPaymentSummary.d.ts +4 -0
- package/dist/patterns/SplitPaymentSummary/__test__/SplitPaymentSummary.test.d.ts +4 -0
- package/dist/patterns/SplitPaymentSummary/index.d.ts +9 -0
- package/dist/patterns/SplitPaymentSummary/types.d.ts +61 -0
- package/dist/patterns/TileSelect/TileSelect.d.ts +39 -0
- package/dist/patterns/TileSelect/index.d.ts +2 -0
- package/dist/patterns/index.d.ts +24 -0
- package/dist/tailwind/index.d.ts +13 -0
- package/dist/tailwind/index.js +13 -0
- package/dist/tokens/colors.d.ts +13 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/money.d.ts +55 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CashTenderForm Pattern
|
|
3
|
+
*
|
|
4
|
+
* Pure-UI primitive for cash tender entry with change calculation and
|
|
5
|
+
* currency-aware precision. Used by `@veevarts/payments-drop-in`'s
|
|
6
|
+
* `<CashTender>` and any other consumer that needs cash collection UX.
|
|
7
|
+
*/
|
|
8
|
+
export { CashTenderForm } from './CashTenderForm';
|
|
9
|
+
export type { CashTenderFormProps, CashTenderValue, CashTenderLabels, } from './types';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Money } from '../../utils/money';
|
|
2
|
+
export type { Money, CurrencyCode } from '../../utils/money';
|
|
3
|
+
/**
|
|
4
|
+
* Snapshot emitted on every change of the cash tender entry.
|
|
5
|
+
* `isValid` is `true` when `received >= dueAmount.value`.
|
|
6
|
+
*/
|
|
7
|
+
export interface CashTenderValue {
|
|
8
|
+
/** Amount the cashier received from the customer (major units). */
|
|
9
|
+
received: number;
|
|
10
|
+
/** Computed change owed to the customer (`received - due`, rounded). */
|
|
11
|
+
change: number;
|
|
12
|
+
/** Whether the received amount satisfies the due amount. */
|
|
13
|
+
isValid: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Strings the pattern displays. All optional — sensible English defaults exist.
|
|
17
|
+
*/
|
|
18
|
+
export interface CashTenderLabels {
|
|
19
|
+
receivedLabel?: string;
|
|
20
|
+
receivedPlaceholder?: string;
|
|
21
|
+
changeLabel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Template for the change message. `{change}` is replaced with the
|
|
24
|
+
* formatted change amount.
|
|
25
|
+
*/
|
|
26
|
+
changeMessageTemplate?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Validation message shown when received < due.
|
|
29
|
+
* `{due}` is replaced with the formatted due amount.
|
|
30
|
+
*/
|
|
31
|
+
insufficientMessageTemplate?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface CashTenderFormProps {
|
|
34
|
+
/**
|
|
35
|
+
* The amount due. Currency drives input precision (USD 2 dec, JPY 0 dec, etc.).
|
|
36
|
+
*/
|
|
37
|
+
dueAmount: Money;
|
|
38
|
+
/**
|
|
39
|
+
* Controlled received value. Use together with `onChange`.
|
|
40
|
+
*/
|
|
41
|
+
received?: number | null;
|
|
42
|
+
/**
|
|
43
|
+
* Uncontrolled default received value.
|
|
44
|
+
*/
|
|
45
|
+
defaultReceived?: number | null;
|
|
46
|
+
/**
|
|
47
|
+
* Fires on every keystroke with the current snapshot.
|
|
48
|
+
*/
|
|
49
|
+
onChange?: (value: CashTenderValue) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Locale for currency formatting and input mask.
|
|
52
|
+
* @default 'en-US'
|
|
53
|
+
*/
|
|
54
|
+
locale?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Label overrides for i18n.
|
|
57
|
+
*/
|
|
58
|
+
labels?: CashTenderLabels;
|
|
59
|
+
/**
|
|
60
|
+
* Disable interactions (e.g. while submitting).
|
|
61
|
+
*/
|
|
62
|
+
isDisabled?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Auto-focus the Cash Received field when this component mounts.
|
|
65
|
+
* Pair with `key={...}` from the host to re-trigger focus on every
|
|
66
|
+
* sub-payment (the form re-mounts and `autoFocus` fires again).
|
|
67
|
+
* The built-in `onFocus` already selects the value, so a cashier
|
|
68
|
+
* landing here can overwrite the existing amount with a single
|
|
69
|
+
* keystroke.
|
|
70
|
+
*
|
|
71
|
+
* Default `false` — the field is unfocused at mount. Hosts opt in
|
|
72
|
+
* when their flow guarantees the cashier just navigated TO this
|
|
73
|
+
* tender (e.g. selecting Cash from the method picker, advancing to
|
|
74
|
+
* the next split sub-payment).
|
|
75
|
+
*/
|
|
76
|
+
autoFocus?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Inline test id forwarded to the root element.
|
|
79
|
+
*/
|
|
80
|
+
'data-testid'?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Extra className for the root element.
|
|
83
|
+
*/
|
|
84
|
+
className?: string;
|
|
85
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CheckTenderForm Pattern
|
|
3
|
+
*
|
|
4
|
+
* Pure-UI primitive for check tender entry. Used by
|
|
5
|
+
* `@veevarts/payments-drop-in`'s `<CheckTender>` and any other consumer that
|
|
6
|
+
* needs check collection UX.
|
|
7
|
+
*/
|
|
8
|
+
export { CheckTenderForm } from './CheckTenderForm';
|
|
9
|
+
export type { CheckTenderFormProps, CheckTenderValue, CheckTenderLabels, Money } from './types';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Money } from '../../utils/money';
|
|
2
|
+
export type { Money } from '../../utils/money';
|
|
3
|
+
/**
|
|
4
|
+
* Snapshot emitted whenever the form mutates.
|
|
5
|
+
* `isValid` is `true` when `checkNumber` is non-empty.
|
|
6
|
+
*/
|
|
7
|
+
export interface CheckTenderValue {
|
|
8
|
+
/** Amount tendered via this check (matches `dueAmount.value`). */
|
|
9
|
+
amount: number;
|
|
10
|
+
/** Check number as written on the physical check. Required. */
|
|
11
|
+
checkNumber: string;
|
|
12
|
+
/** Optional issuing bank name. */
|
|
13
|
+
bankName?: string;
|
|
14
|
+
/** Optional check date (ISO-8601 yyyy-mm-dd). Defaults to today when the host omits. */
|
|
15
|
+
date?: string;
|
|
16
|
+
isValid: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface CheckTenderLabels {
|
|
19
|
+
checkNumberLabel?: string;
|
|
20
|
+
checkNumberPlaceholder?: string;
|
|
21
|
+
bankNameLabel?: string;
|
|
22
|
+
bankNamePlaceholder?: string;
|
|
23
|
+
dateLabel?: string;
|
|
24
|
+
checkNumberRequiredMessage?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface CheckTenderFormProps {
|
|
27
|
+
dueAmount: Money;
|
|
28
|
+
/** Controlled values. Use together with `onChange`. */
|
|
29
|
+
value?: Partial<Pick<CheckTenderValue, 'checkNumber' | 'bankName' | 'date'>>;
|
|
30
|
+
/** Uncontrolled defaults. */
|
|
31
|
+
defaultValue?: Partial<Pick<CheckTenderValue, 'checkNumber' | 'bankName' | 'date'>>;
|
|
32
|
+
onChange?: (value: CheckTenderValue) => void;
|
|
33
|
+
locale?: string;
|
|
34
|
+
labels?: CheckTenderLabels;
|
|
35
|
+
/** Hide the date picker when the host already collects it elsewhere. */
|
|
36
|
+
hideDate?: boolean;
|
|
37
|
+
/** Hide the bank name field when the host doesn't care. */
|
|
38
|
+
hideBankName?: boolean;
|
|
39
|
+
isDisabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Auto-focus the Check Number field when this component mounts.
|
|
42
|
+
* Pair with `key={...}` from the host to re-trigger focus on every
|
|
43
|
+
* sub-payment (the form re-mounts and `autoFocus` fires again).
|
|
44
|
+
* Default `false` — the field is unfocused at mount. Hosts opt in
|
|
45
|
+
* when their flow guarantees the cashier just navigated TO this
|
|
46
|
+
* tender (e.g. selecting Check from the method picker, advancing
|
|
47
|
+
* to the next split sub-payment).
|
|
48
|
+
*/
|
|
49
|
+
autoFocus?: boolean;
|
|
50
|
+
'data-testid'?: string;
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ConfirmDialogProps {
|
|
3
|
+
/** Whether the dialog is currently open. Controlled by the host. */
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
/** Title rendered as the dialog heading. */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Body copy explaining the consequences of confirming. */
|
|
8
|
+
body: string;
|
|
9
|
+
/** Label for the confirm action. */
|
|
10
|
+
confirmLabel: string;
|
|
11
|
+
/** Visual variant of the confirm button. Default `'danger'`. */
|
|
12
|
+
confirmVariant?: 'danger' | 'primary';
|
|
13
|
+
/** Label for the dismiss action. */
|
|
14
|
+
dismissLabel: string;
|
|
15
|
+
/** Fires when the user confirms. */
|
|
16
|
+
onConfirm: () => void;
|
|
17
|
+
/** Fires when the user dismisses (Cancel button OR Esc / outside click). */
|
|
18
|
+
onDismiss: () => void;
|
|
19
|
+
'data-testid'?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const ConfirmDialog: React.FC<ConfirmDialogProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface LoadingOverlayProps {
|
|
3
|
+
title: string;
|
|
4
|
+
subtitle?: string;
|
|
5
|
+
/** Tint of the backdrop. Default `'white'`. `'transparent'` lets the modal show through. */
|
|
6
|
+
backdrop?: 'white' | 'transparent';
|
|
7
|
+
/**
|
|
8
|
+
* When `true`, the overlay plays its EXIT animation (fade-out) and
|
|
9
|
+
* becomes non-interactive. Host keeps it mounted for the duration of
|
|
10
|
+
* the exit so it can crossfade against the success view rather than
|
|
11
|
+
* snap-unmounting (which produced a visible flash between the
|
|
12
|
+
* loading state and the success view fade-in).
|
|
13
|
+
*/
|
|
14
|
+
exiting?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
'data-testid'?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const LoadingOverlay: React.FC<LoadingOverlayProps>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ModalShellProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/** Adds the visual `relative` positioning context for overlays. Default `true`. */
|
|
5
|
+
relativeOverlayRoot?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Inline style. Primarily used by the host orchestrator to pin
|
|
9
|
+
* the modal height during the loading → success crossfade so the
|
|
10
|
+
* collecting tree's post-success re-render (`hasPartialPayments`
|
|
11
|
+
* flipping `PaymentTotalBanner` → `SplitPaymentSummary`, form
|
|
12
|
+
* re-render with the recorded tender) doesn't visibly grow the
|
|
13
|
+
* modal card underneath the absolute success view. Released once
|
|
14
|
+
* the collecting tree unmounts and the modal settles to its
|
|
15
|
+
* success-view natural height.
|
|
16
|
+
*/
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
'data-testid'?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const ModalShell: React.ForwardRefExoticComponent<ModalShellProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export interface ModalShellHeaderProps {
|
|
22
|
+
/** Title rendered as an `h2`. */
|
|
23
|
+
title: string;
|
|
24
|
+
/** Optional close button — omit `onClose` to hide. */
|
|
25
|
+
onClose?: () => void;
|
|
26
|
+
closeLabel?: string;
|
|
27
|
+
/** Optional content rendered to the right of the title (e.g. badges). */
|
|
28
|
+
actions?: React.ReactNode;
|
|
29
|
+
className?: string;
|
|
30
|
+
'data-testid'?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const ModalShellHeader: React.FC<ModalShellHeaderProps>;
|
|
33
|
+
export interface ModalShellFooterProps {
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
/** Grid column template. Default `2-col grid` (Cancel + Collect). */
|
|
36
|
+
columns?: 1 | 2;
|
|
37
|
+
className?: string;
|
|
38
|
+
'data-testid'?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const ModalShellFooter: React.FC<ModalShellFooterProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OtherTenderForm Pattern
|
|
3
|
+
*
|
|
4
|
+
* Pure-UI primitive for catch-all (non card/cash/check) tender entry.
|
|
5
|
+
* Used by `@veevarts/payments-drop-in`'s `<OtherTender>`.
|
|
6
|
+
*/
|
|
7
|
+
export { OtherTenderForm } from './OtherTenderForm';
|
|
8
|
+
export type { OtherTenderFormProps, OtherTenderValue, OtherTenderLabels, OtherTenderMethodOption, Money, } from './types';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Money } from '../../utils/money';
|
|
2
|
+
export type { Money } from '../../utils/money';
|
|
3
|
+
/** A single selectable non-card / non-cash / non-check payment method. */
|
|
4
|
+
export interface OtherTenderMethodOption {
|
|
5
|
+
/** Stable identifier (e.g. `'ach'`, `'wire'`, `'gift_card'`, `'voucher'`). */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Localized display label. */
|
|
8
|
+
label: string;
|
|
9
|
+
}
|
|
10
|
+
/** Snapshot emitted whenever the form mutates. */
|
|
11
|
+
export interface OtherTenderValue {
|
|
12
|
+
amount: number;
|
|
13
|
+
/**
|
|
14
|
+
* The selected method's `value` (machine-friendly). Empty string means "no
|
|
15
|
+
* selection yet".
|
|
16
|
+
*/
|
|
17
|
+
method: string;
|
|
18
|
+
/**
|
|
19
|
+
* Human-readable description of the selected method (its `label`). Always
|
|
20
|
+
* paired with `method`.
|
|
21
|
+
*/
|
|
22
|
+
description: string;
|
|
23
|
+
/** Free-form reference number (e.g. external voucher ID). */
|
|
24
|
+
reference?: string;
|
|
25
|
+
isValid: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface OtherTenderLabels {
|
|
28
|
+
methodLabel?: string;
|
|
29
|
+
methodPlaceholder?: string;
|
|
30
|
+
referenceLabel?: string;
|
|
31
|
+
referencePlaceholder?: string;
|
|
32
|
+
methodRequiredMessage?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface OtherTenderFormProps {
|
|
35
|
+
dueAmount: Money;
|
|
36
|
+
/**
|
|
37
|
+
* Available payment methods. Defaults to a small generic set (ACH, Wire,
|
|
38
|
+
* Gift Card, Voucher, Other). Hosts almost always want to override.
|
|
39
|
+
*/
|
|
40
|
+
methodOptions?: OtherTenderMethodOption[];
|
|
41
|
+
/** Controlled value. Use together with `onChange`. */
|
|
42
|
+
value?: Partial<Pick<OtherTenderValue, 'method' | 'reference'>>;
|
|
43
|
+
/** Uncontrolled defaults. */
|
|
44
|
+
defaultValue?: Partial<Pick<OtherTenderValue, 'method' | 'reference'>>;
|
|
45
|
+
onChange?: (value: OtherTenderValue) => void;
|
|
46
|
+
locale?: string;
|
|
47
|
+
labels?: OtherTenderLabels;
|
|
48
|
+
/** Show the optional `reference` text input. */
|
|
49
|
+
showReference?: boolean;
|
|
50
|
+
isDisabled?: boolean;
|
|
51
|
+
'data-testid'?: string;
|
|
52
|
+
className?: string;
|
|
53
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Money } from '../../utils/money';
|
|
3
|
+
export interface PaymentCashChangeBannerProps {
|
|
4
|
+
/** Amount of cash to give back. Banner only renders when > 0. */
|
|
5
|
+
cashChange: Money;
|
|
6
|
+
/** Heading above the amount. Translatable. Default `'Cash to return'`. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional secondary line below the amount. Use in mid-split flows
|
|
10
|
+
* to disambiguate WHICH sub-payment the change refers to (e.g.
|
|
11
|
+
* `'From Payment #1'`).
|
|
12
|
+
*/
|
|
13
|
+
secondaryLine?: string;
|
|
14
|
+
/** Locale forwarded to `formatMoney`. Default `'en-US'`. */
|
|
15
|
+
locale?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Dismiss button — when set, renders an X button that fires this
|
|
18
|
+
* callback. Omit to render the banner non-dismissible (used inside
|
|
19
|
+
* `<PaymentSuccessView>` where the entire view replaces on Close).
|
|
20
|
+
*/
|
|
21
|
+
onDismiss?: () => void;
|
|
22
|
+
/** Accessible label for the dismiss button. Default `'Dismiss'`. */
|
|
23
|
+
dismissAriaLabel?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Horizontal alignment of the inner content (icon + text block).
|
|
26
|
+
* Default `'left'` — used mid-split where the banner sits inline
|
|
27
|
+
* with left-aligned form sections.
|
|
28
|
+
* `'center'` — used inside `<PaymentSuccessView>` so the banner
|
|
29
|
+
* lines up under the centered success badge + title.
|
|
30
|
+
*/
|
|
31
|
+
align?: 'left' | 'center';
|
|
32
|
+
className?: string;
|
|
33
|
+
'data-testid'?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare const PaymentCashChangeBanner: React.FC<PaymentCashChangeBannerProps>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface PaymentSubAmountInputProps {
|
|
3
|
+
/** Section heading text (e.g. "Payment #3"). */
|
|
4
|
+
heading: string;
|
|
5
|
+
/** Input label rendered above the field. */
|
|
6
|
+
amountLabel: string;
|
|
7
|
+
/** Controlled value. Use together with `onChange`. */
|
|
8
|
+
value?: string;
|
|
9
|
+
/** Uncontrolled default. */
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
/** Fires on every keystroke with the raw string. */
|
|
12
|
+
onChange?: (next: string) => void;
|
|
13
|
+
/** Placeholder shown when value is empty (e.g. "$150.00"). */
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
isDisabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Validation flag — drives the red border + error message UI.
|
|
18
|
+
* The host computes WHY (e.g. amount > remaining); this primitive
|
|
19
|
+
* only renders the visual error state.
|
|
20
|
+
*/
|
|
21
|
+
isInvalid?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Error message rendered below the field when `isInvalid === true`.
|
|
24
|
+
* Translatable. Already-formatted (the host substitutes currency
|
|
25
|
+
* + locale).
|
|
26
|
+
*/
|
|
27
|
+
errorMessage?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Auto-focus the amount field when this component mounts. Pair
|
|
30
|
+
* with `key={...}` from the host to re-trigger focus on every
|
|
31
|
+
* sub-payment (the input re-mounts each time and `autoFocus`
|
|
32
|
+
* fires again). The built-in `onFocus` already selects the
|
|
33
|
+
* value, so a cashier landing here can overwrite the placeholder
|
|
34
|
+
* with a single keystroke.
|
|
35
|
+
*
|
|
36
|
+
* Default `false` — the input is unfocused at mount. Hosts opt in
|
|
37
|
+
* when their flow guarantees the cashier just navigated TO this
|
|
38
|
+
* step (e.g. opening Split, advancing to Payment #N).
|
|
39
|
+
*/
|
|
40
|
+
autoFocus?: boolean;
|
|
41
|
+
'data-testid'?: string;
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
export declare const PaymentSubAmountInput: React.FC<PaymentSubAmountInputProps>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Money } from '../../utils/money';
|
|
3
|
+
export interface PaymentSuccessViewProps {
|
|
4
|
+
title: string;
|
|
5
|
+
subtitle: string;
|
|
6
|
+
/** Optional email confirmation line ("Client will receive a confirmation email at …"). */
|
|
7
|
+
emailLine?: string;
|
|
8
|
+
/** Email address to render in bold under `emailLine`. Required if `emailLine` is set. */
|
|
9
|
+
confirmationEmail?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Total cash change to return to the customer. Renders as a
|
|
12
|
+
* prominent warning banner with the formatted amount; omit (or
|
|
13
|
+
* pass `value: 0`) when there is no change to give back (any
|
|
14
|
+
* non-cash tender, or cash paid exact).
|
|
15
|
+
*/
|
|
16
|
+
cashChange?: Money;
|
|
17
|
+
/** Label rendered above the cash-change amount. Default: "Cash to return". */
|
|
18
|
+
cashChangeLabel?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Locale used to format `cashChange`. Default `'en-US'`. Ignored
|
|
21
|
+
* when no cashChange is passed.
|
|
22
|
+
*/
|
|
23
|
+
locale?: string;
|
|
24
|
+
/** Close button label. Omit `onClose` to hide the button entirely. */
|
|
25
|
+
closeLabel?: string;
|
|
26
|
+
onClose?: () => void;
|
|
27
|
+
className?: string;
|
|
28
|
+
'data-testid'?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const PaymentSuccessView: React.FC<PaymentSuccessViewProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Money } from '../../utils/money';
|
|
3
|
+
export interface PaymentTotalBannerProps {
|
|
4
|
+
/** Amount to render. */
|
|
5
|
+
total: Money;
|
|
6
|
+
/** Label rendered above the amount (e.g. "Total Due:", "Remaining:", "Complete"). */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Locale for currency formatting. Default `'en-US'`. */
|
|
9
|
+
locale?: string;
|
|
10
|
+
/** Visual variant for emphasis. Default `'subtle'`. */
|
|
11
|
+
variant?: 'subtle' | 'success';
|
|
12
|
+
className?: string;
|
|
13
|
+
'data-testid'?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const PaymentTotalBanner: React.FC<PaymentTotalBannerProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SplitPaymentSummary Pattern
|
|
3
|
+
*
|
|
4
|
+
* Pure-UI primitive showing the running list of tenders + remaining balance
|
|
5
|
+
* for multi-tender split payments. Used by `@veevarts/payments-drop-in`'s
|
|
6
|
+
* `<PaymentsDropIn>` orchestrator.
|
|
7
|
+
*/
|
|
8
|
+
export { SplitPaymentSummary } from './SplitPaymentSummary';
|
|
9
|
+
export type { SplitPaymentSummaryProps, SplitPaymentSummaryLabels, TenderRow, TenderRowStatus, TenderRowType, Money, } from './types';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Money } from '../../utils/money';
|
|
2
|
+
export type { Money } from '../../utils/money';
|
|
3
|
+
export type TenderRowType = 'card' | 'cash' | 'check' | 'other';
|
|
4
|
+
export type TenderRowStatus = 'pending' | 'recorded' | 'failed';
|
|
5
|
+
export interface TenderRow {
|
|
6
|
+
/** Stable identifier (idempotency key, server-side payment id, etc.). */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Canonical category used to pick the row icon. */
|
|
9
|
+
type: TenderRowType;
|
|
10
|
+
/** Tender amount in the host's currency. */
|
|
11
|
+
amount: number;
|
|
12
|
+
/**
|
|
13
|
+
* One-line description shown next to the icon. Examples:
|
|
14
|
+
* - `'Credit Card **5555'`
|
|
15
|
+
* - `'Cash'`
|
|
16
|
+
* - `'Check #102934'`
|
|
17
|
+
* - `'ACH'`
|
|
18
|
+
*/
|
|
19
|
+
label: string;
|
|
20
|
+
/**
|
|
21
|
+
* Lifecycle status. `pending` and `recorded` ARE present in the running
|
|
22
|
+
* balance; `failed` is rendered for context but NOT counted toward
|
|
23
|
+
* `collected`.
|
|
24
|
+
*/
|
|
25
|
+
status: TenderRowStatus;
|
|
26
|
+
/**
|
|
27
|
+
* Optional failure message shown inline when `status === 'failed'`.
|
|
28
|
+
*/
|
|
29
|
+
failureReason?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface SplitPaymentSummaryLabels {
|
|
32
|
+
collectedHeading?: string;
|
|
33
|
+
remainingLabel?: string;
|
|
34
|
+
completeLabel?: string;
|
|
35
|
+
removeAriaLabel?: string;
|
|
36
|
+
removeTooltipForRecorded?: string;
|
|
37
|
+
statusPending?: string;
|
|
38
|
+
statusRecorded?: string;
|
|
39
|
+
statusFailed?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface SplitPaymentSummaryProps {
|
|
42
|
+
/** Total amount the host is collecting (sum target). */
|
|
43
|
+
total: Money;
|
|
44
|
+
/**
|
|
45
|
+
* All tenders entered so far — pending, recorded, or failed. Failed
|
|
46
|
+
* tenders are shown but excluded from the running balance.
|
|
47
|
+
*/
|
|
48
|
+
tenders: TenderRow[];
|
|
49
|
+
/**
|
|
50
|
+
* Invoked when the user clicks the remove button on a tender row. Only
|
|
51
|
+
* fires when removal is allowed (i.e. status === 'pending' or 'failed').
|
|
52
|
+
* Omit to hide remove buttons entirely.
|
|
53
|
+
*/
|
|
54
|
+
onRemove?: (id: string) => void;
|
|
55
|
+
locale?: string;
|
|
56
|
+
labels?: SplitPaymentSummaryLabels;
|
|
57
|
+
/** Hide the collected list (just the remaining banner). */
|
|
58
|
+
hideCollectedList?: boolean;
|
|
59
|
+
'data-testid'?: string;
|
|
60
|
+
className?: string;
|
|
61
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface TileSelectOption {
|
|
3
|
+
/** Stable identifier returned via `onSelect`. */
|
|
4
|
+
key: string;
|
|
5
|
+
/** Visible label rendered under the icon. */
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* Icon: iconify name (`'lucide:credit-card'`) or a `ReactNode` for
|
|
9
|
+
* fully-custom SVGs.
|
|
10
|
+
*/
|
|
11
|
+
icon: string | React.ReactNode;
|
|
12
|
+
/** Disable the tile (greyed out, no click). */
|
|
13
|
+
isDisabled?: boolean;
|
|
14
|
+
/** Override per-tile test id; defaults to `${dataTestId}-${key}`. */
|
|
15
|
+
'data-testid'?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface TileSelectProps {
|
|
18
|
+
/** Options to render in order. */
|
|
19
|
+
options: readonly TileSelectOption[];
|
|
20
|
+
/** Currently selected option `key`. `null` = no selection. */
|
|
21
|
+
selectedKey: string | null;
|
|
22
|
+
/** Fires when a tile is selected. */
|
|
23
|
+
onSelect: (key: string) => void;
|
|
24
|
+
/** Optional heading rendered above the grid. */
|
|
25
|
+
heading?: string;
|
|
26
|
+
/**
|
|
27
|
+
* `aria-label` for the wrapping group when `heading` is omitted.
|
|
28
|
+
* Translatable. Default `'Select an option'`. When `heading` is
|
|
29
|
+
* provided this prop is ignored — the grid is labelled by the
|
|
30
|
+
* heading element.
|
|
31
|
+
*/
|
|
32
|
+
ariaLabel?: string;
|
|
33
|
+
/** Grid columns on >= sm. Default `3`. Mobile collapses to 2. */
|
|
34
|
+
columnsDesktop?: 2 | 3 | 4;
|
|
35
|
+
columnsMobile?: 1 | 2;
|
|
36
|
+
className?: string;
|
|
37
|
+
'data-testid'?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare const TileSelect: React.FC<TileSelectProps>;
|