@veevarts/design-system 1.17.0-alpha.2 → 1.17.0-alpha.3
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 +8 -8
- package/dist/index.js +4270 -3506
- package/dist/patterns/ActingAsToggle/ActingAsToggle.d.ts +3 -0
- package/dist/patterns/ActingAsToggle/index.d.ts +2 -0
- package/dist/patterns/ActingAsToggle/types.d.ts +13 -0
- package/dist/patterns/CustomAmountField/CustomAmountField.d.ts +3 -0
- package/dist/patterns/CustomAmountField/index.d.ts +2 -0
- package/dist/patterns/CustomAmountField/types.d.ts +21 -0
- package/dist/patterns/MoneyBackMethods/MoneyBackMethods.d.ts +4 -0
- package/dist/patterns/MoneyBackMethods/index.d.ts +2 -0
- package/dist/patterns/MoneyBackMethods/types.d.ts +44 -0
- package/dist/patterns/NotesField/NotesField.d.ts +3 -0
- package/dist/patterns/NotesField/index.d.ts +2 -0
- package/dist/patterns/NotesField/types.d.ts +12 -0
- package/dist/patterns/PaymentSubAmountInput/PaymentSubAmountInput.d.ts +9 -0
- package/dist/patterns/ReasonSelect/ReasonSelect.d.ts +3 -0
- package/dist/patterns/ReasonSelect/index.d.ts +2 -0
- package/dist/patterns/ReasonSelect/types.d.ts +17 -0
- package/dist/patterns/RefundCompleteView/RefundCompleteView.d.ts +3 -0
- package/dist/patterns/RefundCompleteView/index.d.ts +2 -0
- package/dist/patterns/RefundCompleteView/types.d.ts +22 -0
- package/dist/patterns/RefundItemList/RefundItemList.d.ts +3 -0
- package/dist/patterns/RefundItemList/index.d.ts +2 -0
- package/dist/patterns/RefundItemList/types.d.ts +40 -0
- package/dist/patterns/RefundTotalBar/RefundTotalBar.d.ts +3 -0
- package/dist/patterns/RefundTotalBar/index.d.ts +2 -0
- package/dist/patterns/RefundTotalBar/types.d.ts +13 -0
- package/dist/patterns/SplitRefundPanel/SplitRefundPanel.d.ts +4 -0
- package/dist/patterns/SplitRefundPanel/index.d.ts +2 -0
- package/dist/patterns/SplitRefundPanel/types.d.ts +51 -0
- package/dist/patterns/SupervisorPinField/SupervisorPinField.d.ts +3 -0
- package/dist/patterns/SupervisorPinField/index.d.ts +2 -0
- package/dist/patterns/SupervisorPinField/types.d.ts +12 -0
- package/dist/patterns/WizardShell/WizardShell.d.ts +4 -0
- package/dist/patterns/WizardShell/index.d.ts +2 -0
- package/dist/patterns/WizardShell/types.d.ts +29 -0
- package/dist/patterns/index.d.ts +25 -2
- package/dist/patterns/refund-shared/index.d.ts +1 -0
- package/dist/patterns/refund-shared/types.d.ts +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ActingRole = 'manager' | 'cashier';
|
|
2
|
+
export interface ActingAsToggleLabels {
|
|
3
|
+
legend?: string;
|
|
4
|
+
manager?: string;
|
|
5
|
+
cashier?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ActingAsToggleProps {
|
|
8
|
+
role: ActingRole;
|
|
9
|
+
onChange: (role: ActingRole) => void;
|
|
10
|
+
labels?: ActingAsToggleLabels;
|
|
11
|
+
className?: string;
|
|
12
|
+
'data-testid'?: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Money } from '../../utils/money';
|
|
2
|
+
export type { Money } from '../../utils/money';
|
|
3
|
+
export interface CustomAmountFieldLabels {
|
|
4
|
+
amountLabel?: string;
|
|
5
|
+
descriptionLabel?: string;
|
|
6
|
+
maxHint?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CustomAmountFieldValue {
|
|
9
|
+
amount: number | null;
|
|
10
|
+
description: string;
|
|
11
|
+
}
|
|
12
|
+
export interface CustomAmountFieldProps {
|
|
13
|
+
amount: number | null;
|
|
14
|
+
description: string;
|
|
15
|
+
max: Money;
|
|
16
|
+
error?: string;
|
|
17
|
+
onChange: (value: CustomAmountFieldValue) => void;
|
|
18
|
+
labels?: CustomAmountFieldLabels;
|
|
19
|
+
className?: string;
|
|
20
|
+
'data-testid'?: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Money } from '../../utils/money';
|
|
2
|
+
import { MoneyBackError } from '..';
|
|
3
|
+
export type { Money } from '../../utils/money';
|
|
4
|
+
export type TenderKind = 'card' | 'cash' | 'check' | 'other';
|
|
5
|
+
export interface TenderView {
|
|
6
|
+
/** Stable identifier returned via `onSelect`. */
|
|
7
|
+
tenderId: string;
|
|
8
|
+
/**
|
|
9
|
+
* One-line description shown on the tile. Examples:
|
|
10
|
+
* - `'Visa •••4242'`
|
|
11
|
+
* - `'Cash'`
|
|
12
|
+
*/
|
|
13
|
+
label: string;
|
|
14
|
+
/** Canonical category used to pick the tile icon. */
|
|
15
|
+
kind: TenderKind;
|
|
16
|
+
/** Amount still refundable to this tender. */
|
|
17
|
+
maxRefundable: Money;
|
|
18
|
+
}
|
|
19
|
+
export interface MoneyBackMethodsLabels {
|
|
20
|
+
/** Optional heading rendered above the tile grid. */
|
|
21
|
+
title?: string;
|
|
22
|
+
split?: string;
|
|
23
|
+
declinedTitle?: string;
|
|
24
|
+
declinedBody?: string;
|
|
25
|
+
networkTitle?: string;
|
|
26
|
+
networkBody?: string;
|
|
27
|
+
retry?: string;
|
|
28
|
+
chooseDifferent?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface MoneyBackMethodsProps {
|
|
31
|
+
/** Refundable tenders, one tile each. */
|
|
32
|
+
tenders: TenderView[];
|
|
33
|
+
/** Currently selected tender `tenderId`. `null` = no selection. */
|
|
34
|
+
selectedTenderId: string | null;
|
|
35
|
+
/** Fires when a tender tile is selected. */
|
|
36
|
+
onSelect: (tenderId: string) => void;
|
|
37
|
+
/** Fires when the "split across multiple methods" tile is selected. */
|
|
38
|
+
onSplit: () => void;
|
|
39
|
+
/** Processor-declined / network-error banner, shown above the tiles. */
|
|
40
|
+
error?: MoneyBackError;
|
|
41
|
+
labels?: MoneyBackMethodsLabels;
|
|
42
|
+
className?: string;
|
|
43
|
+
'data-testid'?: string;
|
|
44
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface NotesFieldLabels {
|
|
2
|
+
toggle?: string;
|
|
3
|
+
optionalTag?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface NotesFieldProps {
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
maxLength?: number;
|
|
9
|
+
labels?: NotesFieldLabels;
|
|
10
|
+
className?: string;
|
|
11
|
+
'data-testid'?: string;
|
|
12
|
+
}
|
|
@@ -49,6 +49,15 @@ export interface PaymentSubAmountInputProps {
|
|
|
49
49
|
* guard is value-based. Omit for no cap.
|
|
50
50
|
*/
|
|
51
51
|
maxAmount?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Visually hides the section heading and the input's own label
|
|
54
|
+
* (via `sr-only`) for compact compositions that already supply
|
|
55
|
+
* their own surrounding label context (e.g. `CustomAmountField`,
|
|
56
|
+
* `RefundItemList`'s partial-amount box). Both stay in the DOM so
|
|
57
|
+
* the accessible name is preserved for assistive tech. Default
|
|
58
|
+
* `false` — zero behavior change for existing consumers.
|
|
59
|
+
*/
|
|
60
|
+
hideHeading?: boolean;
|
|
52
61
|
'data-testid'?: string;
|
|
53
62
|
className?: string;
|
|
54
63
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ReasonOption {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ReasonSelectLabels {
|
|
6
|
+
label?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ReasonSelectProps {
|
|
10
|
+
options: ReasonOption[];
|
|
11
|
+
value: string | null;
|
|
12
|
+
onChange: (id: string) => void;
|
|
13
|
+
error?: string;
|
|
14
|
+
labels?: ReasonSelectLabels;
|
|
15
|
+
className?: string;
|
|
16
|
+
'data-testid'?: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RefundDestinationLine } from '..';
|
|
2
|
+
export type { RefundDestinationLine, RefundDestinationStatus } from '..';
|
|
3
|
+
export interface RefundCompleteViewLabels {
|
|
4
|
+
processing?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
destinationsTitle?: string;
|
|
7
|
+
sendReceipt?: string;
|
|
8
|
+
email?: string;
|
|
9
|
+
print?: string;
|
|
10
|
+
done?: string;
|
|
11
|
+
pending?: string;
|
|
12
|
+
succeeded?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface RefundCompleteViewProps {
|
|
15
|
+
state: 'processing' | 'complete';
|
|
16
|
+
destinations: RefundDestinationLine[];
|
|
17
|
+
onSendReceipt?: (channel: 'email' | 'print') => void;
|
|
18
|
+
onDone: () => void;
|
|
19
|
+
labels?: RefundCompleteViewLabels;
|
|
20
|
+
className?: string;
|
|
21
|
+
'data-testid'?: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Money } from '../../utils/money';
|
|
2
|
+
export type { Money } from '../../utils/money';
|
|
3
|
+
export type RefundItemState = 'selectable' | 'already_refunded' | 'non_refundable';
|
|
4
|
+
export interface RefundItemRestockView {
|
|
5
|
+
available: boolean;
|
|
6
|
+
unavailableHint?: string;
|
|
7
|
+
on: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface RefundItemView {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
quantity: number;
|
|
13
|
+
paidAmount: Money;
|
|
14
|
+
state: RefundItemState;
|
|
15
|
+
warning?: string;
|
|
16
|
+
restock: RefundItemRestockView;
|
|
17
|
+
}
|
|
18
|
+
export interface ItemSelection {
|
|
19
|
+
selected: boolean;
|
|
20
|
+
mode: 'full' | 'partial';
|
|
21
|
+
partialAmount?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface RefundItemListLabels {
|
|
24
|
+
refunded?: string;
|
|
25
|
+
ineligible?: string;
|
|
26
|
+
partialLink?: string;
|
|
27
|
+
partialOf?: string;
|
|
28
|
+
partialCancel?: string;
|
|
29
|
+
restockTitle?: string;
|
|
30
|
+
restockHint?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface RefundItemListProps {
|
|
33
|
+
items: RefundItemView[];
|
|
34
|
+
selections: Record<string, ItemSelection>;
|
|
35
|
+
onSelectionChange: (itemId: string, selection: ItemSelection) => void;
|
|
36
|
+
onRestockToggle: (itemId: string, on: boolean) => void;
|
|
37
|
+
labels?: RefundItemListLabels;
|
|
38
|
+
className?: string;
|
|
39
|
+
'data-testid'?: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Money } from '../../utils/money';
|
|
2
|
+
export type { Money } from '../../utils/money';
|
|
3
|
+
export interface RefundTotalBarLabels {
|
|
4
|
+
title?: string;
|
|
5
|
+
partialBadge?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface RefundTotalBarProps {
|
|
8
|
+
total: Money;
|
|
9
|
+
isPartial: boolean;
|
|
10
|
+
labels?: RefundTotalBarLabels;
|
|
11
|
+
className?: string;
|
|
12
|
+
'data-testid'?: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Money } from '../../utils/money';
|
|
2
|
+
import { MoneyBackError } from '..';
|
|
3
|
+
export type { Money } from '../../utils/money';
|
|
4
|
+
export interface SplitPartView {
|
|
5
|
+
/** Stable identifier for the tender this part refunds to. */
|
|
6
|
+
tenderId: string;
|
|
7
|
+
/** One-line description, e.g. `'Visa •••4242'` or `'Cash'`. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Amount already refunded for this part. `null` = not executed yet. */
|
|
10
|
+
refunded: Money | null;
|
|
11
|
+
}
|
|
12
|
+
export interface SplitRefundPanelLabels {
|
|
13
|
+
title?: string;
|
|
14
|
+
refundedSoFar?: string;
|
|
15
|
+
remaining?: string;
|
|
16
|
+
amountForPart?: string;
|
|
17
|
+
submit?: string;
|
|
18
|
+
back?: string;
|
|
19
|
+
partDeclinedBody?: string;
|
|
20
|
+
partNetworkBody?: string;
|
|
21
|
+
retry?: string;
|
|
22
|
+
chooseDifferent?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SplitRefundPanelProps {
|
|
25
|
+
/** Every part of the split, executed and pending, in entry order. */
|
|
26
|
+
parts: SplitPartView[];
|
|
27
|
+
/** Sum already refunded across executed parts. */
|
|
28
|
+
refundedSoFar: Money;
|
|
29
|
+
/** Amount left to refund across the remaining parts. */
|
|
30
|
+
remaining: Money;
|
|
31
|
+
/** The part currently being entered. */
|
|
32
|
+
current: {
|
|
33
|
+
/** Tender selected for the part being entered. `null` = not chosen yet. */
|
|
34
|
+
tenderId: string | null;
|
|
35
|
+
/** Amount typed so far, in major units. */
|
|
36
|
+
amount: number;
|
|
37
|
+
/** Fires on every keystroke with the parsed major-unit amount. */
|
|
38
|
+
onAmountChange: (next: number) => void;
|
|
39
|
+
};
|
|
40
|
+
/** Fires when the cashier submits the current part. */
|
|
41
|
+
onRefundPart: () => void;
|
|
42
|
+
/** Processor-declined / network-error banner for the current part. */
|
|
43
|
+
partError?: MoneyBackError;
|
|
44
|
+
/** Fires when the cashier navigates back out of the split flow. */
|
|
45
|
+
onBack: () => void;
|
|
46
|
+
/** Disables the submit action and shows its loading state. */
|
|
47
|
+
busy?: boolean;
|
|
48
|
+
labels?: SplitRefundPanelLabels;
|
|
49
|
+
className?: string;
|
|
50
|
+
'data-testid'?: string;
|
|
51
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SupervisorPinFieldLabels {
|
|
2
|
+
label?: string;
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface SupervisorPinFieldProps {
|
|
6
|
+
pin: string;
|
|
7
|
+
onChange: (pin: string) => void;
|
|
8
|
+
error?: string;
|
|
9
|
+
labels?: SupervisorPinFieldLabels;
|
|
10
|
+
className?: string;
|
|
11
|
+
'data-testid'?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type WizardStepState = 'upcoming' | 'active' | 'done' | 'skipped';
|
|
3
|
+
export interface WizardStep {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
state: WizardStepState;
|
|
7
|
+
}
|
|
8
|
+
export interface WizardShellPrimaryAction {
|
|
9
|
+
label: string;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface WizardShellLabels {
|
|
15
|
+
back?: string;
|
|
16
|
+
close?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface WizardShellProps {
|
|
19
|
+
onClose?: () => void;
|
|
20
|
+
steps: WizardStep[];
|
|
21
|
+
activeStepId: string;
|
|
22
|
+
onBack?: () => void;
|
|
23
|
+
primaryAction: WizardShellPrimaryAction;
|
|
24
|
+
footerSummary?: ReactNode;
|
|
25
|
+
labels?: WizardShellLabels;
|
|
26
|
+
className?: string;
|
|
27
|
+
'data-testid'?: string;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}
|
package/dist/patterns/index.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export type { PaginationSummaryProps, PaginationSummaryClassNames } from './Pagi
|
|
|
68
68
|
export { ListPanel } from './ListPanel';
|
|
69
69
|
export type { ListPanelProps, ListPanelClassNames } from './ListPanel';
|
|
70
70
|
export { CashTenderForm } from './CashTenderForm';
|
|
71
|
-
export type { CashTenderFormProps, CashTenderValue, CashTenderLabels
|
|
71
|
+
export type { CashTenderFormProps, CashTenderValue, CashTenderLabels } from './CashTenderForm';
|
|
72
72
|
export { CheckTenderForm } from './CheckTenderForm';
|
|
73
73
|
export type { CheckTenderFormProps, CheckTenderValue, CheckTenderLabels } from './CheckTenderForm';
|
|
74
74
|
export { OtherTenderForm } from './OtherTenderForm';
|
|
@@ -76,7 +76,7 @@ export type { OtherTenderFormProps, OtherTenderValue, OtherTenderLabels, OtherTe
|
|
|
76
76
|
export { SplitPaymentSummary } from './SplitPaymentSummary';
|
|
77
77
|
export type { SplitPaymentSummaryProps, SplitPaymentSummaryLabels, TenderRow, TenderRowStatus, TenderRowType, } from './SplitPaymentSummary';
|
|
78
78
|
export { ModalShell, ModalShellHeader, ModalShellFooter } from './ModalShell';
|
|
79
|
-
export type { ModalShellProps, ModalShellHeaderProps, ModalShellFooterProps
|
|
79
|
+
export type { ModalShellProps, ModalShellHeaderProps, ModalShellFooterProps } from './ModalShell';
|
|
80
80
|
export { TileSelect } from './TileSelect';
|
|
81
81
|
export type { TileSelectProps, TileSelectOption } from './TileSelect';
|
|
82
82
|
export { PaymentTotalBanner } from './PaymentTotalBanner';
|
|
@@ -93,3 +93,26 @@ export { ConfirmDialog } from './ConfirmDialog';
|
|
|
93
93
|
export type { ConfirmDialogProps, ConfirmDialogVariant } from './ConfirmDialog';
|
|
94
94
|
export { Summary } from './Summary';
|
|
95
95
|
export type { SummaryProps, SummaryLineItem, SummaryItemDetail, SummaryServiceFee, SummaryTotalRow, SummaryPostTotalRow, SummaryPrimaryAction, SummaryLabels, } from './Summary';
|
|
96
|
+
export { WizardShell } from './WizardShell';
|
|
97
|
+
export type { WizardShellProps, WizardStep, WizardStepState, WizardShellPrimaryAction, WizardShellLabels, } from './WizardShell';
|
|
98
|
+
export type { MoneyBackError, RefundDestinationLine, RefundDestinationStatus } from './refund-shared';
|
|
99
|
+
export { RefundItemList } from './RefundItemList';
|
|
100
|
+
export type { RefundItemListProps, RefundItemView, ItemSelection, RefundItemState, RefundItemRestockView, RefundItemListLabels, } from './RefundItemList';
|
|
101
|
+
export { CustomAmountField } from './CustomAmountField';
|
|
102
|
+
export type { CustomAmountFieldProps, CustomAmountFieldLabels, CustomAmountFieldValue } from './CustomAmountField';
|
|
103
|
+
export { RefundTotalBar } from './RefundTotalBar';
|
|
104
|
+
export type { RefundTotalBarProps, RefundTotalBarLabels } from './RefundTotalBar';
|
|
105
|
+
export { ReasonSelect } from './ReasonSelect';
|
|
106
|
+
export type { ReasonSelectProps, ReasonOption, ReasonSelectLabels } from './ReasonSelect';
|
|
107
|
+
export { NotesField } from './NotesField';
|
|
108
|
+
export type { NotesFieldProps, NotesFieldLabels } from './NotesField';
|
|
109
|
+
export { ActingAsToggle } from './ActingAsToggle';
|
|
110
|
+
export type { ActingAsToggleProps, ActingRole, ActingAsToggleLabels } from './ActingAsToggle';
|
|
111
|
+
export { MoneyBackMethods } from './MoneyBackMethods';
|
|
112
|
+
export type { MoneyBackMethodsProps, TenderView, TenderKind, MoneyBackMethodsLabels } from './MoneyBackMethods';
|
|
113
|
+
export { SplitRefundPanel } from './SplitRefundPanel';
|
|
114
|
+
export type { SplitRefundPanelProps, SplitPartView, SplitRefundPanelLabels } from './SplitRefundPanel';
|
|
115
|
+
export { SupervisorPinField } from './SupervisorPinField';
|
|
116
|
+
export type { SupervisorPinFieldProps, SupervisorPinFieldLabels } from './SupervisorPinField';
|
|
117
|
+
export { RefundCompleteView } from './RefundCompleteView';
|
|
118
|
+
export type { RefundCompleteViewProps, RefundCompleteViewLabels } from './RefundCompleteView';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { MoneyBackError, RefundDestinationLine, RefundDestinationStatus } from './types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Money } from '../../utils/money';
|
|
2
|
+
export interface MoneyBackError {
|
|
3
|
+
kind: 'processor_declined' | 'network';
|
|
4
|
+
onRetry: () => void;
|
|
5
|
+
onChooseDifferent: () => void;
|
|
6
|
+
}
|
|
7
|
+
export type RefundDestinationStatus = 'succeeded' | 'pending';
|
|
8
|
+
export interface RefundDestinationLine {
|
|
9
|
+
label: string;
|
|
10
|
+
amount: Money;
|
|
11
|
+
status: RefundDestinationStatus;
|
|
12
|
+
}
|