@tallyui/components 2.0.0 → 3.0.0-next.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 CHANGED
@@ -8,8 +8,8 @@ import { VariantProps } from 'class-variance-authority';
8
8
  import { SvgProps } from 'react-native-svg';
9
9
  import { Separator as Separator$1, Label as Label$1, Tabs as Tabs$1, Dialog as Dialog$1, AlertDialog as AlertDialog$1, Select as Select$1, Combobox as Combobox$1, DropdownMenu as DropdownMenu$1, ContextMenu as ContextMenu$1, Popover as Popover$1, Tooltip as Tooltip$1, HoverCard as HoverCard$1, Accordion as Accordion$1, Collapsible as Collapsible$1, Checkbox as Checkbox$1, Switch as Switch$1, RadioGroup as RadioGroup$1, Toggle as Toggle$1, ToggleGroup as ToggleGroup$1, Progress as Progress$1, Slider as Slider$1, Image } from '@tallyui/primitives';
10
10
  export { TextClassContext } from '@tallyui/primitives';
11
- import { Money, ProductTraits, StoreSettingsChoices, StoreSettingsChoice } from '@tallyui/core';
12
- import { useRegisterSession, MovementType, useSale, AppliedDiscount, Discount, CatalogueEntry, Order, OutboxState, PosOrder } from '@tallyui/pos';
11
+ import { Money, CustomerTraits, Customer, CustomerInput, ProductTraits, SyncNotice, StoreSettingsChoices, StoreSettingsChoice } from '@tallyui/core';
12
+ import { useRegisterSession, MovementType, useSale, AppliedDiscount, Discount, CatalogueEntry, SentOrder, OutboxState, PosOrder } from '@tallyui/pos';
13
13
 
14
14
  declare const textVariants: (props?: ({
15
15
  variant?: "link" | "default" | null | undefined;
@@ -481,10 +481,9 @@ interface ProductGridProps extends Omit<VStackProps, 'children'> {
481
481
  className?: string;
482
482
  }
483
483
  /**
484
- * A scrollable product grid with optional search and filter slots.
484
+ * A virtualized product grid with optional search and filter slots.
485
485
  *
486
- * Uses ScrollView + flexWrap for cross-platform grid layout rather than
487
- * FlatList numColumns, which keeps things predictable in both native and web.
486
+ * Uses FlatList numColumns to render rows near the viewport on native and web.
488
487
  *
489
488
  * ```tsx
490
489
  * <ProductGrid
@@ -663,19 +662,21 @@ interface QuantityStepperProps extends Omit<ViewProps, 'children'> {
663
662
  }
664
663
  declare function QuantityStepper({ defaultQuantity, quantity: controlledQuantity, onChangeQuantity, min, max, className, ...viewProps }: QuantityStepperProps): react_jsx_runtime.JSX.Element;
665
664
 
666
- interface CustomerCardProps extends Omit<VStackProps, 'children'> {
667
- doc: any;
665
+ interface CustomerCardProps<Doc = any> extends Omit<VStackProps, 'children'> {
666
+ doc: Doc;
667
+ traits?: CustomerTraits<Doc>;
668
668
  className?: string;
669
669
  }
670
- declare function CustomerCard({ doc, className, ...props }: CustomerCardProps): react_jsx_runtime.JSX.Element | null;
670
+ declare function CustomerCard<Doc>({ doc, traits, className, ...props }: CustomerCardProps<Doc>): react_jsx_runtime.JSX.Element;
671
671
 
672
- interface CustomerSelectProps extends Omit<VStackProps, 'children'> {
672
+ interface CustomerSelectProps<Doc = any> extends Omit<VStackProps, 'children'> {
673
673
  /** Customer documents to display as options */
674
- customers: any[];
674
+ customers: Doc[];
675
675
  /** Currently selected customer (if any) */
676
- selected?: any;
676
+ selected?: Doc | null;
677
677
  /** Called when a customer is selected */
678
- onSelect: (customer: any) => void;
678
+ onSelect: (customer: Doc) => void;
679
+ traits?: CustomerTraits<Doc>;
679
680
  /** Called when the search text changes */
680
681
  onSearch: (query: string) => void;
681
682
  /** Placeholder text for the search input */
@@ -702,7 +703,7 @@ interface CustomerSelectProps extends Omit<VStackProps, 'children'> {
702
703
  * />
703
704
  * ```
704
705
  */
705
- declare function CustomerSelect({ customers, selected, onSelect, onSearch, placeholder, className, ...props }: CustomerSelectProps): react_jsx_runtime.JSX.Element;
706
+ declare function CustomerSelect<Doc>(props: CustomerSelectProps<Doc>): react_jsx_runtime.JSX.Element;
706
707
 
707
708
  interface CustomerFormValues {
708
709
  firstName: string;
@@ -716,9 +717,10 @@ interface CustomerFormProps extends Omit<ViewProps, 'children'> {
716
717
  onChangeField: (field: keyof CustomerFormValues, value: string) => void;
717
718
  onSubmit?: () => void;
718
719
  submitLabel?: string;
720
+ showAddress?: boolean;
719
721
  className?: string;
720
722
  }
721
- declare function CustomerForm({ values, onChangeField, onSubmit, submitLabel, className, ...viewProps }: CustomerFormProps): react_jsx_runtime.JSX.Element;
723
+ declare function CustomerForm({ values, onChangeField, onSubmit, submitLabel, showAddress, className, ...viewProps }: CustomerFormProps): react_jsx_runtime.JSX.Element;
722
724
 
723
725
  interface CustomerOrderHistoryProps extends Omit<ViewProps, 'children'> {
724
726
  orders: any[];
@@ -728,6 +730,23 @@ interface CustomerOrderHistoryProps extends Omit<ViewProps, 'children'> {
728
730
  }
729
731
  declare function CustomerOrderHistory({ orders, renderItem, emptyState, className, ...viewProps }: CustomerOrderHistoryProps): react_jsx_runtime.JSX.Element;
730
732
 
733
+ interface CustomerPickerProps {
734
+ /** The connector's searchCustomers, bound to its context by the app. */
735
+ search: (query: string) => Promise<Customer[]>;
736
+ /** The connector's createCustomer, bound; absent hides "New customer". */
737
+ create?: (input: CustomerInput) => Promise<Customer>;
738
+ selected: Customer | null;
739
+ onSelect: (customer: Customer | null) => void;
740
+ /** Called for errors the picker can't explain to the cashier, including ConnectorUnauthorizedError, which means the app should sign in again. */
741
+ onError?: (error: unknown) => void;
742
+ /** false disables search and create (online only in v1). */
743
+ online: boolean;
744
+ /** Debounce before a search, ms. */
745
+ debounceMs?: number;
746
+ className?: string;
747
+ }
748
+ declare function CustomerPicker({ search, create, selected, onSelect, onError, online, debounceMs, className }: CustomerPickerProps): react_jsx_runtime.JSX.Element;
749
+
731
750
  interface PaymentMethodCardProps extends Omit<PressableProps, 'children'> {
732
751
  label: string;
733
752
  selected: boolean;
@@ -1235,12 +1254,14 @@ declare function Catalogue<Doc>({ products, traits, currency, onSelect, statusTe
1235
1254
  products: Doc[];
1236
1255
  traits: ProductTraits<Doc>;
1237
1256
  currency: string;
1257
+ /** Receives the chosen product and variant with the nearest ConnectorProvider's stock overlay applied (a copy). */
1238
1258
  onSelect: (entry: CatalogueEntry<Doc>) => void;
1239
1259
  statusText?: string;
1240
1260
  /** Rendered at the end of the status line, e.g. a register control at phone width; the row renders even without `statusText`. */
1241
1261
  statusAccessory?: ReactNode;
1242
1262
  lastSyncedAt: Date | null;
1243
- /** The last completed stock reconcile pass, persisted across restarts; the later of this and lastSyncedAt wins. */
1263
+ /** The last completed stock reconcile pass, persisted across restarts. The "stock as of" time shown is the
1264
+ * latest of this, the provider's stockOverlayAsOf (when valid) and lastSyncedAt; null and omitted alike. */
1244
1265
  lastStockCheckAt?: Date | null;
1245
1266
  /** Whether to show a 12- or 24-hour clock in the stock-as-of time; undefined keeps the locale default. A platform
1246
1267
  * reads this off its own device APIs (e.g. expo-localization's getCalendars()) and passes it in. */
@@ -1254,7 +1275,7 @@ declare function Catalogue<Doc>({ products, traits, currency, onSelect, statusTe
1254
1275
  /** `store`/`taxLabel`/`topInset`/`formatDate` replace the app's Medusa settings, hard-coded VAT (default matches
1255
1276
  * TV6a's `Cart`), outbox strip and date util, so `Receipt` stays platform-neutral (ADR-052). */
1256
1277
  declare function Receipt({ order, store, cashier, registerId, newSale, taxLabel, topInset, formatDate }: {
1257
- order: Order;
1278
+ order: SentOrder;
1258
1279
  store: {
1259
1280
  name: string;
1260
1281
  address?: string;
@@ -1269,18 +1290,27 @@ declare function Receipt({ order, store, cashier, registerId, newSale, taxLabel,
1269
1290
 
1270
1291
  declare function injectPrintStyle(): void;
1271
1292
 
1272
- declare function SyncStatus({ state }: {
1293
+ /**
1294
+ * `pluginName` names the store's plugin in the detail, as its owners know it; `registerState` counts till updates.
1295
+ * `pullNotice` (a stopped product pull) shows as its own line and detail, above the outbox line.
1296
+ */
1297
+ declare function SyncStatus({ state, registerState, pluginName, pullNotice }: {
1273
1298
  state: OutboxState;
1299
+ registerState?: OutboxState;
1300
+ pluginName?: string;
1301
+ pullNotice?: SyncNotice;
1274
1302
  }): react_jsx_runtime.JSX.Element;
1275
1303
 
1276
1304
  /** The "Needs attention" (when not empty) and "Recent" orders, lifted from medusapos/app's orders screen (ADR-052).
1277
1305
  * `onRetry` is the outbox's `requeue`; `formatDate` replaces the app's date util; `footer` is the app's own content
1278
- * (medusapos: the feedback link). The router and session redirect stay in the app. */
1279
- declare function OrdersList({ orders, onRetry, formatDate, footer }: {
1306
+ * (medusapos: the feedback link). The router and session redirect stay in the app. `stuck` is the outbox's
1307
+ * `state.stuck` (`useOrderOutbox`): those pending orders need attention too, each with its own entry's reason and since. */
1308
+ declare function OrdersList({ orders, onRetry, formatDate, footer, stuck }: {
1280
1309
  orders: PosOrder[];
1281
1310
  onRetry(orderIds: string[]): Promise<number>;
1282
1311
  formatDate?: (iso: string) => string;
1283
1312
  footer?: ReactNode;
1313
+ stuck?: OutboxState['stuck'];
1284
1314
  }): react_jsx_runtime.JSX.Element;
1285
1315
 
1286
1316
  interface POSLayoutProps extends Omit<ViewProps, 'children'> {
@@ -1361,4 +1391,4 @@ interface StoreSettingsChoiceScreenProps extends Omit<ViewProps, 'children'> {
1361
1391
  */
1362
1392
  declare function StoreSettingsChoiceScreen({ choices, initial, onSubmit, countryName, locale, title, body, regionLabel, countryLabel, channelLabel, submitLabel, className, ...viewProps }: StoreSettingsChoiceScreenProps): react_jsx_runtime.JSX.Element;
1363
1393
 
1364
- export { APPROVAL_REQUIRED_TEXT, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Cart, type CartAction, CartBar, CartLine, CartLineActions, type CartLineActionsProps, type CartLineProps, CartNoteInput, type CartNoteInputProps, CartPanel, type CartPanelProps, CartTotal, type CartTotalProps, CashCountInput, type CashCountInputProps, CashTendered, type CashTenderedProps, Catalogue, type CategoryItem, CategoryNav, type CategoryNavProps, ChangeDisplay, type ChangeDisplayProps, 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, CustomerForm, type CustomerFormProps, type CustomerFormValues, CustomerOrderHistory, type CustomerOrderHistoryProps, CustomerSelect, type CustomerSelectProps, type Denomination, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiscountBadge, type DiscountBadgeProps, DiscountChips, DiscountForm, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FilterChip, FilterChipGroup, type FilterChipGroupProps, type FilterChipProps, HStack, type HStackProps, HoverCard, HoverCardContent, HoverCardTrigger, Icon, IconButton, type IconButtonProps, type IconProps, Input, InputField, InputRoot, type InputRootProps, InputSlot, Label, type LabelProps, LiveTabScreen, type LiveTabScreenProps, type LiveTabScreenState, Loader, type LoaderProps, MovementSheet, type MovementSheetProps, OpenRegisterCard, type OpenRegisterCardProps, OrderCard, type OrderCardProps, OrderDetail, type OrderDetailLineItem, type OrderDetailProps, OrderList, type OrderListProps, type OrderStatus, OrderStatusBadge, type OrderStatusBadgeProps, OrderSummary, OrderSummaryLine, type OrderSummaryLineProps, type OrderSummaryPayment, type OrderSummaryProps, OrdersList, POSLayout, type POSLayoutProps, type PaymentMethod, PaymentMethodCard, type PaymentMethodCardProps, PaymentSelector, type PaymentSelectorProps, Popover, PopoverContent, PopoverTrigger, ProductCard, type ProductCardProps, ProductGrid, type ProductGridProps, ProductImage, type ProductImageProps, ProductList, type ProductListProps, ProductPrice, type ProductPriceProps, ProductSku, type ProductSkuProps, ProductStockBadge, type ProductStockBadgeProps, ProductTitle, type ProductTitleProps, ProductVariantPicker, type ProductVariantPickerProps, Progress, type ProgressProps, QuantityStepper, type QuantityStepperProps, RadioGroup, RadioGroupItem, Receipt, type ReceiptItem, ReceiptPreview, type ReceiptPreviewProps, 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, SearchIcon, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, type SeparatorProps, SettingsGroup, type SettingsGroupProps, SettingsLayout, type SettingsLayoutProps, SettingsRow, type SettingsRowProps, Slider, type SliderProps, StoreSettingsChoiceScreen, type StoreSettingsChoiceScreenProps, type SvgIconProps, Switch, SyncStatus, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tender, 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, avatarVariants, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, createSvgIcon, describeRegisterBarPill, discountLabel, formatStockSyncTime, hstackVariants, iconButtonVariants, iconVariants, injectPrintStyle, loaderVariants, parseDiscount, textVariants, toastVariants, toggleTextVariants, toggleVariants, useInputContext, vstackVariants };
1394
+ export { APPROVAL_REQUIRED_TEXT, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Cart, type CartAction, CartBar, CartLine, CartLineActions, type CartLineActionsProps, type CartLineProps, CartNoteInput, type CartNoteInputProps, CartPanel, type CartPanelProps, CartTotal, type CartTotalProps, CashCountInput, type CashCountInputProps, CashTendered, type CashTenderedProps, Catalogue, type CategoryItem, CategoryNav, type CategoryNavProps, ChangeDisplay, type ChangeDisplayProps, 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, CustomerForm, type CustomerFormProps, type CustomerFormValues, CustomerOrderHistory, type CustomerOrderHistoryProps, CustomerPicker, type CustomerPickerProps, CustomerSelect, type CustomerSelectProps, type Denomination, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiscountBadge, type DiscountBadgeProps, DiscountChips, DiscountForm, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FilterChip, FilterChipGroup, type FilterChipGroupProps, type FilterChipProps, HStack, type HStackProps, HoverCard, HoverCardContent, HoverCardTrigger, Icon, IconButton, type IconButtonProps, type IconProps, Input, InputField, InputRoot, type InputRootProps, InputSlot, Label, type LabelProps, LiveTabScreen, type LiveTabScreenProps, type LiveTabScreenState, Loader, type LoaderProps, MovementSheet, type MovementSheetProps, OpenRegisterCard, type OpenRegisterCardProps, OrderCard, type OrderCardProps, OrderDetail, type OrderDetailLineItem, type OrderDetailProps, OrderList, type OrderListProps, type OrderStatus, OrderStatusBadge, type OrderStatusBadgeProps, OrderSummary, OrderSummaryLine, type OrderSummaryLineProps, type OrderSummaryPayment, type OrderSummaryProps, OrdersList, POSLayout, type POSLayoutProps, type PaymentMethod, PaymentMethodCard, type PaymentMethodCardProps, PaymentSelector, type PaymentSelectorProps, Popover, PopoverContent, PopoverTrigger, ProductCard, type ProductCardProps, ProductGrid, type ProductGridProps, ProductImage, type ProductImageProps, ProductList, type ProductListProps, ProductPrice, type ProductPriceProps, ProductSku, type ProductSkuProps, ProductStockBadge, type ProductStockBadgeProps, ProductTitle, type ProductTitleProps, ProductVariantPicker, type ProductVariantPickerProps, Progress, type ProgressProps, QuantityStepper, type QuantityStepperProps, RadioGroup, RadioGroupItem, Receipt, type ReceiptItem, ReceiptPreview, type ReceiptPreviewProps, 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, SearchIcon, SearchInput, type SearchInputProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, type SeparatorProps, SettingsGroup, type SettingsGroupProps, SettingsLayout, type SettingsLayoutProps, SettingsRow, type SettingsRowProps, Slider, type SliderProps, StoreSettingsChoiceScreen, type StoreSettingsChoiceScreenProps, type SvgIconProps, Switch, SyncStatus, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tender, 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, avatarVariants, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, createSvgIcon, describeRegisterBarPill, discountLabel, formatStockSyncTime, hstackVariants, iconButtonVariants, iconVariants, injectPrintStyle, loaderVariants, parseDiscount, textVariants, toastVariants, toggleTextVariants, toggleVariants, useInputContext, vstackVariants };