@tallyui/components 3.18.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.
Files changed (52) hide show
  1. package/dist/index.d.ts +460 -34
  2. package/dist/index.js +3632 -1898
  3. package/package.json +9 -9
  4. package/src/cart/cart-columns.tsx +42 -4
  5. package/src/cart/cart-line.tsx +42 -18
  6. package/src/cart/cart-note-input.tsx +10 -2
  7. package/src/cart/index.ts +1 -1
  8. package/src/customer/customer-select.tsx +21 -3
  9. package/src/index.ts +27 -0
  10. package/src/order/index.ts +1 -0
  11. package/src/order/order-filter-bar.tsx +247 -0
  12. package/src/product/camera-scan-button.tsx +28 -0
  13. package/src/product/camera-scanner-panel.tsx +156 -0
  14. package/src/product/index.ts +5 -0
  15. package/src/product/scanner-viewfinder.tsx +76 -0
  16. package/src/product/variation-picker.tsx +128 -0
  17. package/src/register/register-bar.tsx +2 -6
  18. package/src/register/register-panel.tsx +47 -24
  19. package/src/register/register-side-sheet.tsx +175 -0
  20. package/src/reports/date-range-menu.tsx +109 -0
  21. package/src/reports/filters-bar.tsx +11 -21
  22. package/src/reports/hero.tsx +8 -4
  23. package/src/reports/index.ts +1 -0
  24. package/src/sale/cart.tsx +44 -8
  25. package/src/sale/catalogue.tsx +98 -21
  26. package/src/sale/charge-form.tsx +12 -6
  27. package/src/sale/customer-display-pairing.tsx +111 -0
  28. package/src/sale/index.ts +1 -0
  29. package/src/sale/line-popover.tsx +17 -1
  30. package/src/sale/order-reference.ts +1 -1
  31. package/src/sale/orders-list.tsx +1 -1
  32. package/src/settings/customer-display-settings.tsx +163 -0
  33. package/src/settings/index.ts +2 -0
  34. package/src/settings/tax-calculation-settings.tsx +97 -0
  35. package/src/tax/index.ts +1 -0
  36. package/src/tax/tax-based-on.tsx +196 -0
  37. package/src/ui/avatar/index.tsx +22 -4
  38. package/src/ui/button/index.tsx +1 -1
  39. package/src/ui/calendar/index.tsx +119 -0
  40. package/src/ui/calendar/month-grid.ts +40 -0
  41. package/src/ui/combobox/index.tsx +1 -1
  42. package/src/ui/dialog/index.tsx +20 -8
  43. package/src/ui/icon/chevron-down-icon.tsx +4 -0
  44. package/src/ui/icon/grip-icon.tsx +10 -0
  45. package/src/ui/icon/scan-icon.tsx +13 -0
  46. package/src/ui/icon/shopping-cart-icon.tsx +10 -0
  47. package/src/ui/icon-button/index.tsx +1 -1
  48. package/src/ui/index.ts +11 -1
  49. package/src/ui/input/index.tsx +1 -1
  50. package/src/ui/select/index.tsx +22 -4
  51. package/src/ui/switch/index.tsx +18 -7
  52. package/src/ui/textarea/index.tsx +1 -1
package/src/ui/index.ts CHANGED
@@ -7,10 +7,14 @@ export { VStack, vstackVariants, type VStackProps } from './vstack';
7
7
  export { Icon, iconVariants, type IconProps } from './icon';
8
8
  export { createSvgIcon, type SvgIconProps } from './icon/svg-icon';
9
9
  export { SearchIcon } from './icon/search-icon';
10
+ export { ShoppingCartIcon } from './icon/shopping-cart-icon';
10
11
  export { XIcon } from './icon/x-icon';
12
+ export { ScanIcon } from './icon/scan-icon';
13
+ export { GripIcon } from './icon/grip-icon';
14
+ export { ChevronDownIcon } from './icon/chevron-down-icon';
11
15
  export { Loader, loaderVariants, type LoaderProps } from './loader';
12
16
  export { Badge, badgeVariants, badgeTextVariants, type BadgeProps } from './badge';
13
- export { Avatar, avatarVariants, type AvatarProps } from './avatar';
17
+ export { Avatar, avatarVariants, avatarInitials, type AvatarProps } from './avatar';
14
18
 
15
19
  // Interactive
16
20
  export { Button, buttonVariants, buttonTextVariants, type ButtonProps } from './button';
@@ -72,6 +76,12 @@ export {
72
76
  // Popover
73
77
  export { Popover, PopoverTrigger, PopoverContent } from './popover';
74
78
 
79
+ // Calendar
80
+ export { Calendar, type CalendarProps } from './calendar';
81
+ export {
82
+ monthGrid, monthOf, addMonths, compareDays, pressRangeDay, type Month, type WeekDay, type GridDay,
83
+ } from './calendar/month-grid';
84
+
75
85
  // Tooltip
76
86
  export { Tooltip, TooltipTrigger, TooltipContent } from './tooltip';
77
87
 
@@ -30,7 +30,7 @@ const InputRoot = React.forwardRef<View, InputRootProps>(
30
30
  <View
31
31
  ref={ref}
32
32
  className={cn(
33
- 'flex h-10 flex-row items-center rounded-md border border-input bg-background px-3',
33
+ 'flex h-10 flex-row items-center rounded-md border border-input bg-card px-3',
34
34
  focused && 'ring-2 ring-ring ring-offset-2',
35
35
  disabled && 'opacity-50',
36
36
  className,
@@ -2,25 +2,43 @@ import * as React from 'react';
2
2
  import { View } from 'react-native';
3
3
  import { Select as SelectPrimitive } from '@tallyui/primitives';
4
4
  import { cn } from '@tallyui/theme';
5
+ import { ChevronDownIcon } from '../icon/chevron-down-icon';
5
6
 
6
7
  const Select = SelectPrimitive.Root;
7
8
  const SelectGroup = SelectPrimitive.Group;
8
9
  const SelectValue = SelectPrimitive.Value;
9
10
 
11
+ type SelectTriggerProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {
12
+ /**
13
+ * Draws a down chevron at the right, the v2 way. Pass `false` when the children draw their
14
+ * own, or for a trigger that needs none. Skipped under `asChild`, whose one child owns the content.
15
+ */
16
+ chevron?: boolean;
17
+ };
18
+
10
19
  const SelectTrigger = React.forwardRef<
11
20
  React.ComponentRef<typeof SelectPrimitive.Trigger>,
12
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
13
- >(function SelectTrigger({ className, children, ...props }, ref) {
21
+ SelectTriggerProps
22
+ >(function SelectTrigger({ className, children, chevron = true, ...props }, ref) {
14
23
  return (
15
24
  <SelectPrimitive.Trigger
16
25
  ref={ref}
17
26
  className={cn(
18
- 'flex h-10 w-full flex-row items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground web:ring-offset-background web:focus:outline-none web:focus:ring-2 web:focus:ring-ring web:focus:ring-offset-2',
27
+ 'flex h-10 w-full flex-row items-center justify-between rounded-md border border-input bg-card px-3 py-2 text-sm text-foreground web:ring-offset-background web:focus:outline-none web:focus:ring-2 web:focus:ring-ring web:focus:ring-offset-2',
19
28
  className,
20
29
  )}
21
30
  {...props}
22
31
  >
23
- {children}
32
+ {chevron && !props.asChild ? (
33
+ <>
34
+ {children}
35
+ <View aria-hidden className="ml-2 shrink-0 opacity-50">
36
+ <ChevronDownIcon size={16} />
37
+ </View>
38
+ </>
39
+ ) : (
40
+ children
41
+ )}
24
42
  </SelectPrimitive.Trigger>
25
43
  );
26
44
  });
@@ -2,15 +2,26 @@ import * as React from 'react';
2
2
  import { Switch as SwitchPrimitive } from '@tallyui/primitives';
3
3
  import { cn } from '@tallyui/theme';
4
4
 
5
- const Switch = React.forwardRef<
6
- React.ComponentRef<typeof SwitchPrimitive.Root>,
7
- React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>
8
- >(function Switch({ className, ...props }, ref) {
5
+ // Track, thumb and checked travel per size. Both keep border-2, so travel = inner width - thumb.
6
+ const sizes = {
7
+ default: { track: 'h-6 w-11', thumb: 'h-5 w-5', on: 'translate-x-5' },
8
+ sm: { track: 'h-5 w-9', thumb: 'h-4 w-4', on: 'translate-x-4' },
9
+ } as const;
10
+
11
+ type SwitchProps = React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> & {
12
+ size?: keyof typeof sizes;
13
+ };
14
+
15
+ const Switch = React.forwardRef<React.ComponentRef<typeof SwitchPrimitive.Root>, SwitchProps>(function Switch(
16
+ { className, size = 'default', ...props },
17
+ ref,
18
+ ) {
19
+ const s = sizes[size];
9
20
  return (
10
21
  <SwitchPrimitive.Root
11
22
  ref={ref}
12
23
  className={cn(
13
- 'web:peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent web:transition-colors web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2 web:focus-visible:ring-offset-background',
24
+ `web:peer inline-flex ${s.track} shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent web:transition-colors web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2 web:focus-visible:ring-offset-background`,
14
25
  props.checked ? 'bg-primary' : 'bg-input',
15
26
  props.disabled && 'web:cursor-not-allowed opacity-50',
16
27
  className,
@@ -19,8 +30,8 @@ const Switch = React.forwardRef<
19
30
  >
20
31
  <SwitchPrimitive.Thumb
21
32
  className={cn(
22
- 'pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 web:transition-transform',
23
- props.checked ? 'translate-x-5' : 'translate-x-0',
33
+ `pointer-events-none block ${s.thumb} rounded-full bg-background shadow-lg ring-0 web:transition-transform`,
34
+ props.checked ? s.on : 'translate-x-0',
24
35
  )}
25
36
  />
26
37
  </SwitchPrimitive.Root>
@@ -14,7 +14,7 @@ const Textarea = React.forwardRef<TextInput, TextareaProps>(
14
14
  multiline
15
15
  textAlignVertical="top"
16
16
  className={cn(
17
- 'min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground web:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
17
+ 'min-h-[80px] w-full rounded-md border border-input bg-card px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground web:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
18
18
  className,
19
19
  )}
20
20
  {...props}