@tallyui/components 3.14.0 → 3.16.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.
- package/dist/index.d.ts +107 -4
- package/dist/index.js +1689 -1343
- package/package.json +11 -9
- package/src/cart/cart-foot.tsx +82 -0
- package/src/cart/cart-line.tsx +8 -3
- package/src/cart/index.ts +1 -0
- package/src/i18n/index.tsx +78 -0
- package/src/i18n/locales/en/components.json +30 -0
- package/src/index.ts +11 -1
- package/src/input/index.ts +1 -0
- package/src/input/keypad.tsx +38 -0
- package/src/sale/cart.tsx +29 -13
- package/src/sale/index.ts +1 -0
- package/src/sale/line-popover.tsx +145 -0
- package/src/sale/price-form.tsx +19 -10
- package/src/sale/tender-pane.tsx +36 -41
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { TextClassContext } from '@tallyui/primitives';
|
|
|
11
11
|
import { ScaleOverride, ScaleVariables, ScaleStep, Pointer, TypeSetId, ThemeFontFamily, ThemeType } from '@tallyui/theme';
|
|
12
12
|
import { CatalogueView, ProductSortValue, ProductSort, RefundableOrderLine, EarlierRefund, useRegisterSession, RegisterSession, MovementType, ApprovalNeeded, SwitchKind, SwitchWarnings, HandoverSlipData, AppSettings, useAppSettings, useSale, TenderState, TenderAction, AppliedDiscount, Discount, CatalogueEntry, CatalogueViewState, CartQuantityLine, SentOrder, PosOrder, ReceiptData, OutboxState, ParkedOrderSummary, OpenSale, DisplayState, SalesFigures, DatePreset, DayRange } from '@tallyui/pos';
|
|
13
13
|
import { ProductTraits, TraitContext, Money, CustomerTraits, Customer, CustomerInput, OrderRefundPayload, PaymentMethodDescriptor, ProductCategory, SyncNotice, StoreSettingsChoices, StoreSettingsChoice } from '@tallyui/core';
|
|
14
|
+
import { TFunction } from 'i18next';
|
|
14
15
|
|
|
15
16
|
declare const textVariants: (props?: ({
|
|
16
17
|
variant?: "link" | "default" | null | undefined;
|
|
@@ -661,6 +662,10 @@ interface CartLineProps extends Omit<HStackProps, 'children'> {
|
|
|
661
662
|
lineTotal: Money;
|
|
662
663
|
/** Show the Price column (default true); the Cart passes false on a narrow cart or a phone, as CartColumnHeads does. */
|
|
663
664
|
showPrice?: boolean;
|
|
665
|
+
/** Replaces the quantity's text, e.g. a LinePopover that edits it (Cart's `lineEditor="popover"`). */
|
|
666
|
+
quantitySlot?: ReactNode;
|
|
667
|
+
/** Replaces the unit price's text (the struck regular price stays above it). */
|
|
668
|
+
priceSlot?: ReactNode;
|
|
664
669
|
locale?: string;
|
|
665
670
|
className?: string;
|
|
666
671
|
}
|
|
@@ -672,7 +677,7 @@ interface CartLineProps extends Omit<HStackProps, 'children'> {
|
|
|
672
677
|
* <CartLine name="Coffee" quantity={2} unitPrice={unitPrice} lineTotal={lineTotal} />
|
|
673
678
|
* ```
|
|
674
679
|
*/
|
|
675
|
-
declare function CartLine({ name, attributes, quantity, unitPrice, regularUnitPrice, lineTotal, showPrice, locale, className, ...props }: CartLineProps): react_jsx_runtime.JSX.Element;
|
|
680
|
+
declare function CartLine({ name, attributes, quantity, unitPrice, regularUnitPrice, lineTotal, showPrice, quantitySlot, priceSlot, locale, className, ...props }: CartLineProps): react_jsx_runtime.JSX.Element;
|
|
676
681
|
|
|
677
682
|
interface CartColumnHeadsProps extends Omit<ViewProps, 'children'> {
|
|
678
683
|
/** Show the Price head (default true); pass the same value as each CartLine's `showPrice`. */
|
|
@@ -759,6 +764,32 @@ interface CartLineActionsProps extends Omit<ViewProps, 'children'> {
|
|
|
759
764
|
}
|
|
760
765
|
declare function CartLineActions({ children, actions, className, ...viewProps }: CartLineActionsProps): react_jsx_runtime.JSX.Element;
|
|
761
766
|
|
|
767
|
+
interface CartFootAction {
|
|
768
|
+
label: string;
|
|
769
|
+
onPress: () => void;
|
|
770
|
+
/** Shown in the destructive colour, e.g. a Void. */
|
|
771
|
+
destructive?: boolean;
|
|
772
|
+
}
|
|
773
|
+
interface CartFootProps {
|
|
774
|
+
total: Money;
|
|
775
|
+
onCheckout: () => void;
|
|
776
|
+
/** The ⋮ menu's items; the ⋮ is left out when there are none. */
|
|
777
|
+
actions?: readonly CartFootAction[];
|
|
778
|
+
/** Disables Checkout only; the menu stays usable. */
|
|
779
|
+
disabled?: boolean;
|
|
780
|
+
locale?: string;
|
|
781
|
+
className?: string;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* The cart's foot: a ⋮ menu of the host's actions beside one "Checkout {total}" button, as in WCPOS v2.
|
|
785
|
+
* v2's ⋮ opens its Order details sheet; here the host passes the items, so it can pass one that opens its own sheet.
|
|
786
|
+
*
|
|
787
|
+
* ```tsx
|
|
788
|
+
* <CartFoot total={total} onCheckout={startCheckout} actions={[{ label: 'Void', onPress: voidSale, destructive: true }]} />
|
|
789
|
+
* ```
|
|
790
|
+
*/
|
|
791
|
+
declare function CartFoot({ total, onCheckout, actions, disabled, locale, className }: CartFootProps): react_jsx_runtime.JSX.Element;
|
|
792
|
+
|
|
762
793
|
interface SearchInputProps extends Omit<TextInputProps, 'value' | 'onChangeText'> {
|
|
763
794
|
value: string;
|
|
764
795
|
onChangeText: (text: string) => void;
|
|
@@ -804,6 +835,28 @@ interface QuantityStepperProps extends Omit<ViewProps, 'children'> {
|
|
|
804
835
|
}
|
|
805
836
|
declare function QuantityStepper({ defaultQuantity, quantity: controlledQuantity, onChangeQuantity, min, max, className, ...viewProps }: QuantityStepperProps): react_jsx_runtime.JSX.Element;
|
|
806
837
|
|
|
838
|
+
interface KeypadKey {
|
|
839
|
+
/** What a press reports: a digit, `decimal`, `backspace`, or the caller's own key. */
|
|
840
|
+
name: string;
|
|
841
|
+
/** The accessible name: the digit, or the caller's own ("Delete last digit"). */
|
|
842
|
+
label: string;
|
|
843
|
+
/** The key's text when it is not its label (`⌫`, named "Delete last digit"). */
|
|
844
|
+
text?: string;
|
|
845
|
+
/** The cells the key takes in its row (default 1). */
|
|
846
|
+
span?: number;
|
|
847
|
+
}
|
|
848
|
+
interface KeypadProps {
|
|
849
|
+
rows: readonly (readonly KeypadKey[])[];
|
|
850
|
+
onPress: (name: string) => void;
|
|
851
|
+
/** A key is `<testID>-key-<name>`. */
|
|
852
|
+
testID?: string;
|
|
853
|
+
className?: string;
|
|
854
|
+
}
|
|
855
|
+
/** v2's DIGIT_ROWS: 123 / 456 / 789; the caller adds its own last row. */
|
|
856
|
+
declare const DIGIT_ROWS: KeypadKey[][];
|
|
857
|
+
/** Rows of keys with no display or value, as v2's Keypad: the caller owns the entry. */
|
|
858
|
+
declare function Keypad({ rows, onPress, testID, className }: KeypadProps): react_jsx_runtime.JSX.Element;
|
|
859
|
+
|
|
807
860
|
interface CustomerCardProps<Doc = any> extends Omit<VStackProps, 'children'> {
|
|
808
861
|
doc: Doc;
|
|
809
862
|
traits?: CustomerTraits<Doc>;
|
|
@@ -1475,7 +1528,7 @@ interface DisplaySettingsProps {
|
|
|
1475
1528
|
declare function DisplaySettings({ settings, setSetting, className }: DisplaySettingsProps): JSX.Element;
|
|
1476
1529
|
|
|
1477
1530
|
/** `taxLabel` names each tax row; VAT isn't universal, so a platform passes its own (medusapos passes `VAT ${rate}%`). */
|
|
1478
|
-
declare function Cart({ sale, taxLabel, canEditPrice, onPriceChange, quickDiscounts, taxClasses, afterSubtotal, couponDiscountMinor, orderActions }: {
|
|
1531
|
+
declare function Cart({ sale, taxLabel, canEditPrice, onPriceChange, quickDiscounts, taxClasses, afterSubtotal, couponDiscountMinor, orderActions, checkout, lineEditor }: {
|
|
1479
1532
|
sale: ReturnType<typeof useSale>;
|
|
1480
1533
|
taxLabel?: (ratePpm: number) => string;
|
|
1481
1534
|
taxClasses?: ReadonlyArray<{
|
|
@@ -1502,6 +1555,15 @@ declare function Cart({ sale, taxLabel, canEditPrice, onPriceChange, quickDiscou
|
|
|
1502
1555
|
/** Cart's own Order discount and Add charge controls; pass `false` when the app hosts them in its own menu (v2's
|
|
1503
1556
|
* cart "+" menu). Applied discounts and charges still show and can be removed. */
|
|
1504
1557
|
orderActions?: boolean;
|
|
1558
|
+
/** Swaps the Cash and Card terminal row for v2's foot, `CartFoot`: "Checkout {total}" calls `onCheckout`, and the
|
|
1559
|
+
* ⋮ menu lists `actions`. Absent: the Cash and Card terminal row. */
|
|
1560
|
+
checkout?: {
|
|
1561
|
+
onCheckout: () => void;
|
|
1562
|
+
actions?: readonly CartFootAction[];
|
|
1563
|
+
};
|
|
1564
|
+
/** `popover`: tapping a line's quantity or price opens v2's keypad (WCPOS cart cells/quantity-keypad.tsx and
|
|
1565
|
+
* cells/price.tsx), the price one with the quick-discount keys. Default `inline`: the − / + buttons and Price form. */
|
|
1566
|
+
lineEditor?: 'inline' | 'popover';
|
|
1505
1567
|
}): react_jsx_runtime.JSX.Element;
|
|
1506
1568
|
|
|
1507
1569
|
/** Phone mode's cart summary (medusapos ADR 0009): the whole bar is one button; the total is the cart's own Total row. */
|
|
@@ -1523,7 +1585,7 @@ declare function SplitTender(props: TenderProps): JSX.Element;
|
|
|
1523
1585
|
/**
|
|
1524
1586
|
* The tender pane, laid out as WCPOS v2's (monorepo main, packages/core/src/screens/main/pos/checkout/tender/):
|
|
1525
1587
|
* BalanceHeadline and LedgerLegs from ledger-pane.tsx, then the method tiles, entry, quick-cash chips,
|
|
1526
|
-
* keypad and commit from tender-pane.tsx's TenderKeypad. Copy is v2's
|
|
1588
|
+
* keypad and commit from tender-pane.tsx's TenderKeypad. Copy is read with useT, under v2's catalogue keys. Every figure
|
|
1527
1589
|
* comes from pos (useSale's captured-only totals, tenderRounding, quickTenderedAmounts, planLegs).
|
|
1528
1590
|
*/
|
|
1529
1591
|
|
|
@@ -1576,6 +1638,27 @@ declare function PriceForm({ lineName, currency, currentMinor, onApply, onClose,
|
|
|
1576
1638
|
quickDiscounts?: readonly number[];
|
|
1577
1639
|
}): JSX.Element;
|
|
1578
1640
|
|
|
1641
|
+
interface LinePopoverProps {
|
|
1642
|
+
/** `quantity` takes whole numbers only, with no decimal key (decimal quantities need an ADR first, TallyUI#486). */
|
|
1643
|
+
kind: 'quantity' | 'price';
|
|
1644
|
+
lineName: string;
|
|
1645
|
+
/** The order's currency: the price's format and its decimal places. */
|
|
1646
|
+
currency: string;
|
|
1647
|
+
/** The stored quantity, or the unit price in integer minor units. */
|
|
1648
|
+
value: number;
|
|
1649
|
+
/** Writes the new value; returns a refusal to show, or null once applied. */
|
|
1650
|
+
onApply: (value: number) => string | null;
|
|
1651
|
+
/** Price only: v2's quick-discount keys, the first three valid percentages (as PriceForm's). */
|
|
1652
|
+
quickDiscounts?: readonly number[];
|
|
1653
|
+
/** The trigger's text classes (the cell's alignment and tone). */
|
|
1654
|
+
textClassName?: string;
|
|
1655
|
+
}
|
|
1656
|
+
/**
|
|
1657
|
+
* A cart line's quantity or price that opens v2's keypad: the cashier types (or picks a quick discount),
|
|
1658
|
+
* Apply writes through `onApply`, and Cancel, Escape or a press outside close without writing.
|
|
1659
|
+
*/
|
|
1660
|
+
declare function LinePopover({ kind, lineName, currency, value, onApply, quickDiscounts, textClassName }: LinePopoverProps): react_jsx_runtime.JSX.Element;
|
|
1661
|
+
|
|
1579
1662
|
interface ChargeFormProps {
|
|
1580
1663
|
currency: string;
|
|
1581
1664
|
lineTax?: {
|
|
@@ -2042,4 +2125,24 @@ interface FontProviderProps {
|
|
|
2042
2125
|
declare function FontProvider({ font, autoTypeSet, loadFonts, children }: FontProviderProps): React$1.JSX.Element;
|
|
2043
2126
|
declare function useFontType(): FontState;
|
|
2044
2127
|
|
|
2045
|
-
|
|
2128
|
+
/**
|
|
2129
|
+
* Port of WCPOS v2 (MIT) `packages/core/src/contexts/translations/index.tsx`: one i18next instance per
|
|
2130
|
+
* provider, a locale change applied with `changeLanguage`, v2's init options and `useT`. The regional
|
|
2131
|
+
* fallback (`fr_CA` → `fr`) is v2's `rxdb-backend.ts` `getBaseLanguage`, as `fallbackLng`. There is no
|
|
2132
|
+
* backend: English is bundled and the app passes other languages as `resources`.
|
|
2133
|
+
*/
|
|
2134
|
+
|
|
2135
|
+
/** Catalogues by language code, as the app spells it (`fr`, `fr_CA`, `fr-CA`): key → string. */
|
|
2136
|
+
type Catalogues = Record<string, Record<string, string>>;
|
|
2137
|
+
interface I18nProviderProps {
|
|
2138
|
+
/** The store's locale (`fr_CA` or `fr-CA`). Without one, the device's locale. */
|
|
2139
|
+
locale?: string;
|
|
2140
|
+
/** Other languages' catalogues; English is bundled. May arrive or change after mount. */
|
|
2141
|
+
resources?: Catalogues;
|
|
2142
|
+
children: React$1.ReactNode;
|
|
2143
|
+
}
|
|
2144
|
+
declare function I18nProvider({ locale, resources, children }: I18nProviderProps): React$1.JSX.Element;
|
|
2145
|
+
/** The components' `t`, read from the nearest `I18nProvider`, else English. Interpolation is `{name}`. */
|
|
2146
|
+
declare function useT(): TFunction;
|
|
2147
|
+
|
|
2148
|
+
export { APPROVAL_REQUIRED_TEXT, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppShell, type AppShellProps, Avatar, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Cart, type CartAction, CartBar, CartColumnHeads, type CartColumnHeadsProps, CartFoot, type CartFootAction, type CartFootProps, CartLine, CartLineActions, type CartLineActionsProps, type CartLineProps, CartNoteInput, type CartNoteInputProps, CartPanel, type CartPanelProps, CartTotal, type CartTotalProps, CashCountInput, type CashCountInputProps, CashTendered, type CashTenderedProps, Catalogue, type Catalogues, type CategoryItem, CategoryNav, type CategoryNavProps, CategoryTile, type CategoryTileProps, ChangeDisplay, type ChangeDisplayProps, ChargeForm, type ChargeFormProps, Checkbox, CheckoutLayout, type CheckoutLayoutProps, type ChipItem, ClosureSheet, type ClosureSheetProps, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxTrigger, type ConnectionStatus, ConnectorStatus, type ConnectorStatusProps, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CustomerCard, type CustomerCardProps, CustomerDisplayScreen, CustomerForm, type CustomerFormProps, type CustomerFormValues, CustomerOrderHistory, type CustomerOrderHistoryProps, CustomerPicker, type CustomerPickerProps, CustomerSelect, type CustomerSelectProps, DEFAULT_PRODUCT_FILTERS, DIGIT_ROWS, type Denomination, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiscountBadge, type DiscountBadgeProps, DiscountChips, DiscountForm, DisplaySettings, type DisplaySettingsProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FilterChip, FilterChipGroup, type FilterChipGroupProps, type FilterChipProps, FontProvider, type FontProviderProps, type FontState, type FontStatus, HStack, type HStackProps, HandoverSlip, type HandoverSlipProps, HoverCard, HoverCardContent, HoverCardTrigger, I18nProvider, type I18nProviderProps, Icon, IconButton, type IconButtonProps, type IconProps, InCartBadge, type InCartBadgeProps, Input, InputField, InputRoot, type InputRootProps, InputSlot, Keypad, type KeypadKey, type KeypadProps, Label, type LabelProps, LinePopover, type LinePopoverProps, LiveTabScreen, type LiveTabScreenProps, type LiveTabScreenState, Loader, type LoaderProps, MovementSheet, type MovementSheetProps, NavDrawer, type NavDrawerProps, NavRail, type NavRailProps, OpenRegisterCard, type OpenRegisterCardProps, OpenSaleTabs, type OpenSaleTabsProps, OrderCard, type OrderCardProps, OrderDetail, type OrderDetailLineItem, type OrderDetailProps, type OrderHistoryRow, OrderList, type OrderListProps, type OrderStatus, OrderStatusBadge, type OrderStatusBadgeProps, OrderSummary, OrderSummaryLine, type OrderSummaryLineProps, type OrderSummaryPayment, type OrderSummaryProps, OrdersList, POSLayout, type POSLayoutProps, PRODUCT_FILTER_CHIPS, ParkedSales, type ParkedSalesProps, type PaymentMethod, PaymentMethodCard, type PaymentMethodCardProps, PaymentSelector, type PaymentSelectorProps, Popover, PopoverContent, PopoverTrigger, PriceForm, ProductCard, type ProductCardProps, ProductFilterBar, type ProductFilterBarProps, type ProductFilterChip, type ProductFilters, ProductGrid, type ProductGridProps, ProductImage, type ProductImageProps, ProductList, type ProductListProps, ProductPrice, type ProductPriceProps, ProductSku, type ProductSkuProps, ProductStockBadge, type ProductStockBadgeProps, ProductTable, type ProductTableColumn, type ProductTableProps, ProductTitle, type ProductTitleProps, ProductVariantPicker, type ProductVariantPickerProps, Progress, type ProgressProps, QuantityStepper, type QuantityStepperProps, RadioGroup, RadioGroupItem, Receipt, type ReceiptItem, ReceiptPreview, type ReceiptPreviewProps, RefundForm, type RefundFormProps, type RefundFormValue, RefundModal, type RefundModalProps, RegisterBar, type RegisterBarPill, type RegisterBarProps, RegisterColumn, type RegisterColumnProps, RegisterCount, type RegisterCountProps, RegisterOpenClose, type RegisterOpenCloseProps, RegisterPanel, type RegisterPanelProps, RegisterPicker, type RegisterPickerProps, type RegisterPickerRegister, RegisterSummary, type RegisterSummaryProps, type SalesCardId, SalesCards, type SalesCardsProps, type SalesFilters, SalesFiltersBar, type SalesFiltersBarProps, SalesHero, type SalesHeroProps, type SalesOption, SalesRoom, type SalesRoomProps, ScaleProvider, type ScaleProviderProps, type ScaleScopeProps, type ScaleState, SearchIcon, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, type SeparatorProps, SettingsGroup, type SettingsGroupProps, SettingsLayout, type SettingsLayoutProps, SettingsRow, type SettingsRowProps, type ShellNavItem, Slider, type SliderProps, SplitTender, StoreSettingsChoiceScreen, type StoreSettingsChoiceScreenProps, type SvgIconProps, Switch, SwitchConfirm, type SwitchConfirmProps, SyncStatus, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tender, TenderPane, type TenderPaneProps, Text, type TextProps, Textarea, type TextareaProps, Toast, ToastClose, ToastDescription, type ToastProps, ToastTitle, Toggle, ToggleGroup, ToggleGroupItem, type ToggleGroupItemProps, type ToggleGroupProps, type ToggleProps, Tooltip, TooltipContent, TooltipTrigger, type TransactionSummary, VStack, type VStackProps, type VariantOption, ViewToggle, type ViewToggleProps, XIcon, avatarVariants, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, createSvgIcon, defaultProductColumns, describeRegisterBarPill, discountLabel, formatStockSyncTime, hstackVariants, iconButtonVariants, iconVariants, injectPrintStyle, loaderVariants, orderReference, parseDiscount, parsePrice, textVariants, toastVariants, toggleTextVariants, toggleVariants, useDefaultProductColumns, useFontType, useInputContext, usePointer, useScale, useT, vstackVariants };
|