@tallyui/components 3.17.0 → 3.19.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 +460 -34
- package/dist/index.js +3632 -1898
- package/package.json +9 -9
- package/src/cart/cart-columns.tsx +42 -4
- package/src/cart/cart-line.tsx +42 -18
- package/src/cart/cart-note-input.tsx +10 -2
- package/src/cart/index.ts +1 -1
- package/src/customer/customer-select.tsx +21 -3
- package/src/index.ts +27 -0
- package/src/order/index.ts +1 -0
- package/src/order/order-filter-bar.tsx +247 -0
- package/src/product/camera-scan-button.tsx +28 -0
- package/src/product/camera-scanner-panel.tsx +156 -0
- package/src/product/index.ts +5 -0
- package/src/product/scanner-viewfinder.tsx +76 -0
- package/src/product/variation-picker.tsx +128 -0
- package/src/register/register-bar.tsx +2 -6
- package/src/register/register-panel.tsx +47 -24
- package/src/register/register-side-sheet.tsx +175 -0
- package/src/reports/date-range-menu.tsx +109 -0
- package/src/reports/filters-bar.tsx +11 -21
- package/src/reports/hero.tsx +8 -4
- package/src/reports/index.ts +1 -0
- package/src/sale/cart.tsx +44 -8
- package/src/sale/catalogue.tsx +98 -21
- package/src/sale/charge-form.tsx +12 -6
- package/src/sale/customer-display-pairing.tsx +111 -0
- package/src/sale/index.ts +1 -0
- package/src/sale/line-popover.tsx +17 -1
- package/src/sale/order-reference.ts +1 -1
- package/src/sale/orders-list.tsx +1 -1
- package/src/settings/customer-display-settings.tsx +163 -0
- package/src/settings/index.ts +2 -0
- package/src/settings/tax-calculation-settings.tsx +97 -0
- package/src/tax/index.ts +1 -0
- package/src/tax/tax-based-on.tsx +196 -0
- package/src/ui/avatar/index.tsx +22 -4
- package/src/ui/button/index.tsx +1 -1
- package/src/ui/calendar/index.tsx +119 -0
- package/src/ui/calendar/month-grid.ts +40 -0
- package/src/ui/combobox/index.tsx +1 -1
- package/src/ui/dialog/index.tsx +20 -8
- package/src/ui/icon/chevron-down-icon.tsx +4 -0
- package/src/ui/icon/grip-icon.tsx +10 -0
- package/src/ui/icon/scan-icon.tsx +13 -0
- package/src/ui/icon/shopping-cart-icon.tsx +10 -0
- package/src/ui/icon-button/index.tsx +1 -1
- package/src/ui/index.ts +11 -1
- package/src/ui/input/index.tsx +1 -1
- package/src/ui/select/index.tsx +22 -4
- package/src/ui/switch/index.tsx +18 -7
- package/src/ui/textarea/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tallyui/components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Universal POS UI components for Tally UI",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"directory": "packages/components"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@tallyui/core": "^3.
|
|
32
|
-
"@tallyui/primitives": "^3.
|
|
33
|
-
"@tallyui/theme": "^3.
|
|
31
|
+
"@tallyui/core": "^3.19.0",
|
|
32
|
+
"@tallyui/primitives": "^3.19.0",
|
|
33
|
+
"@tallyui/theme": "^3.19.0",
|
|
34
34
|
"react": ">=18",
|
|
35
35
|
"react-native": ">=0.74",
|
|
36
36
|
"react-native-svg": ">=15"
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"class-variance-authority": "^0.7.1",
|
|
40
40
|
"i18next": "^26.7.1",
|
|
41
41
|
"react-i18next": "^17.1.12",
|
|
42
|
-
"@tallyui/pos": "3.
|
|
42
|
+
"@tallyui/pos": "3.19.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@tallyui/connector-medusa": "3.
|
|
46
|
-
"@tallyui/connector-vendure": "3.
|
|
47
|
-
"@tallyui/connector-woocommerce": "3.
|
|
48
|
-
"@tallyui/mock-api": "3.
|
|
45
|
+
"@tallyui/connector-medusa": "3.19.0",
|
|
46
|
+
"@tallyui/connector-vendure": "3.19.0",
|
|
47
|
+
"@tallyui/connector-woocommerce": "3.19.0",
|
|
48
|
+
"@tallyui/mock-api": "3.19.0",
|
|
49
49
|
"@types/react": ">=18",
|
|
50
50
|
"react": "^19.2.4",
|
|
51
51
|
"react-native-svg": "15.12.1",
|
|
@@ -12,7 +12,9 @@ import { Text } from '../ui';
|
|
|
12
12
|
*/
|
|
13
13
|
export const CART_COLUMNS = {
|
|
14
14
|
quantity: { head: 'w-12 flex-none items-center pr-2 pl-3', cell: 'w-12 flex-none items-center pr-2 pl-3' },
|
|
15
|
+
image: { head: 'w-14 flex-none items-center justify-center pl-3', cell: 'w-14 flex-none items-center justify-center pl-3' },
|
|
15
16
|
name: { head: 'min-w-0 flex-1 px-3', cell: 'min-w-0 flex-1 px-3' },
|
|
17
|
+
sku: { head: 'w-24 flex-none px-2', cell: 'w-24 flex-none px-2' },
|
|
16
18
|
price: { head: 'w-18 flex-none items-end px-2', cell: 'w-18 flex-none items-end px-2' },
|
|
17
19
|
total: { head: 'w-20 flex-none items-end pr-3 pl-2', cell: 'min-w-20 flex-none items-end pr-3 pl-2' },
|
|
18
20
|
};
|
|
@@ -29,11 +31,47 @@ export function cartShowsPrice({ cartWidth, windowWidth, windowHeight }:
|
|
|
29
31
|
return (cartWidth ?? Infinity) >= PRICE_COLUMN_MIN_WIDTH && windowWidth >= WIDE_MIN_WIDTH && windowHeight >= WIDE_MIN_HEIGHT;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
/**
|
|
35
|
+
* v2's Cart Settings › Columns: each column's `show` switch and display options. Every field is optional; the
|
|
36
|
+
* defaults are today's look and v2's: Qty, Item, Price and Total show; Image, SKU, `quantity.split` and `name.sku` are off.
|
|
37
|
+
*/
|
|
38
|
+
export interface CartColumnSettings {
|
|
39
|
+
/** `split`: a Split link under a quantity above 1. */
|
|
40
|
+
quantity?: { show?: boolean; split?: boolean };
|
|
41
|
+
/** The line's image, in its own column with no head label. */
|
|
42
|
+
image?: { show?: boolean };
|
|
43
|
+
/** `sku`: the SKU on a line under the name. */
|
|
44
|
+
name?: { show?: boolean; sku?: boolean };
|
|
45
|
+
sku?: { show?: boolean };
|
|
46
|
+
/** Still folds on a narrow cart or a phone (`showPrice`). */
|
|
47
|
+
price?: { show?: boolean };
|
|
48
|
+
total?: { show?: boolean };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type CartColumnId = 'quantity' | 'image' | 'name' | 'sku' | 'price' | 'total';
|
|
52
|
+
const DEFAULT_SHOWN: Record<CartColumnId, boolean> = { quantity: true, image: false, name: true, sku: false, price: true, total: true };
|
|
53
|
+
|
|
54
|
+
/** The visible columns, in their fixed order; the heads and every line use it, so they cannot disagree. */
|
|
55
|
+
export function cartColumnIds(columns: CartColumnSettings = {}, { showPrice = true }: { showPrice?: boolean } = {}): CartColumnId[] {
|
|
56
|
+
return (Object.keys(DEFAULT_SHOWN) as CartColumnId[])
|
|
57
|
+
.filter((id) => (columns[id]?.show ?? DEFAULT_SHOWN[id]) && (id !== 'price' || showPrice));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** cartColumnIds with a `fill` in Item's place when it is hidden, so the amount columns stay right-aligned. */
|
|
61
|
+
export function cartColumnSlots(...args: Parameters<typeof cartColumnIds>): (CartColumnId | 'fill')[] {
|
|
62
|
+
const ids = cartColumnIds(...args);
|
|
63
|
+
if (ids.includes('name')) return ids;
|
|
64
|
+
const at = ids.filter((id) => id === 'quantity' || id === 'image').length;
|
|
65
|
+
return [...ids.slice(0, at), 'fill', ...ids.slice(at)];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const HEADS: Record<CartColumnId, string> = { quantity: 'Qty', image: '', name: 'Item', sku: 'SKU', price: 'Price', total: 'Total' };
|
|
33
69
|
|
|
34
70
|
export interface CartColumnHeadsProps extends Omit<ViewProps, 'children'> {
|
|
35
71
|
/** Show the Price head (default true); pass the same value as each CartLine's `showPrice`. */
|
|
36
72
|
showPrice?: boolean;
|
|
73
|
+
/** Which columns show (v2's Cart Settings › Columns); pass the same value as each CartLine's `columns`. */
|
|
74
|
+
columns?: CartColumnSettings;
|
|
37
75
|
className?: string;
|
|
38
76
|
}
|
|
39
77
|
|
|
@@ -44,12 +82,12 @@ export interface CartColumnHeadsProps extends Omit<ViewProps, 'children'> {
|
|
|
44
82
|
* <CartColumnHeads showPrice={showPrice} />
|
|
45
83
|
* ```
|
|
46
84
|
*/
|
|
47
|
-
export function CartColumnHeads({ showPrice = true, className, ...props }: CartColumnHeadsProps): JSX.Element {
|
|
85
|
+
export function CartColumnHeads({ showPrice = true, columns, className, ...props }: CartColumnHeadsProps): JSX.Element {
|
|
48
86
|
return (
|
|
49
87
|
<View role="row" className={cn('flex-row border-b border-border', className)} {...props}>
|
|
50
|
-
{
|
|
88
|
+
{cartColumnSlots(columns, { showPrice }).map((id) => id === 'fill' ? <View key={id} className="flex-1" /> : (
|
|
51
89
|
<View key={id} role="columnheader" className={cn('h-9 justify-center', CART_COLUMNS[id].head)}>
|
|
52
|
-
<Text className="text-xs font-medium uppercase tracking-wide text-muted-foreground" numberOfLines={1}>{
|
|
90
|
+
{HEADS[id] ? <Text className="text-xs font-medium uppercase tracking-wide text-muted-foreground" numberOfLines={1}>{HEADS[id]}</Text> : null}
|
|
53
91
|
</View>
|
|
54
92
|
))}
|
|
55
93
|
</View>
|
package/src/cart/cart-line.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { Pressable, View } from 'react-native';
|
|
3
3
|
import { formatMoney, type Money } from '@tallyui/core';
|
|
4
|
+
import { Image } from '@tallyui/primitives';
|
|
4
5
|
import { cn } from '@tallyui/theme';
|
|
5
6
|
import { Text, HStack, type HStackProps } from '../ui';
|
|
6
|
-
import { CART_COLUMNS } from './cart-columns';
|
|
7
|
+
import { CART_COLUMNS, cartColumnSlots, type CartColumnSettings } from './cart-columns';
|
|
7
8
|
|
|
8
9
|
export interface CartLineProps extends Omit<HStackProps, 'children'> {
|
|
9
10
|
name: string;
|
|
@@ -20,6 +21,14 @@ export interface CartLineProps extends Omit<HStackProps, 'children'> {
|
|
|
20
21
|
quantitySlot?: ReactNode;
|
|
21
22
|
/** Replaces the unit price's text (the struck regular price stays above it). */
|
|
22
23
|
priceSlot?: ReactNode;
|
|
24
|
+
/** Which columns show, as CartColumnHeads' `columns` (v2's Cart Settings › Columns); the default is the look above. */
|
|
25
|
+
columns?: CartColumnSettings;
|
|
26
|
+
/** The SKU, in the SKU column and, with `columns.name.sku`, under the name. */
|
|
27
|
+
sku?: string;
|
|
28
|
+
/** The image in the Image column; without it the cell stays empty at its width. */
|
|
29
|
+
imageUrl?: string;
|
|
30
|
+
/** With `columns.quantity.split` and a quantity above 1, a Split link under the quantity calls this. */
|
|
31
|
+
onSplit?: () => void;
|
|
23
32
|
locale?: string;
|
|
24
33
|
className?: string;
|
|
25
34
|
}
|
|
@@ -34,27 +43,42 @@ export interface CartLineProps extends Omit<HStackProps, 'children'> {
|
|
|
34
43
|
* <CartLine name="Coffee" quantity={2} unitPrice={unitPrice} lineTotal={lineTotal} />
|
|
35
44
|
* ```
|
|
36
45
|
*/
|
|
37
|
-
export function CartLine({ name, attributes, quantity, unitPrice, regularUnitPrice, lineTotal, showPrice = true, quantitySlot, priceSlot,
|
|
46
|
+
export function CartLine({ name, attributes, quantity, unitPrice, regularUnitPrice, lineTotal, showPrice = true, quantitySlot, priceSlot,
|
|
47
|
+
columns, sku, imageUrl, onSplit, locale, className, ...props }: CartLineProps) {
|
|
38
48
|
const options = Object.entries(attributes ?? {}).map(([key, value]) => `${key}: ${value}`).join(' · ');
|
|
39
49
|
const regular = regularUnitPrice && regularUnitPrice.currency === unitPrice.currency && regularUnitPrice.amount > unitPrice.amount
|
|
40
50
|
? formatMoney(regularUnitPrice, locale) ?? '—' : null;
|
|
51
|
+
const cells: Record<ReturnType<typeof cartColumnSlots>[number], ReactNode> = {
|
|
52
|
+
fill: <View key="fill" className="flex-1" />,
|
|
53
|
+
quantity: <View key="quantity" className={CART_COLUMNS.quantity.cell}>
|
|
54
|
+
{quantitySlot ?? <Text className="text-sm tabular-nums">{quantity}</Text>}
|
|
55
|
+
{columns?.quantity?.split && quantity > 1 && onSplit ? <Pressable accessibilityRole="button" accessibilityLabel={`Split ${name}`}
|
|
56
|
+
testID="cart-line-split" onPress={onSplit} className="min-h-11 justify-center"><Text className="text-xs text-primary">Split</Text></Pressable> : null}
|
|
57
|
+
</View>,
|
|
58
|
+
image: <View key="image" className={CART_COLUMNS.image.cell}>
|
|
59
|
+
{imageUrl ? <Image.Root testID="cart-line-image" source={{ uri: imageUrl }} alt="" contentFit="cover" className="rounded-md"
|
|
60
|
+
style={{ width: 40, height: 40 }} /> : null}
|
|
61
|
+
</View>,
|
|
62
|
+
name: <View key="name" className={CART_COLUMNS.name.cell}>
|
|
63
|
+
<Text className="text-sm font-medium" numberOfLines={2}>{name}</Text>
|
|
64
|
+
{options ? <Text className="text-xs text-muted-foreground" numberOfLines={2}>{options}</Text> : null}
|
|
65
|
+
{columns?.name?.sku && sku ? <Text testID="cart-line-sku" className="text-sm text-muted-foreground">{sku}</Text> : null}
|
|
66
|
+
</View>,
|
|
67
|
+
sku: <View key="sku" className={CART_COLUMNS.sku.cell}>
|
|
68
|
+
{sku ? <Text className="text-sm text-muted-foreground" numberOfLines={1}>{sku}</Text> : null}
|
|
69
|
+
</View>,
|
|
70
|
+
price: <View key="price" className={CART_COLUMNS.price.cell}>
|
|
71
|
+
{regular ? <Text accessibilityLabel={`Regular price ${regular}`} style={{ textDecorationLine: 'line-through' }}
|
|
72
|
+
className="text-right text-sm tabular-nums text-muted-foreground line-through">{regular}</Text> : null}
|
|
73
|
+
{priceSlot ?? <Text className="text-right text-sm tabular-nums text-muted-foreground">{formatMoney(unitPrice, locale) ?? '—'}</Text>}
|
|
74
|
+
</View>,
|
|
75
|
+
total: <View key="total" className={CART_COLUMNS.total.cell}>
|
|
76
|
+
<Text className="text-right text-sm font-semibold tabular-nums">{formatMoney(lineTotal, locale) ?? '—'}</Text>
|
|
77
|
+
</View>,
|
|
78
|
+
};
|
|
41
79
|
return (
|
|
42
80
|
<HStack space="none" className={cn('py-2.5', className)} {...props}>
|
|
43
|
-
|
|
44
|
-
{quantitySlot ?? <Text className="text-sm tabular-nums">{quantity}</Text>}
|
|
45
|
-
</View>
|
|
46
|
-
<View className={CART_COLUMNS.name.cell}>
|
|
47
|
-
<Text className="text-sm font-medium" numberOfLines={2}>{name}</Text>
|
|
48
|
-
{options ? <Text className="text-xs text-muted-foreground" numberOfLines={2}>{options}</Text> : null}
|
|
49
|
-
</View>
|
|
50
|
-
{showPrice ? <View className={CART_COLUMNS.price.cell}>
|
|
51
|
-
{regular ? <Text accessibilityLabel={`Regular price ${regular}`} style={{ textDecorationLine: 'line-through' }}
|
|
52
|
-
className="text-right text-sm tabular-nums text-muted-foreground line-through">{regular}</Text> : null}
|
|
53
|
-
{priceSlot ?? <Text className="text-right text-sm tabular-nums text-muted-foreground">{formatMoney(unitPrice, locale) ?? '—'}</Text>}
|
|
54
|
-
</View> : null}
|
|
55
|
-
<View className={CART_COLUMNS.total.cell}>
|
|
56
|
-
<Text className="text-right text-sm font-semibold tabular-nums">{formatMoney(lineTotal, locale) ?? '—'}</Text>
|
|
57
|
-
</View>
|
|
81
|
+
{cartColumnSlots(columns, { showPrice }).map((id) => cells[id])}
|
|
58
82
|
</HStack>
|
|
59
83
|
);
|
|
60
84
|
}
|
|
@@ -6,6 +6,12 @@ import { cn } from '@tallyui/theme';
|
|
|
6
6
|
export interface CartNoteInputProps extends Omit<ViewProps, 'children'> {
|
|
7
7
|
value: string;
|
|
8
8
|
onChangeText: (text: string) => void;
|
|
9
|
+
/**
|
|
10
|
+
* The note's name, shown by the collapsed link, the input's placeholder and
|
|
11
|
+
* its accessibility label. WooCommerce sends the note as `customer_note`, so
|
|
12
|
+
* the customer sees it.
|
|
13
|
+
*/
|
|
14
|
+
label?: string;
|
|
9
15
|
placeholder?: string;
|
|
10
16
|
className?: string;
|
|
11
17
|
}
|
|
@@ -13,7 +19,8 @@ export interface CartNoteInputProps extends Omit<ViewProps, 'children'> {
|
|
|
13
19
|
export function CartNoteInput({
|
|
14
20
|
value,
|
|
15
21
|
onChangeText,
|
|
16
|
-
|
|
22
|
+
label = 'Customer note',
|
|
23
|
+
placeholder = label,
|
|
17
24
|
className,
|
|
18
25
|
...viewProps
|
|
19
26
|
}: CartNoteInputProps) {
|
|
@@ -26,7 +33,7 @@ export function CartNoteInput({
|
|
|
26
33
|
className={cn('flex-row items-center gap-1.5 px-3 py-2', className)}
|
|
27
34
|
{...viewProps}
|
|
28
35
|
>
|
|
29
|
-
<Text className="text-xs text-primary">Add
|
|
36
|
+
<Text className="text-xs text-primary">{`Add ${label.toLowerCase()}`}</Text>
|
|
30
37
|
</Pressable>
|
|
31
38
|
);
|
|
32
39
|
}
|
|
@@ -37,6 +44,7 @@ export function CartNoteInput({
|
|
|
37
44
|
value={value}
|
|
38
45
|
onChangeText={onChangeText}
|
|
39
46
|
placeholder={placeholder}
|
|
47
|
+
accessibilityLabel={label}
|
|
40
48
|
placeholderTextColorClassName="accent-muted-foreground"
|
|
41
49
|
multiline
|
|
42
50
|
className="min-h-[3rem] rounded-lg border border-border bg-card px-3 py-2 text-sm text-foreground"
|
package/src/cart/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CartLine, type CartLineProps } from './cart-line';
|
|
2
|
-
export { CartColumnHeads, type CartColumnHeadsProps } from './cart-columns';
|
|
2
|
+
export { CartColumnHeads, cartColumnIds, type CartColumnHeadsProps, type CartColumnSettings } from './cart-columns';
|
|
3
3
|
export { CartTotal, type CartTotalProps } from './cart-total';
|
|
4
4
|
export { CartPanel, type CartPanelProps } from './cart-panel';
|
|
5
5
|
export { DiscountBadge, type DiscountBadgeProps } from './discount-badge';
|
|
@@ -3,7 +3,7 @@ import { Pressable, ScrollView, View } from 'react-native';
|
|
|
3
3
|
import { Select } from '@tallyui/primitives';
|
|
4
4
|
import { useCustomerTraits, type CustomerTraits } from '@tallyui/core';
|
|
5
5
|
import { cn } from '@tallyui/theme';
|
|
6
|
-
import { VStack, type VStackProps } from '../ui';
|
|
6
|
+
import { Avatar, avatarInitials, HStack, VStack, type VStackProps } from '../ui';
|
|
7
7
|
import { SearchInput } from '../input/search-input';
|
|
8
8
|
import { CustomerCard } from './customer-card';
|
|
9
9
|
|
|
@@ -21,6 +21,10 @@ export interface CustomerSelectProps<Doc = any> extends Omit<VStackProps, 'child
|
|
|
21
21
|
placeholder?: string;
|
|
22
22
|
/** Renders the search input; pass false when the parent renders its own (as CustomerPicker does) */
|
|
23
23
|
showSearch?: boolean;
|
|
24
|
+
/** Draws an initials avatar before each row and the selected summary, the way v2's cart dropdown does */
|
|
25
|
+
showAvatar?: boolean;
|
|
26
|
+
/** The avatar's tone; defaults to `'primary'`, v2's look (light initials on a solid primary circle) */
|
|
27
|
+
avatarTone?: 'muted' | 'primary';
|
|
24
28
|
className?: string;
|
|
25
29
|
}
|
|
26
30
|
|
|
@@ -59,12 +63,26 @@ function CustomerSelectView<Doc>({
|
|
|
59
63
|
onSearch,
|
|
60
64
|
placeholder = 'Search customers...',
|
|
61
65
|
showSearch = true,
|
|
66
|
+
showAvatar = false,
|
|
67
|
+
avatarTone = 'primary',
|
|
62
68
|
className,
|
|
63
69
|
traits,
|
|
64
70
|
...props
|
|
65
71
|
}: CustomerSelectProps<Doc>) {
|
|
66
72
|
const [search, setSearch] = useState('');
|
|
67
73
|
|
|
74
|
+
// The avatar is decorative: the row's accessibility label already carries the name and email.
|
|
75
|
+
function card(doc: Doc) {
|
|
76
|
+
const customerCard = <CustomerCard doc={doc} traits={traits} />;
|
|
77
|
+
if (!showAvatar) return customerCard;
|
|
78
|
+
return (
|
|
79
|
+
<HStack space="sm">
|
|
80
|
+
<Avatar aria-hidden size="sm" tone={avatarTone} fallback={avatarInitials(traits?.getName(doc) ?? '')} />
|
|
81
|
+
{customerCard}
|
|
82
|
+
</HStack>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
68
86
|
// Map selected customer to Select primitive's Option format
|
|
69
87
|
const selectedOption = selected && traits
|
|
70
88
|
? { value: traits.getId(selected), label: traits.getName(selected) }
|
|
@@ -103,7 +121,7 @@ function CustomerSelectView<Doc>({
|
|
|
103
121
|
{selected && traits && (
|
|
104
122
|
<Select.Trigger asChild>
|
|
105
123
|
<View className="rounded-lg border border-primary bg-primary/5 px-3 py-2">
|
|
106
|
-
|
|
124
|
+
{card(selected)}
|
|
107
125
|
</View>
|
|
108
126
|
</Select.Trigger>
|
|
109
127
|
)}
|
|
@@ -123,7 +141,7 @@ function CustomerSelectView<Doc>({
|
|
|
123
141
|
asChild
|
|
124
142
|
>
|
|
125
143
|
<Pressable accessibilityLabel={email ? `${label}, ${email}` : label} className="border-b border-border px-3 py-2">
|
|
126
|
-
|
|
144
|
+
{card(customer)}
|
|
127
145
|
</Pressable>
|
|
128
146
|
</Select.Item>
|
|
129
147
|
);
|
package/src/index.ts
CHANGED
|
@@ -44,6 +44,18 @@ export {
|
|
|
44
44
|
type InCartBadgeProps,
|
|
45
45
|
CategoryTile,
|
|
46
46
|
type CategoryTileProps,
|
|
47
|
+
VariationPicker,
|
|
48
|
+
type VariationPickerProps,
|
|
49
|
+
CameraScanButton,
|
|
50
|
+
type CameraScanButtonProps,
|
|
51
|
+
CameraScannerPanel,
|
|
52
|
+
FLASH_DURATION_MS,
|
|
53
|
+
SCANNER_MIN_HEIGHT,
|
|
54
|
+
SCANNER_MAX_HEIGHT,
|
|
55
|
+
SCANNER_DEFAULT_HEIGHT,
|
|
56
|
+
type CameraScannerPanelProps,
|
|
57
|
+
ScannerViewfinder,
|
|
58
|
+
type ViewfinderProps,
|
|
47
59
|
} from './product';
|
|
48
60
|
|
|
49
61
|
// Cart components
|
|
@@ -63,6 +75,8 @@ export {
|
|
|
63
75
|
type CartAction,
|
|
64
76
|
CartColumnHeads,
|
|
65
77
|
type CartColumnHeadsProps,
|
|
78
|
+
cartColumnIds,
|
|
79
|
+
type CartColumnSettings,
|
|
66
80
|
CartFoot,
|
|
67
81
|
type CartFootProps,
|
|
68
82
|
type CartFootAction,
|
|
@@ -138,6 +152,10 @@ export {
|
|
|
138
152
|
type RefundFormValue,
|
|
139
153
|
RefundModal,
|
|
140
154
|
type RefundModalProps,
|
|
155
|
+
OrderFilterBar,
|
|
156
|
+
type OrderFilterBarProps,
|
|
157
|
+
type OrderFilterOption,
|
|
158
|
+
type PaymentMethodKind,
|
|
141
159
|
} from './order';
|
|
142
160
|
|
|
143
161
|
// Register components
|
|
@@ -187,8 +205,15 @@ export {
|
|
|
187
205
|
type ConnectionStatus,
|
|
188
206
|
DisplaySettings,
|
|
189
207
|
type DisplaySettingsProps,
|
|
208
|
+
TaxCalculationSettings,
|
|
209
|
+
type TaxCalculationSettingsProps,
|
|
210
|
+
CustomerDisplaySettings,
|
|
211
|
+
type CustomerDisplaySettingsProps,
|
|
190
212
|
} from './settings';
|
|
191
213
|
|
|
214
|
+
// Tax components
|
|
215
|
+
export { TaxBasedOn, type TaxBasedOnProps } from './tax';
|
|
216
|
+
|
|
192
217
|
// Sale components
|
|
193
218
|
export {
|
|
194
219
|
Cart, CartBar, Tender, SplitTender, TenderPane, type TenderPaneProps, DiscountForm, DiscountChips, parseDiscount, discountLabel,
|
|
@@ -196,6 +221,7 @@ export {
|
|
|
196
221
|
ChargeForm, type ChargeFormProps,
|
|
197
222
|
Catalogue, formatStockSyncTime, Receipt, injectPrintStyle, SyncStatus, OrdersList, type OrderHistoryRow, orderReference,
|
|
198
223
|
ParkedSales, type ParkedSalesProps, OpenSaleTabs, type OpenSaleTabsProps, CustomerDisplayScreen,
|
|
224
|
+
CustomerDisplayPairing, type CustomerDisplayPairingProps,
|
|
199
225
|
ProductFilterBar, DEFAULT_PRODUCT_FILTERS, PRODUCT_FILTER_CHIPS, type ProductFilterBarProps, type ProductFilterChip, type ProductFilters,
|
|
200
226
|
} from './sale';
|
|
201
227
|
|
|
@@ -223,6 +249,7 @@ export {
|
|
|
223
249
|
export {
|
|
224
250
|
SalesRoom, type SalesRoomProps, SalesHero, type SalesHeroProps, SalesCards, type SalesCardsProps, type SalesCardId,
|
|
225
251
|
SalesFiltersBar, type SalesFiltersBarProps, type SalesFilters, type SalesOption,
|
|
252
|
+
DateRangeMenu, type DateRangeMenuProps,
|
|
226
253
|
} from './reports';
|
|
227
254
|
|
|
228
255
|
// Fonts
|
package/src/order/index.ts
CHANGED
|
@@ -4,3 +4,4 @@ export { OrderList, type OrderListProps } from './order-list';
|
|
|
4
4
|
export { OrderDetail, type OrderDetailProps, type OrderDetailLineItem } from './order-detail';
|
|
5
5
|
export { RefundForm, type RefundFormProps, type RefundFormValue } from './refund-form';
|
|
6
6
|
export { RefundModal, type RefundModalProps } from './refund-modal';
|
|
7
|
+
export { OrderFilterBar, type OrderFilterBarProps, type OrderFilterOption, type PaymentMethodKind } from './order-filter-bar';
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Orders screen's filter pills, in WCPOS v2's order: Status, Payment Method, Customer, Cashier, Store / Created
|
|
3
|
+
* via, Register and Date range, with Clear all. Port of v2 `screens/main/orders/filter-bar.tsx` and its
|
|
4
|
+
* `filter-bar/*-pill.tsx` (MIT, WCPOS); copy is v2's English (`core.json`). Presentational: the app passes the value,
|
|
5
|
+
* the connector's `orderFilters` and every option list, so no platform's words live here.
|
|
6
|
+
*/
|
|
7
|
+
import { Fragment, useState, type JSX, type ReactNode } from 'react';
|
|
8
|
+
import { Pressable, ScrollView, Text, View } from 'react-native';
|
|
9
|
+
import type { OrderFilterField } from '@tallyui/core';
|
|
10
|
+
import { presetRange, type DayRange, type OrderFilterValue } from '@tallyui/pos';
|
|
11
|
+
import { cn } from '@tallyui/theme';
|
|
12
|
+
import { rangeLabel } from '../reports/date-range-menu';
|
|
13
|
+
import { Button } from '../ui/button';
|
|
14
|
+
import { Calendar } from '../ui/calendar';
|
|
15
|
+
import { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxTrigger } from '../ui/combobox';
|
|
16
|
+
import { XIcon } from '../ui/icon/x-icon';
|
|
17
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
|
|
18
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger } from '../ui/select';
|
|
19
|
+
import { Text as UIText } from '../ui/text';
|
|
20
|
+
|
|
21
|
+
export interface OrderFilterOption { value: string; label: string }
|
|
22
|
+
export type PaymentMethodKind = 'cash' | 'card' | 'stored_value' | 'bank_transfer' | 'other';
|
|
23
|
+
export interface OrderFilterBarProps {
|
|
24
|
+
value: OrderFilterValue;
|
|
25
|
+
onChange(next: OrderFilterValue): void;
|
|
26
|
+
/** The connector's orderFilters. A pill shows only when its field is here (store pill: storeId or createdVia). */
|
|
27
|
+
fields: readonly OrderFilterField[];
|
|
28
|
+
/** What Clear all resets to and counts against (v2: cashier + store). Default {}. */
|
|
29
|
+
initial?: OrderFilterValue;
|
|
30
|
+
options?: {
|
|
31
|
+
status?: OrderFilterOption[];
|
|
32
|
+
/** Grouped by kind in this order, with a separator between groups: cash, card, stored_value, bank_transfer, other. */
|
|
33
|
+
paymentMethod?: (OrderFilterOption & { kind?: PaymentMethodKind })[];
|
|
34
|
+
customer?: OrderFilterOption[];
|
|
35
|
+
cashier?: OrderFilterOption[];
|
|
36
|
+
register?: OrderFilterOption[];
|
|
37
|
+
store?: OrderFilterOption[];
|
|
38
|
+
createdVia?: OrderFilterOption[];
|
|
39
|
+
};
|
|
40
|
+
/** The customer and cashier pills search through these when given; otherwise they filter their options locally. */
|
|
41
|
+
onCustomerSearch?(text: string): void;
|
|
42
|
+
onCashierSearch?(text: string): void;
|
|
43
|
+
/** IANA zone of the store, or 'device'. */
|
|
44
|
+
timezone: string;
|
|
45
|
+
now?: () => Date;
|
|
46
|
+
testID?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const KINDS: readonly PaymentMethodKind[] = ['cash', 'card', 'stored_value', 'bank_transfer', 'other'];
|
|
50
|
+
// The chip look is ProductFilterBar's; the trigger inside it drops the form-field look of SelectTrigger/ComboboxTrigger.
|
|
51
|
+
const chipClass = (on: boolean) => cn('min-h-11 flex-row items-center gap-1.5 rounded-full border px-3',
|
|
52
|
+
on ? 'border-primary/30 bg-primary/10' : 'border-border bg-card');
|
|
53
|
+
const TRIGGER_RESET = 'h-auto min-h-11 w-auto justify-start rounded-none border-0 bg-transparent px-0 py-0';
|
|
54
|
+
const labelOf = (options: OrderFilterOption[] | undefined, value: string) => options?.find((o) => o.value === value)?.label ?? value;
|
|
55
|
+
const sameRange = (a?: DayRange, b?: DayRange) => a?.from === b?.from && a?.to === b?.to;
|
|
56
|
+
// Clear all counts pills, as v2 counts its filters: the store pill's two fields are one.
|
|
57
|
+
const SIMPLE = ['status', 'paymentMethod', 'customerId', 'cashierId', 'registerId'] as const;
|
|
58
|
+
const changedCount = (value: OrderFilterValue, initial: OrderFilterValue) =>
|
|
59
|
+
SIMPLE.filter((key) => value[key] !== initial[key]).length
|
|
60
|
+
+ (value.storeId !== initial.storeId || value.createdVia !== initial.createdVia ? 1 : 0)
|
|
61
|
+
+ (sameRange(value.dateRange, initial.dateRange) ? 0 : 1);
|
|
62
|
+
|
|
63
|
+
function Chip({ id, on, label, onClear, trigger }: {
|
|
64
|
+
id: string; on: boolean; label: string; onClear: () => void; trigger: (children: ReactNode) => ReactNode;
|
|
65
|
+
}) {
|
|
66
|
+
return (
|
|
67
|
+
<View className={chipClass(on)}>
|
|
68
|
+
{trigger(<Text className={cn('text-sm', on ? 'text-primary' : 'text-foreground')}>{label}</Text>)}
|
|
69
|
+
{on ? (
|
|
70
|
+
<Pressable testID={`${id}-remove`} role="button" accessibilityLabel="Remove" onPress={onClear}
|
|
71
|
+
hitSlop={8} className="min-h-11 min-w-8 items-center justify-center text-primary">
|
|
72
|
+
<XIcon size={14} />
|
|
73
|
+
</Pressable>
|
|
74
|
+
) : null}
|
|
75
|
+
</View>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function SelectPill({ id, offLabel, selected, onClear, children }: {
|
|
80
|
+
id: string; offLabel: string; selected?: OrderFilterOption; onClear: () => void; children: ReactNode;
|
|
81
|
+
}) {
|
|
82
|
+
return (
|
|
83
|
+
<Select value={selected}>
|
|
84
|
+
<Chip id={id} on={!!selected} label={selected?.label ?? offLabel} onClear={onClear}
|
|
85
|
+
trigger={(label) => <SelectTrigger testID={id} className={TRIGGER_RESET}>{label}</SelectTrigger>} />
|
|
86
|
+
<SelectContent testID={`${id}-menu`}>{children}</SelectContent>
|
|
87
|
+
</Select>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function Item({ id, option, onPress }: { id: string; option: OrderFilterOption; onPress: () => void }) {
|
|
92
|
+
return (
|
|
93
|
+
<SelectItem testID={`${id}-${option.value}`} value={option.value} label={option.label} onPress={onPress}>
|
|
94
|
+
<Text className="text-sm text-popover-foreground">{option.label}</Text>
|
|
95
|
+
</SelectItem>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function ComboboxPill({ id, offLabel, placeholder, value, options, onSearch, onPick, onClear }: {
|
|
100
|
+
id: string; offLabel: string; placeholder: string; value?: string; options: OrderFilterOption[];
|
|
101
|
+
onSearch?: (text: string) => void; onPick: (value: string) => void; onClear: () => void;
|
|
102
|
+
}) {
|
|
103
|
+
const [search, setSearch] = useState('');
|
|
104
|
+
const selected = value === undefined ? undefined : { value, label: labelOf(options, value) };
|
|
105
|
+
const needle = search.trim().toLowerCase();
|
|
106
|
+
const shown = onSearch || !needle ? options : options.filter((o) => o.label.toLowerCase().includes(needle));
|
|
107
|
+
return (
|
|
108
|
+
<Combobox value={selected} onValueChange={(next) => { if (next) onPick(next.value); }} searchValue={search}
|
|
109
|
+
onSearchValueChange={(text) => { setSearch(text); onSearch?.(text); }}>
|
|
110
|
+
<Chip id={id} on={!!selected} label={selected?.label ?? offLabel} onClear={onClear}
|
|
111
|
+
trigger={(label) => <ComboboxTrigger testID={id} className={TRIGGER_RESET}>{label}</ComboboxTrigger>} />
|
|
112
|
+
<ComboboxContent testID={`${id}-menu`}>
|
|
113
|
+
<View className="border-b border-border px-2 py-1.5">
|
|
114
|
+
<ComboboxInput testID={`${id}-search`} placeholder={placeholder} />
|
|
115
|
+
</View>
|
|
116
|
+
{shown.map((option) => (
|
|
117
|
+
<ComboboxItem key={option.value} testID={`${id}-${option.value}`} value={option.value} label={option.label}>
|
|
118
|
+
<Text className="text-sm text-popover-foreground">{option.label}</Text>
|
|
119
|
+
</ComboboxItem>
|
|
120
|
+
))}
|
|
121
|
+
{shown.length === 0 ? <ComboboxEmpty /> : null}
|
|
122
|
+
</ComboboxContent>
|
|
123
|
+
</Combobox>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function DatePill({ value, onPick, onClear, timezone, now }: {
|
|
128
|
+
value?: DayRange; onPick: (range: DayRange) => void; onClear: () => void; timezone: string; now?: () => Date;
|
|
129
|
+
}) {
|
|
130
|
+
const id = 'order-filter-date';
|
|
131
|
+
const [open, setOpen] = useState(false);
|
|
132
|
+
const [draft, setDraft] = useState<DayRange | null>(value ?? null);
|
|
133
|
+
const at = (now ?? (() => new Date()))();
|
|
134
|
+
const today = presetRange('today', at, timezone);
|
|
135
|
+
const label = !value ? 'Date range'
|
|
136
|
+
: sameRange(value, today) ? 'Today'
|
|
137
|
+
: sameRange(value, presetRange('yesterday', at, timezone)) ? 'Yesterday' : rangeLabel(value);
|
|
138
|
+
const openChange = (next: boolean) => {
|
|
139
|
+
if (next) setDraft(value ?? null);
|
|
140
|
+
setOpen(next);
|
|
141
|
+
};
|
|
142
|
+
const done = () => {
|
|
143
|
+
setOpen(false);
|
|
144
|
+
if (draft) onPick(draft);
|
|
145
|
+
};
|
|
146
|
+
return (
|
|
147
|
+
<Popover open={open} onOpenChange={openChange}>
|
|
148
|
+
<Chip id={id} on={!!value} label={label} onClear={onClear}
|
|
149
|
+
trigger={(text) => <PopoverTrigger testID={id} role="button" className="min-h-11 flex-row items-center">{text}</PopoverTrigger>} />
|
|
150
|
+
<PopoverContent testID={`${id}-popover`} align="start" className="w-auto p-2">
|
|
151
|
+
<Calendar testID={`${id}-calendar`} mode="range" value={draft} onChange={setDraft} today={today.from} />
|
|
152
|
+
<View className="flex-row justify-end pt-2">
|
|
153
|
+
<Pressable testID={`${id}-done`} accessibilityRole="button" onPress={done}
|
|
154
|
+
className="h-10 justify-center rounded-md bg-primary px-4 active:opacity-90">
|
|
155
|
+
<Text className="text-sm font-medium text-primary-foreground">Done</Text>
|
|
156
|
+
</Pressable>
|
|
157
|
+
</View>
|
|
158
|
+
</PopoverContent>
|
|
159
|
+
</Popover>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export function OrderFilterBar({
|
|
164
|
+
value, onChange, fields, initial = {}, options = {}, onCustomerSearch, onCashierSearch, timezone, now,
|
|
165
|
+
testID = 'order-filter-bar',
|
|
166
|
+
}: OrderFilterBarProps): JSX.Element {
|
|
167
|
+
const has = (field: OrderFilterField) => fields.includes(field);
|
|
168
|
+
const set = (patch: OrderFilterValue) => onChange({ ...value, ...patch });
|
|
169
|
+
const option = (list: OrderFilterOption[] | undefined, v: string | undefined) => (v === undefined ? undefined : { value: v, label: labelOf(list, v) });
|
|
170
|
+
const changed = changedCount(value, initial);
|
|
171
|
+
const payment = options.paymentMethod ?? [];
|
|
172
|
+
const paymentGroups = KINDS.map((kind) => payment.filter((o) => (o.kind ?? 'other') === kind)).filter((group) => group.length > 0);
|
|
173
|
+
const viaGroup = has('createdVia') ? options.createdVia ?? [] : [];
|
|
174
|
+
const storeGroup = has('storeId') ? options.store ?? [] : [];
|
|
175
|
+
const storeSelected = value.storeId !== undefined ? option(options.store, value.storeId) : option(options.createdVia, value.createdVia);
|
|
176
|
+
const customers = options.customer ?? [];
|
|
177
|
+
const cashiers = options.cashier ?? [];
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<View testID={testID} className="flex-row items-center gap-2">
|
|
181
|
+
<ScrollView horizontal showsHorizontalScrollIndicator={false} className="flex-1" contentContainerClassName="flex-row items-center gap-2">
|
|
182
|
+
{has('status') && options.status?.length ? (
|
|
183
|
+
<SelectPill id="order-filter-status" offLabel="Status" selected={option(options.status, value.status)}
|
|
184
|
+
onClear={() => set({ status: undefined })}>
|
|
185
|
+
{options.status.map((o) => <Item key={o.value} id="order-filter-status" option={o} onPress={() => set({ status: o.value })} />)}
|
|
186
|
+
</SelectPill>
|
|
187
|
+
) : null}
|
|
188
|
+
{has('paymentMethod') ? (
|
|
189
|
+
<SelectPill id="order-filter-payment-method" offLabel="Payment Method" selected={option(payment, value.paymentMethod)}
|
|
190
|
+
onClear={() => set({ paymentMethod: undefined })}>
|
|
191
|
+
{paymentGroups.length === 0 ? (
|
|
192
|
+
<Text className="px-2 py-1.5 text-sm text-muted-foreground">No payment methods found</Text>
|
|
193
|
+
) : paymentGroups.map((group, i) => (
|
|
194
|
+
<Fragment key={group[0].kind ?? 'other'}>
|
|
195
|
+
{i > 0 ? <SelectSeparator testID="order-filter-payment-method-separator" /> : null}
|
|
196
|
+
<SelectGroup>
|
|
197
|
+
{group.map((o) => <Item key={o.value} id="order-filter-payment-method" option={o} onPress={() => set({ paymentMethod: o.value })} />)}
|
|
198
|
+
</SelectGroup>
|
|
199
|
+
</Fragment>
|
|
200
|
+
))}
|
|
201
|
+
</SelectPill>
|
|
202
|
+
) : null}
|
|
203
|
+
{has('customerId') && (customers.length > 0 || onCustomerSearch) ? (
|
|
204
|
+
<ComboboxPill id="order-filter-customer" offLabel="Select Customer" placeholder="Search Customers" value={value.customerId}
|
|
205
|
+
options={customers} onSearch={onCustomerSearch} onPick={(v) => set({ customerId: v })} onClear={() => set({ customerId: undefined })} />
|
|
206
|
+
) : null}
|
|
207
|
+
{has('cashierId') && (cashiers.length > 0 || onCashierSearch) ? (
|
|
208
|
+
<ComboboxPill id="order-filter-cashier" offLabel="Select Cashier" placeholder="Search Cashiers" value={value.cashierId}
|
|
209
|
+
options={cashiers} onSearch={onCashierSearch} onPick={(v) => set({ cashierId: v })} onClear={() => set({ cashierId: undefined })} />
|
|
210
|
+
) : null}
|
|
211
|
+
{viaGroup.length > 0 || storeGroup.length > 0 ? (
|
|
212
|
+
<SelectPill id="order-filter-store" offLabel="Created via" selected={storeSelected}
|
|
213
|
+
onClear={() => set({ storeId: undefined, createdVia: undefined })}>
|
|
214
|
+
{viaGroup.length > 0 ? (
|
|
215
|
+
<SelectGroup testID="order-filter-store-created-via">
|
|
216
|
+
<SelectLabel className="pl-2">Created via</SelectLabel>
|
|
217
|
+
{viaGroup.map((o) => <Item key={o.value} id="order-filter-store" option={o} onPress={() => set({ createdVia: o.value, storeId: undefined })} />)}
|
|
218
|
+
</SelectGroup>
|
|
219
|
+
) : null}
|
|
220
|
+
{viaGroup.length > 0 && storeGroup.length > 0 ? <SelectSeparator /> : null}
|
|
221
|
+
{storeGroup.length > 0 ? (
|
|
222
|
+
<SelectGroup testID="order-filter-store-stores">
|
|
223
|
+
<SelectLabel className="pl-2">Store</SelectLabel>
|
|
224
|
+
{storeGroup.map((o) => <Item key={o.value} id="order-filter-store" option={o} onPress={() => set({ storeId: o.value, createdVia: undefined })} />)}
|
|
225
|
+
</SelectGroup>
|
|
226
|
+
) : null}
|
|
227
|
+
</SelectPill>
|
|
228
|
+
) : null}
|
|
229
|
+
{has('registerId') && options.register?.length ? (
|
|
230
|
+
<SelectPill id="order-filter-register" offLabel="Select register" selected={option(options.register, value.registerId)}
|
|
231
|
+
onClear={() => set({ registerId: undefined })}>
|
|
232
|
+
{options.register.map((o) => <Item key={o.value} id="order-filter-register" option={o} onPress={() => set({ registerId: o.value })} />)}
|
|
233
|
+
</SelectPill>
|
|
234
|
+
) : null}
|
|
235
|
+
{has('dateRange') ? (
|
|
236
|
+
<DatePill value={value.dateRange} onPick={(range) => set({ dateRange: range })} onClear={() => set({ dateRange: undefined })}
|
|
237
|
+
timezone={timezone} now={now} />
|
|
238
|
+
) : null}
|
|
239
|
+
</ScrollView>
|
|
240
|
+
{changed >= 2 ? (
|
|
241
|
+
<Button variant="link" size="sm" testID="orders-filter-clear-all" onPress={() => onChange({ ...initial })}>
|
|
242
|
+
<UIText>Clear all</UIText>
|
|
243
|
+
</Button>
|
|
244
|
+
) : null}
|
|
245
|
+
</View>
|
|
246
|
+
);
|
|
247
|
+
}
|