@tallyui/components 3.20.1 → 4.0.0

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.
Files changed (161) hide show
  1. package/dist/index.d.ts +1114 -90
  2. package/dist/index.js +8077 -3352
  3. package/package.json +10 -11
  4. package/src/cart/cart-charge-line.tsx +58 -0
  5. package/src/cart/cart-columns-form.tsx +98 -0
  6. package/src/cart/cart-columns.tsx +49 -18
  7. package/src/cart/cart-foot.tsx +7 -2
  8. package/src/cart/cart-line-strip.tsx +59 -0
  9. package/src/cart/cart-line.tsx +20 -8
  10. package/src/cart/cart-note-row.tsx +30 -0
  11. package/src/cart/cart-panel.tsx +9 -1
  12. package/src/cart/cart-row-motion.tsx +125 -0
  13. package/src/cart/cart-total.tsx +44 -15
  14. package/src/cart/index.ts +2 -1
  15. package/src/checkout/cash-tendered.tsx +8 -7
  16. package/src/checkout/change-display.tsx +2 -1
  17. package/src/checkout/index.ts +1 -1
  18. package/src/checkout/payment-selector.tsx +6 -2
  19. package/src/checkout/payment-types.test-d.ts +28 -0
  20. package/src/customer/address-editor.tsx +87 -0
  21. package/src/customer/address-fields.tsx +120 -0
  22. package/src/customer/customer-dropdown.tsx +200 -0
  23. package/src/customer/customer-editor.tsx +99 -0
  24. package/src/customer/customer-form.tsx +39 -5
  25. package/src/customer/customer-picker.tsx +38 -14
  26. package/src/customer/customers-list.tsx +83 -0
  27. package/src/customer/index.ts +5 -0
  28. package/src/filter/filter-pills.tsx +63 -0
  29. package/src/i18n/locales/en/components.json +85 -0
  30. package/src/index.ts +40 -2
  31. package/src/input/decimal-entry.ts +21 -0
  32. package/src/layout/checkout-layout.tsx +1 -1
  33. package/src/layout/live-tab-screen.tsx +1 -1
  34. package/src/layout/pos-layout.tsx +80 -4
  35. package/src/layout/settings-layout.tsx +1 -1
  36. package/src/layout/store-settings-choice-screen.tsx +1 -1
  37. package/src/lib/current-row.ts +13 -0
  38. package/src/lib/money-input.ts +16 -0
  39. package/src/lib/motion.ts +22 -0
  40. package/src/lib/use-reduced-motion.ts +20 -0
  41. package/src/order/index.ts +1 -1
  42. package/src/order/order-detail.tsx +123 -5
  43. package/src/order/order-filter-bar.tsx +7 -57
  44. package/src/order/order-status-badge.tsx +42 -19
  45. package/src/order/refund-form.tsx +7 -5
  46. package/src/product/camera-scan-button.tsx +2 -0
  47. package/src/product/category-nav.tsx +8 -0
  48. package/src/product/category-tile.tsx +65 -15
  49. package/src/product/in-cart-badge.tsx +55 -6
  50. package/src/product/index.ts +1 -0
  51. package/src/product/press-veil.tsx +7 -0
  52. package/src/product/product-card.tsx +5 -1
  53. package/src/product/product-grid.tsx +5 -0
  54. package/src/product/product-price.tsx +6 -3
  55. package/src/product/product-stock-badge.tsx +3 -2
  56. package/src/product/product-table.tsx +96 -8
  57. package/src/product/products-screen-columns.tsx +74 -0
  58. package/src/product/variant-tile.tsx +68 -0
  59. package/src/product/variation-picker.tsx +3 -3
  60. package/src/product/view-toggle.tsx +33 -4
  61. package/src/register/cashier-sheet.tsx +195 -0
  62. package/src/register/closure-sheet.tsx +54 -3
  63. package/src/register/handover-slip.tsx +2 -1
  64. package/src/register/index.ts +2 -1
  65. package/src/register/movement-sheet.tsx +66 -7
  66. package/src/register/open-register-card.tsx +11 -11
  67. package/src/register/register-bar.helpers.ts +17 -4
  68. package/src/register/register-bar.tsx +26 -5
  69. package/src/register/register-count.tsx +158 -24
  70. package/src/register/register-panel.tsx +16 -5
  71. package/src/register/register-side-sheet.tsx +32 -8
  72. package/src/register/switch-confirm.tsx +2 -2
  73. package/src/reports/card-panel.tsx +131 -0
  74. package/src/reports/cards.tsx +53 -36
  75. package/src/reports/hero.tsx +2 -1
  76. package/src/reports/index.ts +1 -0
  77. package/src/reports/sales-room.tsx +4 -2
  78. package/src/sale/breadcrumb.tsx +48 -0
  79. package/src/sale/cart-bar.tsx +2 -1
  80. package/src/sale/cart.tsx +127 -38
  81. package/src/sale/catalogue-settings-form.tsx +92 -0
  82. package/src/sale/catalogue.tsx +304 -42
  83. package/src/sale/category-browse.tsx +27 -0
  84. package/src/sale/charge-form.tsx +85 -21
  85. package/src/sale/customer-display-screen.tsx +22 -6
  86. package/src/sale/discount-form.tsx +132 -28
  87. package/src/sale/index.ts +6 -3
  88. package/src/sale/line-popover.tsx +72 -36
  89. package/src/sale/offered-methods.ts +16 -0
  90. package/src/sale/open-sale-tabs.tsx +58 -10
  91. package/src/sale/order-note-sheet.tsx +37 -0
  92. package/src/sale/order-reference.ts +3 -0
  93. package/src/sale/orders-list.tsx +76 -37
  94. package/src/sale/parked-sales.tsx +2 -1
  95. package/src/sale/price-form.tsx +7 -5
  96. package/src/sale/product-filter-bar.tsx +38 -5
  97. package/src/sale/receipt-sheet.tsx +243 -0
  98. package/src/sale/receipt.tsx +19 -9
  99. package/src/sale/sync-status.tsx +10 -0
  100. package/src/sale/tender-ledger.tsx +92 -0
  101. package/src/sale/tender-pane.tsx +159 -73
  102. package/src/sale/tender.tsx +10 -7
  103. package/src/sale/use-tender.ts +63 -0
  104. package/src/scale/min-target.tsx +36 -0
  105. package/src/settings/barcode-scanning-settings.tsx +164 -0
  106. package/src/settings/connector-status.tsx +1 -1
  107. package/src/settings/customer-display-settings.tsx +12 -25
  108. package/src/settings/index.ts +5 -0
  109. package/src/settings/printer-form.tsx +161 -0
  110. package/src/settings/printing-settings.tsx +268 -0
  111. package/src/settings/settings-group.tsx +2 -1
  112. package/src/settings/tax-calculation-settings.tsx +1 -1
  113. package/src/shell/added-to-cart-toast.tsx +61 -0
  114. package/src/shell/app-shell.tsx +5 -1
  115. package/src/shell/connectivity-toast.tsx +70 -0
  116. package/src/shell/index.ts +2 -0
  117. package/src/shell/nav-drawer.tsx +5 -2
  118. package/src/shell/nav-item.tsx +7 -4
  119. package/src/shell/nav-rail.tsx +9 -2
  120. package/src/ui/accordion/index.tsx +86 -8
  121. package/src/ui/alert-dialog/index.tsx +19 -5
  122. package/src/ui/combobox/index.tsx +21 -2
  123. package/src/ui/confirm-dialog/index.tsx +53 -0
  124. package/src/ui/dialog/index.tsx +68 -14
  125. package/src/ui/dialog/motion.ts +54 -0
  126. package/src/ui/icon/activity-heartbeat-icon.tsx +7 -0
  127. package/src/ui/icon/alert-circle-icon.tsx +5 -0
  128. package/src/ui/icon/alert-triangle-icon.tsx +7 -0
  129. package/src/ui/icon/banknote-icon.tsx +11 -0
  130. package/src/ui/icon/cash-register-icon.tsx +10 -0
  131. package/src/ui/icon/category-icon.tsx +7 -0
  132. package/src/ui/icon/chart-line-icon.tsx +5 -0
  133. package/src/ui/icon/check-icon.tsx +5 -0
  134. package/src/ui/icon/chevron-left-icon.tsx +4 -0
  135. package/src/ui/icon/chevron-right-icon.tsx +4 -0
  136. package/src/ui/icon/credit-card-icon.tsx +10 -0
  137. package/src/ui/icon/discount-icon.tsx +11 -0
  138. package/src/ui/icon/gift-icon.tsx +10 -0
  139. package/src/ui/icon/info-circle-icon.tsx +10 -0
  140. package/src/ui/icon/map-pin-icon.tsx +10 -0
  141. package/src/ui/icon/message-question-icon.tsx +7 -0
  142. package/src/ui/icon/pencil-icon.tsx +10 -0
  143. package/src/ui/icon/plus-icon.tsx +9 -0
  144. package/src/ui/icon/printer-icon.tsx +10 -0
  145. package/src/ui/icon/receipt-icon.tsx +7 -0
  146. package/src/ui/icon/settings-icon.tsx +10 -0
  147. package/src/ui/icon/sticky-note-icon.tsx +10 -0
  148. package/src/ui/icon/user-icon.tsx +4 -0
  149. package/src/ui/icon/users-icon.tsx +7 -0
  150. package/src/ui/icon/view-grid-icon.tsx +7 -0
  151. package/src/ui/icon/view-list-icon.tsx +7 -0
  152. package/src/ui/index.ts +24 -1
  153. package/src/ui/list-row/index.tsx +93 -0
  154. package/src/ui/notice/index.tsx +65 -0
  155. package/src/ui/select/index.tsx +2 -0
  156. package/src/ui/skeleton/index.tsx +37 -0
  157. package/src/ui/status-badge/index.tsx +43 -0
  158. package/src/ui/switch/index.tsx +1 -1
  159. package/src/ui/tabs/index.tsx +11 -2
  160. package/src/ui/toggle-group/index.tsx +3 -1
  161. package/src/ui/tone-disc/index.tsx +41 -0
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The filter pills OrderFilterBar and ProductFilterBar share. Ported from WCPOS v2's `filter-bar/*-pill.tsx`
3
+ * (MIT, WCPOS).
4
+ */
5
+ import { useState, type ReactNode } from 'react';
6
+ import { Pressable, Text, View } from 'react-native';
7
+ import { cn } from '@tallyui/theme';
8
+ import { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger } from '../ui/combobox';
9
+ import { XIcon } from '../ui/icon/x-icon';
10
+
11
+ export interface FilterOption { value: string; label: string }
12
+
13
+ // The chip look is ProductFilterBar's; the trigger inside it drops the form-field look of SelectTrigger/ComboboxTrigger.
14
+ export const chipClass = (on: boolean) => cn('min-h-11 flex-row items-center gap-1.5 rounded-full border px-3',
15
+ on ? 'border-primary/30 bg-primary/10' : 'border-border bg-card');
16
+ export const TRIGGER_RESET = 'h-auto min-h-11 w-auto justify-start rounded-none border-0 bg-transparent px-0 py-0';
17
+ export const labelOf = (options: FilterOption[] | undefined, value: string) => options?.find((o) => o.value === value)?.label ?? value;
18
+
19
+ export function Chip({ id, on, label, onClear, trigger }: {
20
+ id: string; on: boolean; label: string; onClear: () => void; trigger: (children: ReactNode) => ReactNode;
21
+ }) {
22
+ return (
23
+ <View className={chipClass(on)}>
24
+ {trigger(<Text className={cn('text-sm', on ? 'text-primary' : 'text-foreground')}>{label}</Text>)}
25
+ {on ? (
26
+ <Pressable testID={`${id}-remove`} role="button" accessibilityLabel="Remove" onPress={onClear}
27
+ hitSlop={8} className="min-h-11 min-w-8 items-center justify-center text-primary">
28
+ <XIcon size={14} />
29
+ </Pressable>
30
+ ) : null}
31
+ </View>
32
+ );
33
+ }
34
+
35
+ export function ComboboxPill({ id, offLabel, placeholder, value, options, onSearch, onPick, onClear }: {
36
+ id: string; offLabel: string; placeholder: string; value?: string; options: FilterOption[];
37
+ onSearch?: (text: string) => void; onPick: (value: string) => void; onClear: () => void;
38
+ }) {
39
+ const [search, setSearch] = useState('');
40
+ const selected = value === undefined ? undefined : { value, label: labelOf(options, value) };
41
+ const needle = search.trim().toLowerCase();
42
+ const shown = onSearch || !needle ? options : options.filter((o) => o.label.toLowerCase().includes(needle));
43
+ return (
44
+ <Combobox value={selected} onValueChange={(next) => { if (next) onPick(next.value); }} searchValue={search}
45
+ onSearchValueChange={(text) => { setSearch(text); onSearch?.(text); }}>
46
+ <Chip id={id} on={!!selected} label={selected?.label ?? offLabel} onClear={onClear}
47
+ trigger={(label) => <ComboboxTrigger testID={id} className={TRIGGER_RESET}>{label}</ComboboxTrigger>} />
48
+ <ComboboxContent testID={`${id}-menu`}>
49
+ <View className="border-b border-border px-2 py-1.5">
50
+ <ComboboxInput testID={`${id}-search`} placeholder={placeholder} />
51
+ </View>
52
+ <ComboboxList>
53
+ {shown.map((option) => (
54
+ <ComboboxItem key={option.value} testID={`${id}-${option.value}`} value={option.value} label={option.label}>
55
+ <Text className="text-sm text-popover-foreground">{option.label}</Text>
56
+ </ComboboxItem>
57
+ ))}
58
+ {shown.length === 0 ? <ComboboxEmpty /> : null}
59
+ </ComboboxList>
60
+ </ComboboxContent>
61
+ </Combobox>
62
+ );
63
+ }
@@ -1,27 +1,112 @@
1
1
  {
2
+ "common.add_to_cart": "Add to Cart",
3
+ "common.add_value": "Add {label}",
4
+ "common.address_1": "Address 1",
5
+ "common.address_2": "Address 2",
6
+ "common.amount": "Amount",
7
+ "common.auto": "Auto",
2
8
  "common.back": "Back",
3
9
  "common.backspace": "Delete last digit",
10
+ "common.barcode": "Barcode",
11
+ "common.billing_address": "Billing Address",
12
+ "common.cancel": "Cancel",
13
+ "common.categories": "Categories",
14
+ "common.city": "City",
15
+ "common.columns": "Columns",
16
+ "common.company": "Company",
17
+ "common.country": "Country",
18
+ "common.edit": "Edit",
19
+ "common.email": "Email",
20
+ "common.first_name": "First Name",
21
+ "common.image": "Image",
22
+ "common.last_name": "Last Name",
23
+ "common.move_down_value": "Move {label} down",
24
+ "common.move_up_value": "Move {label} up",
25
+ "common.name": "Name",
26
+ "common.on_sale": "On Sale",
27
+ "common.phone": "Phone",
28
+ "common.postcode": "Postcode",
29
+ "common.price": "Price",
30
+ "common.product_name": "Product Name",
31
+ "common.regular_price": "Regular Price",
32
+ "common.remove": "Remove",
33
+ "common.restore_default_settings": "Restore Default Settings",
34
+ "common.save": "Save",
35
+ "common.search_customers": "Search Customers",
36
+ "common.shipping_address": "Shipping Address",
37
+ "common.sku": "SKU",
38
+ "common.state": "State",
39
+ "common.stock": "Stock",
40
+ "common.tile_fields": "Tile Fields",
41
+ "common.tile_size": "Tile Size",
4
42
  "common.total": "Total",
43
+ "customer_display.refund_due": "Refund due",
44
+ "customers.add_customer": "Add Customer",
45
+ "customers.clear_search": "Clear search",
46
+ "customers.no_customers_yet": "No customers yet",
47
+ "customers.no_customers_yet_description": "Customers you add, and anyone who buys from you, will appear here.",
48
+ "customers.nothing_matches_search": "No customers match your search",
49
+ "customers.open_customer": "Open customer",
50
+ "pos_cart.amount_includes_tax": "Amount Includes Tax",
51
+ "pos_cart.changes_save_to_order": "Changes save to this order",
52
+ "pos_cart.col_item": "Item",
53
+ "pos_cart.col_price": "Price",
54
+ "pos_cart.col_qty": "Qty",
55
+ "pos_cart.col_total": "Total",
56
+ "pos_cart.edit_customer_address": "Edit Customer Address",
57
+ "pos_cart.qty_abbrev": "Qty",
58
+ "pos_cart.same_as_billing": "Same as billing",
59
+ "pos_cart.split_line": "Split {name}",
60
+ "pos_cart.split_qty": "Split",
61
+ "pos_cart.use_different_address": "Use a different address",
62
+ "pos_checkout.after_this_payment": "After this payment · {amount}",
63
+ "pos_checkout.amount_each": "{amount} each",
5
64
  "pos_checkout.cancel_payment": "Cancel payment",
65
+ "pos_checkout.cancel_payment_question": "Cancel this payment?",
6
66
  "pos_checkout.cancelled": "Cancelled",
7
67
  "pos_checkout.change_due": "Change {amount}",
8
68
  "pos_checkout.clear_amount": "Clear",
9
69
  "pos_checkout.exact_amount": "Exact {amount}",
70
+ "pos_checkout.full_balance": "Full balance {amount}",
71
+ "pos_checkout.full_balance_label": "Full balance",
72
+ "pos_checkout.n_of_units": "{n} of {total}",
10
73
  "pos_checkout.n_of_ways": "{n} of {ways}",
74
+ "pos_checkout.n_ways": "{ways} ways",
11
75
  "pos_checkout.next_leg": "Next",
12
76
  "pos_checkout.no_change_for_method": "Only {amount} is due — {method} can't give change",
13
77
  "pos_checkout.no_payments_yet": "No payments yet",
78
+ "pos_checkout.paid": "Paid",
14
79
  "pos_checkout.paid_in_full": "Paid in full",
15
80
  "pos_checkout.paid_of_total": "{paid} of {total} paid",
16
81
  "pos_checkout.part_payment_left": "Part payment · {left} left after this",
82
+ "pos_checkout.pick_amount_due": "This payment is {amount} for the picked items",
83
+ "pos_checkout.payments_tab": "Payments",
84
+ "pos_checkout.pick_fewer": "One fewer {name}",
85
+ "pos_checkout.pick_more": "One more {name}",
86
+ "pos_checkout.refund_due": "Refund due {amount}",
17
87
  "pos_checkout.remaining": "Remaining",
88
+ "pos_checkout.remove_payment": "Remove payment",
89
+ "pos_checkout.return_cash": "Return {amount} cash to the customer",
18
90
  "pos_checkout.rounded_from": "Rounded from {amount}",
91
+ "pos_checkout.split": "Split",
92
+ "pos_checkout.split_the_rest": "Split the rest",
19
93
  "pos_checkout.status_authorized": "Authorized",
20
94
  "pos_checkout.status_captured": "Captured",
21
95
  "pos_checkout.status_failed": "Failed",
22
96
  "pos_checkout.status_pending": "Pending",
23
97
  "pos_checkout.status_voided": "Voided",
98
+ "pos_checkout.store_holds_payment": "The store already holds this sale's payment. Remove the {amount} taken here to finish.",
24
99
  "pos_checkout.take_amount_in": "Take {amount} in {method}",
100
+ "pos_checkout.tendered": "Tendered",
101
+ "pos_checkout.this_payment": "This payment",
102
+ "pos_checkout.to_pay": "To pay",
103
+ "pos_checkout.void_on_method": "Void {amount} on {title}",
104
+ "receipt.email_queued": "Receipt email queued",
105
+ "receipt.email_sent": "Email sent",
106
+ "register.put_cash_in": "Put cash in",
107
+ "register.put_in": "Put {amount} in",
108
+ "register.take_cash_out": "Take cash out",
109
+ "register.take_out": "Take {amount} out",
25
110
  "tender.complete_sale": "Complete sale",
26
111
  "tender.continue": "Continue",
27
112
  "tender.not_taken": "That payment wasn't taken: nothing is due, or the amount isn't valid.",
package/src/index.ts CHANGED
@@ -23,6 +23,8 @@ export {
23
23
  type ViewToggleProps,
24
24
  defaultProductColumns,
25
25
  useDefaultProductColumns,
26
+ productsScreenColumns,
27
+ useProductsScreenColumns,
26
28
  type ProductTableProps,
27
29
  type ProductTableColumn,
28
30
  type ProductTitleProps,
@@ -75,7 +77,10 @@ export {
75
77
  type CartAction,
76
78
  CartColumnHeads,
77
79
  type CartColumnHeadsProps,
80
+ CartColumnsForm,
81
+ type CartColumnsFormProps,
78
82
  cartColumnIds,
83
+ type CartColumnId,
79
84
  type CartColumnSettings,
80
85
  CartFoot,
81
86
  type CartFootProps,
@@ -110,8 +115,21 @@ export {
110
115
  CustomerForm,
111
116
  type CustomerFormProps,
112
117
  type CustomerFormValues,
118
+ CustomerEditor,
119
+ type CustomerEditorProps,
113
120
  CustomerOrderHistory,
114
121
  type CustomerOrderHistoryProps,
122
+ CustomerDropdown,
123
+ type CustomerDropdownProps,
124
+ CustomersList,
125
+ type CustomersListProps,
126
+ AddressFields,
127
+ ShippingAddressFields,
128
+ type AddressFieldsProps,
129
+ type ShippingAddressFieldsProps,
130
+ AddressEditor,
131
+ type AddressEditorProps,
132
+ type AddressEditorValue,
115
133
  } from './customer';
116
134
 
117
135
  // Checkout components
@@ -121,6 +139,7 @@ export {
121
139
  type PaymentMethodCardProps,
122
140
  type PaymentSelectorProps,
123
141
  type PaymentMethod,
142
+ type PaymentSelectorMethod,
124
143
  OrderSummaryLine,
125
144
  OrderSummary,
126
145
  type OrderSummaryLineProps,
@@ -147,6 +166,7 @@ export {
147
166
  OrderDetail,
148
167
  type OrderDetailProps,
149
168
  type OrderDetailLineItem,
169
+ type OrderDetailTaxLine,
150
170
  RefundForm,
151
171
  type RefundFormProps,
152
172
  type RefundFormValue,
@@ -185,6 +205,7 @@ export {
185
205
  type RegisterColumnProps,
186
206
  RegisterCount,
187
207
  APPROVAL_REQUIRED_TEXT,
208
+ tenderLabel,
188
209
  type RegisterCountProps,
189
210
  ClosureSheet,
190
211
  type ClosureSheetProps,
@@ -192,7 +213,10 @@ export {
192
213
  type SwitchConfirmProps,
193
214
  HandoverSlip,
194
215
  type HandoverSlipProps,
216
+ CashierSheet,
217
+ type CashierSheetProps,
195
218
  } from './register';
219
+ export type { CashierSheetCashier, CashierSheetDrawer, CashierSheetHandTo, CashierSheetPlace } from './register/cashier-sheet';
196
220
 
197
221
  // Settings components
198
222
  export {
@@ -209,6 +233,14 @@ export {
209
233
  type TaxCalculationSettingsProps,
210
234
  CustomerDisplaySettings,
211
235
  type CustomerDisplaySettingsProps,
236
+ PrintingSettings,
237
+ type PrintingSettingsProps,
238
+ PrinterForm,
239
+ type PrinterFormProps,
240
+ type PrinterFormDraft,
241
+ BarcodeScanningSettings,
242
+ type BarcodeScanningSettingsProps,
243
+ type BarcodeScanningValues,
212
244
  } from './settings';
213
245
 
214
246
  // Tax components
@@ -219,11 +251,14 @@ export {
219
251
  Cart, CartBar, Tender, SplitTender, TenderPane, type TenderPaneProps, DiscountForm, DiscountChips, parseDiscount, discountLabel,
220
252
  PriceForm, parsePrice, LinePopover, type LinePopoverProps,
221
253
  ChargeForm, type ChargeFormProps,
222
- Catalogue, formatStockSyncTime, Receipt, injectPrintStyle, SyncStatus, OrdersList, type OrderHistoryRow, orderReference,
254
+ OrderNoteSheet, type OrderNoteSheetProps,
255
+ Catalogue, CatalogueSettingsForm, type CatalogueSettingsFormProps, formatStockSyncTime, Receipt, ReceiptSheet, type ReceiptSheetProps, type ReceiptSheetEmail, type ReceiptSheetTemplate, injectPrintStyle, SyncStatus, syncStatusQuiet, OrdersList, OrderSyncNotices, type OrderSyncNoticesProps, type OrderHistoryRow, orderReference,
223
256
  ParkedSales, type ParkedSalesProps, OpenSaleTabs, type OpenSaleTabsProps, CustomerDisplayScreen,
224
257
  CustomerDisplayPairing, type CustomerDisplayPairingProps,
225
- ProductFilterBar, DEFAULT_PRODUCT_FILTERS, PRODUCT_FILTER_CHIPS, type ProductFilterBarProps, type ProductFilterChip, type ProductFilters,
258
+ ProductFilterBar, DEFAULT_PRODUCT_FILTERS, PRODUCT_FILTER_CHIPS, type ProductFilterBarProps, type ProductFilterChip, type ProductFilters, type ProductTermFilter, type FilterOption,
226
259
  } from './sale';
260
+ export type { DiscountCoupon } from './sale/discount-form';
261
+ export { useTender, pickFigure, type TenderPicker } from './sale/use-tender';
227
262
 
228
263
  // Layout components
229
264
  export {
@@ -243,11 +278,14 @@ export {
243
278
  // App shell
244
279
  export {
245
280
  AppShell, type AppShellProps, NavRail, type NavRailProps, NavDrawer, type NavDrawerProps, type ShellNavItem,
281
+ ConnectivityToast, type ConnectivityToastProps,
282
+ AddedToCartToast, type AddedToCartToastProps, type AddedToCartEvent,
246
283
  } from './shell';
247
284
 
248
285
  // Reports components
249
286
  export {
250
287
  SalesRoom, type SalesRoomProps, SalesHero, type SalesHeroProps, SalesCards, type SalesCardsProps, type SalesCardId,
288
+ SalesCardPanel, type SalesCardPanelProps, type SalesPanelId,
251
289
  SalesFiltersBar, type SalesFiltersBarProps, type SalesFilters, type SalesOption,
252
290
  DateRangeMenu, type DateRangeMenuProps,
253
291
  } from './reports';
@@ -0,0 +1,21 @@
1
+ // Port of WCPOS v2 (monorepo main) packages/components/src/lib/decimal-entry.ts and keypad/index.tsx's decimalRow; MIT, WCPOS.
2
+ import { DIGIT_ROWS, type KeypadKey } from './keypad';
3
+
4
+ export const BACKSPACE: KeypadKey = { name: 'backspace', label: 'Delete last digit', text: '⌫' };
5
+
6
+ /** v2's typeDecimal: `separator` once and only with places, a digit past the places refused, a lone 0 replaced. */
7
+ export function typeDecimal(buffer: string, key: string, places: number, separator = '.'): string {
8
+ if (key === 'backspace') return buffer.slice(0, -1);
9
+ if (key === 'decimal') return places > 0 && !buffer.includes(separator) ? `${buffer || '0'}${separator}` : buffer;
10
+ if (!/^[0-9]$/.test(key)) return buffer;
11
+ const point = buffer.indexOf(separator);
12
+ if (point >= 0) return buffer.length - point > places ? buffer : buffer + key;
13
+ return buffer === '0' ? key : buffer + key;
14
+ }
15
+
16
+ /** `DIGIT_ROWS` and the last row: the decimal key (`separator`), 0 and backspace with places; a wide 0 and backspace without. */
17
+ export function decimalRows(places: number, separator = '.'): KeypadKey[][] {
18
+ return [...DIGIT_ROWS, places
19
+ ? [{ name: 'decimal', label: 'Decimal point', text: separator }, { name: '0', label: '0' }, BACKSPACE]
20
+ : [{ name: '0', label: '0', span: 2 }, BACKSPACE]];
21
+ }
@@ -25,7 +25,7 @@ export function CheckoutLayout({
25
25
  const layout = layoutProp ?? (width >= breakpoint ? 'split' : 'stacked');
26
26
 
27
27
  return (
28
- <View className={cn('flex-1 bg-bg', className)} {...viewProps}>
28
+ <View className={cn('flex-1 bg-background', className)} {...viewProps}>
29
29
  {headerSlot && <View className="border-b border-border">{headerSlot}</View>}
30
30
 
31
31
  {layout === 'split' ? (
@@ -43,7 +43,7 @@ export function LiveTabScreen({
43
43
  const onPress = state === 'parked' ? onUseHere : onReload;
44
44
 
45
45
  return (
46
- <View className={cn('flex-1 items-center justify-center gap-4 bg-bg p-6', className)} {...viewProps}>
46
+ <View className={cn('flex-1 items-center justify-center gap-4 bg-background p-6', className)} {...viewProps}>
47
47
  <Text className="text-center text-lg font-bold text-foreground">{parkedTitle}</Text>
48
48
  <Text className="text-center text-sm text-muted-foreground">{body}</Text>
49
49
  <Pressable onPress={onPress} className="items-center rounded-lg bg-primary px-4 py-3">
@@ -1,7 +1,27 @@
1
- import { useState, type ReactNode } from 'react';
2
- import { Pressable, Text, View, useWindowDimensions, type ViewProps } from 'react-native';
1
+ import { useLayoutEffect, useRef, useState, type ReactNode } from 'react';
2
+ import { Animated, Platform, Pressable, Text, View, useWindowDimensions, type ViewProps } from 'react-native';
3
3
 
4
4
  import { cn } from '@tallyui/theme';
5
+ import { CROSSFADE } from '../lib/motion';
6
+ import { useReducedMotion } from '../lib/use-reduced-motion';
7
+ import { InCartBadge } from '../product/in-cart-badge';
8
+ import { GiftIcon, ShoppingCartIcon } from '../ui';
9
+
10
+ function useColumnFade(key: string, enabled: boolean) {
11
+ const opacity = useRef(new Animated.Value(1)).current;
12
+ const previousKey = useRef(key);
13
+ const reduced = useReducedMotion();
14
+ useLayoutEffect(() => {
15
+ if (key === previousKey.current) return;
16
+ previousKey.current = key;
17
+ if (!enabled || reduced !== false) { opacity.setValue(1); return; }
18
+ opacity.setValue(0);
19
+ const animation = Animated.timing(opacity, { toValue: 1, duration: CROSSFADE, useNativeDriver: Platform.OS !== 'web' });
20
+ animation.start();
21
+ return () => { animation.stop(); opacity.setValue(1); };
22
+ }, [key, enabled, reduced, opacity]);
23
+ return opacity;
24
+ }
5
25
 
6
26
  export interface POSLayoutProps extends Omit<ViewProps, 'children'> {
7
27
  browseSlot: ReactNode;
@@ -10,6 +30,20 @@ export interface POSLayoutProps extends Omit<ViewProps, 'children'> {
10
30
  layout?: 'split' | 'stacked';
11
31
  breakpoint?: number;
12
32
  className?: string;
33
+ /** Where the stacked layout's tabs sit. 'bottom' is v2's phone tab bar (Products / Cart, icons, both panes kept
34
+ * mounted). Default 'top', today's tabs. */
35
+ tabBar?: 'top' | 'bottom';
36
+ /** The cart's item count, shown over the Cart tab's icon in the bottom bar; hidden at 0 or undefined. */
37
+ cartCount?: number;
38
+ /** v2's checkout column (pos-columns.tsx:118-162). When given, its result takes the browse column's place and the
39
+ * browse slot is not rendered: in 'split' the cart column stays beside it (as the ledger); in 'stacked' it is the
40
+ * whole body, with no tabs or tab bar. It is called with the layout in force, so the app can give the pane its own
41
+ * ledger when the cart is not on screen. */
42
+ renderCheckout?: (layout: 'split' | 'stacked') => ReactNode;
43
+ /** v2 keys its checkout column by what it shows (pos-columns.tsx receipt:<uuid> / checkout / cart): a new key in
44
+ * split layout fades the column in as opening checkout does, e.g. `receipt:<order id>` when tender gives way to
45
+ * the receipt. Default: none, so only opening or closing checkout fades. */
46
+ columnKey?: string;
13
47
  }
14
48
 
15
49
  export function POSLayout({
@@ -19,21 +53,63 @@ export function POSLayout({
19
53
  layout: layoutProp,
20
54
  breakpoint = 768,
21
55
  className,
56
+ tabBar = 'top',
57
+ cartCount,
58
+ renderCheckout,
59
+ columnKey,
22
60
  ...viewProps
23
61
  }: POSLayoutProps) {
24
62
  const { width } = useWindowDimensions();
25
63
  const layout = layoutProp ?? (width >= breakpoint ? 'split' : 'stacked');
26
64
  const [activeTab, setActiveTab] = useState<'browse' | 'cart'>('browse');
65
+ const mode = renderCheckout ? 'checkout' : 'products';
66
+ const opacity = useColumnFade(columnKey ? `${mode}:${columnKey}` : mode, layout === 'split');
67
+ const checkout = (mode: 'split' | 'stacked') =>
68
+ <View testID="pos-checkout-column" className="flex-1 bg-card">{renderCheckout?.(mode)}</View>;
27
69
 
28
70
  return (
29
- <View className={cn('flex-1 bg-bg', className)} {...viewProps}>
71
+ <View className={cn('flex-1 bg-background', className)} {...viewProps}>
30
72
  {headerSlot && <View className="border-b border-border">{headerSlot}</View>}
31
73
 
32
74
  {layout === 'split' ? (
33
75
  <View className="flex-1 flex-row">
34
- <View className="flex-[3]">{browseSlot}</View>
76
+ <View className="flex-[3]">
77
+ <Animated.View testID="pos-column-fade" style={{ flex: 1, opacity }}>{renderCheckout ? checkout('split') : browseSlot}</Animated.View>
78
+ </View>
35
79
  <View className="flex-[2] border-l border-border">{cartSlot}</View>
36
80
  </View>
81
+ ) : renderCheckout ? (
82
+ checkout('stacked')
83
+ ) : tabBar === 'bottom' ? (
84
+ // v2's phone tab bar (apps/main/components/pos-phone-tab-bar.tsx). Both panes stay mounted, as v2's
85
+ // `lazy: false` keeps both tabs: the scan handler lives in Products and the cart keeps its state.
86
+ <>
87
+ <View className="flex-1">
88
+ <View className={activeTab === 'browse' ? 'flex-1' : 'hidden'}>{browseSlot}</View>
89
+ <View className={activeTab === 'cart' ? 'flex-1' : 'hidden'}>{cartSlot}</View>
90
+ </View>
91
+ <View testID="pos-tab-bar" className="border-t border-border bg-card">
92
+ <View role="tablist" className="flex-row justify-around py-2">
93
+ {(['browse', 'cart'] as const).map((tab) => {
94
+ const active = activeTab === tab;
95
+ const Icon = tab === 'browse' ? GiftIcon : ShoppingCartIcon;
96
+ const tone = active ? 'text-primary' : 'text-muted-foreground';
97
+ return (
98
+ <Pressable key={tab} role="tab" aria-selected={active} onPress={() => setActiveTab(tab)}
99
+ testID={tab === 'browse' ? 'pos-tab-products' : 'pos-tab-cart'} className="flex-1 items-center gap-1 py-2">
100
+ <View className="relative">
101
+ <Icon size={20} className={tone} />
102
+ {tab === 'cart' && cartCount !== undefined && cartCount > 0 ? (
103
+ <InCartBadge count={cartCount} testID="pos-tab-cart-count" className="absolute -top-2 left-3" />
104
+ ) : null}
105
+ </View>
106
+ <Text className={cn('text-xs', tone)}>{tab === 'browse' ? 'Products' : 'Cart'}</Text>
107
+ </Pressable>
108
+ );
109
+ })}
110
+ </View>
111
+ </View>
112
+ </>
37
113
  ) : (
38
114
  <>
39
115
  <View className="flex-row border-b border-border">
@@ -26,7 +26,7 @@ export function SettingsLayout({
26
26
  const [showNav, setShowNav] = useState(false);
27
27
 
28
28
  return (
29
- <View className={cn('flex-1 bg-bg', className)} {...viewProps}>
29
+ <View className={cn('flex-1 bg-background', className)} {...viewProps}>
30
30
  {headerSlot && <View className="border-b border-border">{headerSlot}</View>}
31
31
 
32
32
  {layout === 'split' ? (
@@ -90,7 +90,7 @@ export function StoreSettingsChoiceScreen({
90
90
  };
91
91
 
92
92
  return (
93
- <View className={cn('w-full max-w-[560px] flex-1 self-center gap-6 bg-bg p-6', className)} {...viewProps}>
93
+ <View className={cn('w-full max-w-[560px] flex-1 self-center gap-6 bg-background p-6', className)} {...viewProps}>
94
94
  <View className="gap-2">
95
95
  <Text className="text-lg font-bold text-foreground">{title}</Text>
96
96
  <Text className="text-sm text-muted-foreground">{body}</Text>
@@ -0,0 +1,13 @@
1
+ import { cn } from '@tallyui/theme';
2
+
3
+ /**
4
+ * Port of WCPOS v2 `packages/components/src/lib/current-row.ts`.
5
+ * The one mark for the current row (component-consistency decision 11): `true` paints the row
6
+ * `bg-muted` with a 2 pt primary bar on its left edge; `false` keeps the bar's room transparent,
7
+ * so a list's content lines up either way; unset draws no bar. Padding is the caller's: a row that
8
+ * pads its content takes the bar's 2 back from its left padding.
9
+ */
10
+ export function currentRowMark(selected: boolean | undefined): string | undefined {
11
+ if (selected === undefined) return undefined;
12
+ return cn('border-l-2', selected ? 'border-l-primary bg-muted' : 'border-l-transparent');
13
+ }
@@ -0,0 +1,16 @@
1
+ import { minorUnitDigits, normalizeMoneyText, type MoneyFormat } from '@tallyui/core';
2
+
3
+ /** Minor units as input text: sign, no grouping, the currency's places, in the store's decimal separator ('.' without one). */
4
+ export function moneyInputText(minor: number, currency: string, format?: MoneyFormat): string {
5
+ const digits = minorUnitDigits(currency);
6
+ const text = String(Math.abs(minor)).padStart(digits + 1, '0');
7
+ const separator = format?.decimalSeparator || '.';
8
+ return (minor < 0 ? '-' : '') + (digits ? `${text.slice(0, -digits)}${separator}${text.slice(-digits)}` : text);
9
+ }
10
+
11
+ /** Typed text as canonical text for the pos helpers (unchanged without a format); undefined is refused text. */
12
+ export function readMoneyText(text: string, format?: MoneyFormat): string | undefined {
13
+ if (!format) return text;
14
+ const canonical = normalizeMoneyText(text, format);
15
+ return /^-?\d+(\.\d+)?$/.test(canonical) ? canonical : undefined;
16
+ }
@@ -0,0 +1,22 @@
1
+ import { Easing } from 'react-native';
2
+
3
+ // WCPOS v2 packages/components/src/lib/motion.ts:6.
4
+ export const COUNT_SWELL = 90;
5
+ // WCPOS v2 packages/components/src/lib/motion.ts:7.
6
+ export const COUNT_FADE = 170;
7
+ // WCPOS v2 packages/components/src/lib/motion.ts:12.
8
+ export const POPOVER_FADE = 200;
9
+ // WCPOS v2 packages/components/src/lib/motion.ts:18.
10
+ export const PANEL_SLIDE_OUT = 200;
11
+ // WCPOS v2 packages/components/src/lib/motion.ts:33-34.
12
+ export const EASE_EXIT = Easing.bezier(0.4, 0, 1, 1);
13
+ // WCPOS v2 packages/core/src/screens/main/pos/cart/cells/line-strip.tsx:64-69: a pressed Remove waits this long before the row flies.
14
+ export const ARM = 120;
15
+ // WCPOS v2 packages/components/src/lib/motion.ts:27.
16
+ export const EASE_POINTS = [0.2, 0.7, 0.2, 1] as const;
17
+ // WCPOS v2 packages/components/src/lib/motion.ts:28.
18
+ export const EASE = Easing.bezier(...EASE_POINTS);
19
+ // WCPOS v2 packages/components/src/lib/motion.ts:9.
20
+ export const CROSSFADE = 200;
21
+ // Reanimated 4.7.1 withTiming's default easing (src/animation/timing.ts:91), which v2's accordion chevron uses.
22
+ export const TIMING_EASE = Easing.inOut(Easing.quad);
@@ -0,0 +1,20 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { AccessibilityInfo } from 'react-native';
3
+
4
+ /** Reads prefers-reduced-motion on web and the OS setting on native; null means not known yet. */
5
+ export function useReducedMotion(): boolean | null {
6
+ const [reduced, setReduced] = useState<boolean | null>(null);
7
+ useEffect(() => {
8
+ let active = true;
9
+ AccessibilityInfo.isReduceMotionEnabled().then((value) => {
10
+ if (active) setReduced(value);
11
+ });
12
+ const subscription = AccessibilityInfo.addEventListener('reduceMotionChanged', setReduced) as
13
+ { remove(): void } | undefined;
14
+ return () => {
15
+ active = false;
16
+ subscription?.remove();
17
+ };
18
+ }, []);
19
+ return reduced;
20
+ }
@@ -1,7 +1,7 @@
1
1
  export { OrderStatusBadge, type OrderStatusBadgeProps, type OrderStatus } from './order-status-badge';
2
2
  export { OrderCard, type OrderCardProps } from './order-card';
3
3
  export { OrderList, type OrderListProps } from './order-list';
4
- export { OrderDetail, type OrderDetailProps, type OrderDetailLineItem } from './order-detail';
4
+ export { OrderDetail, type OrderDetailProps, type OrderDetailLineItem, type OrderDetailTaxLine } from './order-detail';
5
5
  export { RefundForm, type RefundFormProps, type RefundFormValue } from './refund-form';
6
6
  export { RefundModal, type RefundModalProps } from './refund-modal';
7
7
  export { OrderFilterBar, type OrderFilterBarProps, type OrderFilterOption, type PaymentMethodKind } from './order-filter-bar';