@react-native-reusables/cli 0.1.0 → 0.1.2

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 (30) hide show
  1. package/__generated/components/ui/accordion.tsx +29 -31
  2. package/__generated/components/ui/alert-dialog.tsx +18 -24
  3. package/__generated/components/ui/avatar.tsx +34 -41
  4. package/__generated/components/ui/badge.tsx +2 -2
  5. package/__generated/components/ui/button.tsx +2 -5
  6. package/__generated/components/ui/card.tsx +39 -51
  7. package/__generated/components/ui/checkbox.tsx +23 -24
  8. package/__generated/components/ui/context-menu.tsx +27 -22
  9. package/__generated/components/ui/dialog.tsx +39 -41
  10. package/__generated/components/ui/dropdown-menu.tsx +26 -21
  11. package/__generated/components/ui/hover-card.tsx +2 -2
  12. package/__generated/components/ui/input.tsx +17 -18
  13. package/__generated/components/ui/label.tsx +20 -21
  14. package/__generated/components/ui/menubar.tsx +44 -46
  15. package/__generated/components/ui/navigation-menu.tsx +13 -13
  16. package/__generated/components/ui/popover.tsx +4 -4
  17. package/__generated/components/ui/progress.tsx +3 -3
  18. package/__generated/components/ui/radio-group.tsx +27 -29
  19. package/__generated/components/ui/select.tsx +63 -74
  20. package/__generated/components/ui/separator.tsx +16 -17
  21. package/__generated/components/ui/switch.tsx +58 -59
  22. package/__generated/components/ui/table.tsx +69 -76
  23. package/__generated/components/ui/tabs.tsx +49 -52
  24. package/__generated/components/ui/textarea.tsx +20 -21
  25. package/__generated/components/ui/toggle-group.tsx +4 -6
  26. package/__generated/components/ui/toggle.tsx +4 -4
  27. package/__generated/components/ui/tooltip.tsx +4 -4
  28. package/dist/index.js +3 -3
  29. package/dist/index.js.map +1 -1
  30. package/package.json +1 -1
@@ -1,38 +1,36 @@
1
+ import * as RadioGroupPrimitive from '@rn-primitives/radio-group';
1
2
  import * as React from 'react';
2
3
  import { View } from 'react-native';
3
- import * as RadioGroupPrimitive from '@rn-primitives/radio-group';
4
4
  import { cn } from '../../lib/utils';
5
5
 
6
- const RadioGroup = React.forwardRef<
7
- React.ElementRef<typeof RadioGroupPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
9
- >(({ className, ...props }, ref) => {
10
- return (
11
- <RadioGroupPrimitive.Root className={cn('web:grid gap-2', className)} {...props} ref={ref} />
12
- );
13
- });
6
+ const RadioGroup = React.forwardRef<RadioGroupPrimitive.RootRef, RadioGroupPrimitive.RootProps>(
7
+ ({ className, ...props }, ref) => {
8
+ return (
9
+ <RadioGroupPrimitive.Root className={cn('web:grid gap-2', className)} {...props} ref={ref} />
10
+ );
11
+ }
12
+ );
14
13
  RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
15
14
 
16
- const RadioGroupItem = React.forwardRef<
17
- React.ElementRef<typeof RadioGroupPrimitive.Item>,
18
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
19
- >(({ className, ...props }, ref) => {
20
- return (
21
- <RadioGroupPrimitive.Item
22
- ref={ref}
23
- className={cn(
24
- 'aspect-square h-4 w-4 native:h-5 native:w-5 rounded-full justify-center items-center border border-primary text-primary web:ring-offset-background web:focus:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
25
- props.disabled && 'web:cursor-not-allowed opacity-50',
26
- className
27
- )}
28
- {...props}
29
- >
30
- <RadioGroupPrimitive.Indicator className='flex items-center justify-center'>
31
- <View className='aspect-square h-[9px] w-[9px] native:h-[10] native:w-[10] bg-primary rounded-full' />
32
- </RadioGroupPrimitive.Indicator>
33
- </RadioGroupPrimitive.Item>
34
- );
35
- });
15
+ const RadioGroupItem = React.forwardRef<RadioGroupPrimitive.ItemRef, RadioGroupPrimitive.ItemProps>(
16
+ ({ className, ...props }, ref) => {
17
+ return (
18
+ <RadioGroupPrimitive.Item
19
+ ref={ref}
20
+ className={cn(
21
+ 'aspect-square h-4 w-4 native:h-5 native:w-5 rounded-full justify-center items-center border border-primary text-primary web:ring-offset-background web:focus:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
22
+ props.disabled && 'web:cursor-not-allowed opacity-50',
23
+ className
24
+ )}
25
+ {...props}
26
+ >
27
+ <RadioGroupPrimitive.Indicator className='flex items-center justify-center'>
28
+ <View className='aspect-square h-[9px] w-[9px] native:h-[10] native:w-[10] bg-primary rounded-full' />
29
+ </RadioGroupPrimitive.Indicator>
30
+ </RadioGroupPrimitive.Item>
31
+ );
32
+ }
33
+ );
36
34
  RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
37
35
 
38
36
  export { RadioGroup, RadioGroupItem };
@@ -15,32 +15,28 @@ const SelectGroup = SelectPrimitive.Group;
15
15
 
16
16
  const SelectValue = SelectPrimitive.Value;
17
17
 
18
- const SelectTrigger = React.forwardRef<
19
- React.ElementRef<typeof SelectPrimitive.Trigger>,
20
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
21
- >(({ className, children, ...props }, ref) => (
22
- <SelectPrimitive.Trigger
23
- ref={ref}
24
- className={cn(
25
- 'flex flex-row h-10 native:h-12 items-center text-sm justify-between rounded-md border border-input bg-background px-3 py-2 web:ring-offset-background text-muted-foreground web:focus:outline-none web:focus:ring-2 web:focus:ring-ring web:focus:ring-offset-2 [&>span]:line-clamp-1',
26
- props.disabled && 'web:cursor-not-allowed opacity-50',
27
- className
28
- )}
29
- {...props}
30
- >
31
- <>{children}</>
32
- <ChevronDown size={16} aria-hidden={true} className='text-foreground opacity-50' />
33
- </SelectPrimitive.Trigger>
34
- ));
18
+ const SelectTrigger = React.forwardRef<SelectPrimitive.TriggerRef, SelectPrimitive.TriggerProps>(
19
+ ({ className, children, ...props }, ref) => (
20
+ <SelectPrimitive.Trigger
21
+ ref={ref}
22
+ className={cn(
23
+ 'flex flex-row h-10 native:h-12 items-center text-sm justify-between rounded-md border border-input bg-background px-3 py-2 web:ring-offset-background text-muted-foreground web:focus:outline-none web:focus:ring-2 web:focus:ring-ring web:focus:ring-offset-2 [&>span]:line-clamp-1',
24
+ props.disabled && 'web:cursor-not-allowed opacity-50',
25
+ className
26
+ )}
27
+ {...props}
28
+ >
29
+ <>{children}</>
30
+ <ChevronDown size={16} aria-hidden={true} className='text-foreground opacity-50' />
31
+ </SelectPrimitive.Trigger>
32
+ )
33
+ );
35
34
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
36
35
 
37
36
  /**
38
37
  * Platform: WEB ONLY
39
38
  */
40
- const SelectScrollUpButton = ({
41
- className,
42
- ...props
43
- }: React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>) => {
39
+ const SelectScrollUpButton = ({ className, ...props }: SelectPrimitive.ScrollUpButtonProps) => {
44
40
  if (Platform.OS !== 'web') {
45
41
  return null;
46
42
  }
@@ -57,10 +53,7 @@ const SelectScrollUpButton = ({
57
53
  /**
58
54
  * Platform: WEB ONLY
59
55
  */
60
- const SelectScrollDownButton = ({
61
- className,
62
- ...props
63
- }: React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>) => {
56
+ const SelectScrollDownButton = ({ className, ...props }: SelectPrimitive.ScrollDownButtonProps) => {
64
57
  if (Platform.OS !== 'web') {
65
58
  return null;
66
59
  }
@@ -75,8 +68,8 @@ const SelectScrollDownButton = ({
75
68
  };
76
69
 
77
70
  const SelectContent = React.forwardRef<
78
- React.ElementRef<typeof SelectPrimitive.Content>,
79
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & { portalHost?: string }
71
+ SelectPrimitive.ContentRef,
72
+ SelectPrimitive.ContentProps & { portalHost?: string }
80
73
  >(({ className, children, position = 'popper', portalHost, ...props }, ref) => {
81
74
  const { open } = SelectPrimitive.useRootContext();
82
75
 
@@ -99,17 +92,15 @@ const SelectContent = React.forwardRef<
99
92
  {...props}
100
93
  >
101
94
  <SelectScrollUpButton />
102
- <View>
103
- <SelectPrimitive.Viewport
104
- className={cn(
105
- 'p-1',
106
- position === 'popper' &&
107
- 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'
108
- )}
109
- >
110
- {children}
111
- </SelectPrimitive.Viewport>
112
- </View>
95
+ <SelectPrimitive.Viewport
96
+ className={cn(
97
+ 'p-1',
98
+ position === 'popper' &&
99
+ 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'
100
+ )}
101
+ >
102
+ {children}
103
+ </SelectPrimitive.Viewport>
113
104
  <SelectScrollDownButton />
114
105
  </SelectPrimitive.Content>
115
106
  </Animated.View>
@@ -119,47 +110,45 @@ const SelectContent = React.forwardRef<
119
110
  });
120
111
  SelectContent.displayName = SelectPrimitive.Content.displayName;
121
112
 
122
- const SelectLabel = React.forwardRef<
123
- React.ElementRef<typeof SelectPrimitive.Label>,
124
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
125
- >(({ className, ...props }, ref) => (
126
- <SelectPrimitive.Label
127
- ref={ref}
128
- className={cn(
129
- 'py-1.5 native:pb-2 pl-8 native:pl-10 pr-2 text-popover-foreground text-sm native:text-base font-semibold',
130
- className
131
- )}
132
- {...props}
133
- />
134
- ));
113
+ const SelectLabel = React.forwardRef<SelectPrimitive.LabelRef, SelectPrimitive.LabelProps>(
114
+ ({ className, ...props }, ref) => (
115
+ <SelectPrimitive.Label
116
+ ref={ref}
117
+ className={cn(
118
+ 'py-1.5 native:pb-2 pl-8 native:pl-10 pr-2 text-popover-foreground text-sm native:text-base font-semibold',
119
+ className
120
+ )}
121
+ {...props}
122
+ />
123
+ )
124
+ );
135
125
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
136
126
 
137
- const SelectItem = React.forwardRef<
138
- React.ElementRef<typeof SelectPrimitive.Item>,
139
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
140
- >(({ className, children, ...props }, ref) => (
141
- <SelectPrimitive.Item
142
- ref={ref}
143
- className={cn(
144
- 'relative web:group flex flex-row w-full web:cursor-default web:select-none items-center rounded-sm py-1.5 native:py-2 pl-8 native:pl-10 pr-2 web:hover:bg-accent/50 active:bg-accent web:outline-none web:focus:bg-accent',
145
- props.disabled && 'web:pointer-events-none opacity-50',
146
- className
147
- )}
148
- {...props}
149
- >
150
- <View className='absolute left-2 native:left-3.5 flex h-3.5 native:pt-px w-3.5 items-center justify-center'>
151
- <SelectPrimitive.ItemIndicator>
152
- <Check size={16} strokeWidth={3} className='text-popover-foreground' />
153
- </SelectPrimitive.ItemIndicator>
154
- </View>
155
- <SelectPrimitive.ItemText className='text-sm native:text-lg text-popover-foreground native:text-base web:group-focus:text-accent-foreground' />
156
- </SelectPrimitive.Item>
157
- ));
127
+ const SelectItem = React.forwardRef<SelectPrimitive.ItemRef, SelectPrimitive.ItemProps>(
128
+ ({ className, children, ...props }, ref) => (
129
+ <SelectPrimitive.Item
130
+ ref={ref}
131
+ className={cn(
132
+ 'relative web:group flex flex-row w-full web:cursor-default web:select-none items-center rounded-sm py-1.5 native:py-2 pl-8 native:pl-10 pr-2 web:hover:bg-accent/50 active:bg-accent web:outline-none web:focus:bg-accent',
133
+ props.disabled && 'web:pointer-events-none opacity-50',
134
+ className
135
+ )}
136
+ {...props}
137
+ >
138
+ <View className='absolute left-2 native:left-3.5 flex h-3.5 native:pt-px w-3.5 items-center justify-center'>
139
+ <SelectPrimitive.ItemIndicator>
140
+ <Check size={16} strokeWidth={3} className='text-popover-foreground' />
141
+ </SelectPrimitive.ItemIndicator>
142
+ </View>
143
+ <SelectPrimitive.ItemText className='text-sm native:text-lg text-popover-foreground native:text-base web:group-focus:text-accent-foreground' />
144
+ </SelectPrimitive.Item>
145
+ )
146
+ );
158
147
  SelectItem.displayName = SelectPrimitive.Item.displayName;
159
148
 
160
149
  const SelectSeparator = React.forwardRef<
161
- React.ElementRef<typeof SelectPrimitive.Separator>,
162
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
150
+ SelectPrimitive.SeparatorRef,
151
+ SelectPrimitive.SeparatorProps
163
152
  >(({ className, ...props }, ref) => (
164
153
  <SelectPrimitive.Separator
165
154
  ref={ref}
@@ -1,23 +1,22 @@
1
- import * as React from 'react';
2
1
  import * as SeparatorPrimitive from '@rn-primitives/separator';
2
+ import * as React from 'react';
3
3
  import { cn } from '../../lib/utils';
4
4
 
5
- const Separator = React.forwardRef<
6
- React.ElementRef<typeof SeparatorPrimitive.Root>,
7
- React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
8
- >(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (
9
- <SeparatorPrimitive.Root
10
- ref={ref}
11
- decorative={decorative}
12
- orientation={orientation}
13
- className={cn(
14
- 'shrink-0 bg-border',
15
- orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',
16
- className
17
- )}
18
- {...props}
19
- />
20
- ));
5
+ const Separator = React.forwardRef<SeparatorPrimitive.RootRef, SeparatorPrimitive.RootProps>(
6
+ ({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (
7
+ <SeparatorPrimitive.Root
8
+ ref={ref}
9
+ decorative={decorative}
10
+ orientation={orientation}
11
+ className={cn(
12
+ 'shrink-0 bg-border',
13
+ orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',
14
+ className
15
+ )}
16
+ {...props}
17
+ />
18
+ )
19
+ );
21
20
  Separator.displayName = SeparatorPrimitive.Root.displayName;
22
21
 
23
22
  export { Separator };
@@ -10,28 +10,27 @@ import Animated, {
10
10
  import { useColorScheme } from '../../lib/useColorScheme';
11
11
  import { cn } from '../../lib/utils';
12
12
 
13
- const SwitchWeb = React.forwardRef<
14
- React.ElementRef<typeof SwitchPrimitives.Root>,
15
- React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
16
- >(({ className, ...props }, ref) => (
17
- <SwitchPrimitives.Root
18
- className={cn(
19
- 'peer flex-row h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed',
20
- props.checked ? 'bg-primary' : 'bg-input',
21
- props.disabled && 'opacity-50',
22
- className
23
- )}
24
- {...props}
25
- ref={ref}
26
- >
27
- <SwitchPrimitives.Thumb
13
+ const SwitchWeb = React.forwardRef<SwitchPrimitives.RootRef, SwitchPrimitives.RootProps>(
14
+ ({ className, ...props }, ref) => (
15
+ <SwitchPrimitives.Root
28
16
  className={cn(
29
- 'pointer-events-none block h-5 w-5 rounded-full bg-background shadow-md shadow-foreground/5 ring-0 transition-transform',
30
- props.checked ? 'translate-x-5' : 'translate-x-0'
17
+ 'peer flex-row h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed',
18
+ props.checked ? 'bg-primary' : 'bg-input',
19
+ props.disabled && 'opacity-50',
20
+ className
31
21
  )}
32
- />
33
- </SwitchPrimitives.Root>
34
- ));
22
+ {...props}
23
+ ref={ref}
24
+ >
25
+ <SwitchPrimitives.Thumb
26
+ className={cn(
27
+ 'pointer-events-none block h-5 w-5 rounded-full bg-background shadow-md shadow-foreground/5 ring-0 transition-transform',
28
+ props.checked ? 'translate-x-5' : 'translate-x-0'
29
+ )}
30
+ />
31
+ </SwitchPrimitives.Root>
32
+ )
33
+ );
35
34
 
36
35
  SwitchWeb.displayName = 'SwitchWeb';
37
36
 
@@ -46,46 +45,46 @@ const RGB_COLORS = {
46
45
  },
47
46
  } as const;
48
47
 
49
- const SwitchNative = React.forwardRef<
50
- React.ElementRef<typeof SwitchPrimitives.Root>,
51
- React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
52
- >(({ className, ...props }, ref) => {
53
- const { colorScheme } = useColorScheme();
54
- const translateX = useDerivedValue(() => (props.checked ? 18 : 0));
55
- const animatedRootStyle = useAnimatedStyle(() => {
56
- return {
57
- backgroundColor: interpolateColor(
58
- translateX.value,
59
- [0, 18],
60
- [RGB_COLORS[colorScheme].input, RGB_COLORS[colorScheme].primary]
61
- ),
62
- };
63
- });
64
- const animatedThumbStyle = useAnimatedStyle(() => ({
65
- transform: [{ translateX: withTiming(translateX.value, { duration: 200 }) }],
66
- }));
67
- return (
68
- <Animated.View
69
- style={animatedRootStyle}
70
- className={cn('h-8 w-[46px] rounded-full', props.disabled && 'opacity-50')}
71
- >
72
- <SwitchPrimitives.Root
73
- className={cn(
74
- 'flex-row h-8 w-[46px] shrink-0 items-center rounded-full border-2 border-transparent',
75
- className
76
- )}
77
- {...props}
78
- ref={ref}
48
+ const SwitchNative = React.forwardRef<SwitchPrimitives.RootRef, SwitchPrimitives.RootProps>(
49
+ ({ className, ...props }, ref) => {
50
+ const { colorScheme } = useColorScheme();
51
+ const translateX = useDerivedValue(() => (props.checked ? 18 : 0));
52
+ const animatedRootStyle = useAnimatedStyle(() => {
53
+ return {
54
+ backgroundColor: interpolateColor(
55
+ translateX.value,
56
+ [0, 18],
57
+ [RGB_COLORS[colorScheme].input, RGB_COLORS[colorScheme].primary]
58
+ ),
59
+ };
60
+ });
61
+ const animatedThumbStyle = useAnimatedStyle(() => ({
62
+ transform: [{ translateX: withTiming(translateX.value, { duration: 200 }) }],
63
+ }));
64
+ return (
65
+ <Animated.View
66
+ style={animatedRootStyle}
67
+ className={cn('h-8 w-[46px] rounded-full', props.disabled && 'opacity-50')}
79
68
  >
80
- <Animated.View style={animatedThumbStyle}>
81
- <SwitchPrimitives.Thumb
82
- className={'h-7 w-7 rounded-full bg-background shadow-md shadow-foreground/25 ring-0'}
83
- />
84
- </Animated.View>
85
- </SwitchPrimitives.Root>
86
- </Animated.View>
87
- );
88
- });
69
+ <SwitchPrimitives.Root
70
+ className={cn(
71
+ 'flex-row h-8 w-[46px] shrink-0 items-center rounded-full border-2 border-transparent',
72
+ props.checked ? 'bg-primary' : 'bg-input',
73
+ className
74
+ )}
75
+ {...props}
76
+ ref={ref}
77
+ >
78
+ <Animated.View style={animatedThumbStyle}>
79
+ <SwitchPrimitives.Thumb
80
+ className={'h-7 w-7 rounded-full bg-background shadow-md shadow-foreground/25 ring-0'}
81
+ />
82
+ </Animated.View>
83
+ </SwitchPrimitives.Root>
84
+ </Animated.View>
85
+ );
86
+ }
87
+ );
89
88
  SwitchNative.displayName = 'SwitchNative';
90
89
 
91
90
  const Switch = Platform.select({
@@ -1,99 +1,92 @@
1
- import * as React from 'react';
2
1
  import * as TablePrimitive from '@rn-primitives/table';
2
+ import * as React from 'react';
3
3
  import { cn } from '../../lib/utils';
4
4
  import { TextClassContext } from './text';
5
5
 
6
- const Table = React.forwardRef<
7
- React.ElementRef<typeof TablePrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof TablePrimitive.Root>
9
- >(({ className, ...props }, ref) => (
10
- <TablePrimitive.Root
11
- ref={ref}
12
- className={cn('w-full caption-bottom text-sm', className)}
13
- {...props}
14
- />
15
- ));
6
+ const Table = React.forwardRef<TablePrimitive.RootRef, TablePrimitive.RootProps>(
7
+ ({ className, ...props }, ref) => (
8
+ <TablePrimitive.Root
9
+ ref={ref}
10
+ className={cn('w-full caption-bottom text-sm', className)}
11
+ {...props}
12
+ />
13
+ )
14
+ );
16
15
  Table.displayName = 'Table';
17
16
 
18
- const TableHeader = React.forwardRef<
19
- React.ElementRef<typeof TablePrimitive.Header>,
20
- React.ComponentPropsWithoutRef<typeof TablePrimitive.Header>
21
- >(({ className, ...props }, ref) => (
22
- <TablePrimitive.Header
23
- ref={ref}
24
- className={cn('border-border [&_tr]:border-b', className)}
25
- {...props}
26
- />
27
- ));
17
+ const TableHeader = React.forwardRef<TablePrimitive.HeaderRef, TablePrimitive.HeaderProps>(
18
+ ({ className, ...props }, ref) => (
19
+ <TablePrimitive.Header
20
+ ref={ref}
21
+ className={cn('border-border [&_tr]:border-b', className)}
22
+ {...props}
23
+ />
24
+ )
25
+ );
28
26
  TableHeader.displayName = 'TableHeader';
29
27
 
30
- const TableBody = React.forwardRef<
31
- React.ElementRef<typeof TablePrimitive.Body>,
32
- React.ComponentPropsWithoutRef<typeof TablePrimitive.Body>
33
- >(({ className, style, ...props }, ref) => (
34
- <TablePrimitive.Body
35
- ref={ref}
36
- className={cn('flex-1 border-border [&_tr:last-child]:border-0', className)}
37
- style={[{ minHeight: 2 }, style]}
38
- {...props}
39
- />
40
- ));
28
+ const TableBody = React.forwardRef<TablePrimitive.BodyRef, TablePrimitive.BodyProps>(
29
+ ({ className, style, ...props }, ref) => (
30
+ <TablePrimitive.Body
31
+ ref={ref}
32
+ className={cn('flex-1 border-border [&_tr:last-child]:border-0', className)}
33
+ style={[{ minHeight: 2 }, style]}
34
+ {...props}
35
+ />
36
+ )
37
+ );
41
38
  TableBody.displayName = 'TableBody';
42
39
 
43
- const TableFooter = React.forwardRef<
44
- React.ElementRef<typeof TablePrimitive.Footer>,
45
- React.ComponentPropsWithoutRef<typeof TablePrimitive.Footer>
46
- >(({ className, ...props }, ref) => (
47
- <TablePrimitive.Footer
48
- ref={ref}
49
- className={cn('bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}
50
- {...props}
51
- />
52
- ));
40
+ const TableFooter = React.forwardRef<TablePrimitive.FooterRef, TablePrimitive.FooterProps>(
41
+ ({ className, ...props }, ref) => (
42
+ <TablePrimitive.Footer
43
+ ref={ref}
44
+ className={cn('bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}
45
+ {...props}
46
+ />
47
+ )
48
+ );
53
49
  TableFooter.displayName = 'TableFooter';
54
50
 
55
- const TableRow = React.forwardRef<
56
- React.ElementRef<typeof TablePrimitive.Row>,
57
- React.ComponentPropsWithoutRef<typeof TablePrimitive.Row>
58
- >(({ className, ...props }, ref) => (
59
- <TablePrimitive.Row
60
- ref={ref}
61
- className={cn(
62
- 'flex-row border-border border-b web:transition-colors web:hover:bg-muted/50 web:data-[state=selected]:bg-muted',
63
- className
64
- )}
65
- {...props}
66
- />
67
- ));
68
- TableRow.displayName = 'TableRow';
69
-
70
- const TableHead = React.forwardRef<
71
- React.ElementRef<typeof TablePrimitive.Head>,
72
- React.ComponentPropsWithoutRef<typeof TablePrimitive.Head>
73
- >(({ className, ...props }, ref) => (
74
- <TextClassContext.Provider value='text-muted-foreground'>
75
- <TablePrimitive.Head
51
+ const TableRow = React.forwardRef<TablePrimitive.RowRef, TablePrimitive.RowProps>(
52
+ ({ className, ...props }, ref) => (
53
+ <TablePrimitive.Row
76
54
  ref={ref}
77
55
  className={cn(
78
- 'h-12 px-4 text-left justify-center font-medium [&:has([role=checkbox])]:pr-0',
56
+ 'flex-row border-border border-b web:transition-colors web:hover:bg-muted/50 web:data-[state=selected]:bg-muted',
79
57
  className
80
58
  )}
81
59
  {...props}
82
60
  />
83
- </TextClassContext.Provider>
84
- ));
61
+ )
62
+ );
63
+ TableRow.displayName = 'TableRow';
64
+
65
+ const TableHead = React.forwardRef<TablePrimitive.HeadRef, TablePrimitive.HeadProps>(
66
+ ({ className, ...props }, ref) => (
67
+ <TextClassContext.Provider value='text-muted-foreground'>
68
+ <TablePrimitive.Head
69
+ ref={ref}
70
+ className={cn(
71
+ 'h-12 px-4 text-left justify-center font-medium [&:has([role=checkbox])]:pr-0',
72
+ className
73
+ )}
74
+ {...props}
75
+ />
76
+ </TextClassContext.Provider>
77
+ )
78
+ );
85
79
  TableHead.displayName = 'TableHead';
86
80
 
87
- const TableCell = React.forwardRef<
88
- React.ElementRef<typeof TablePrimitive.Cell>,
89
- React.ComponentPropsWithoutRef<typeof TablePrimitive.Cell>
90
- >(({ className, ...props }, ref) => (
91
- <TablePrimitive.Cell
92
- ref={ref}
93
- className={cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)}
94
- {...props}
95
- />
96
- ));
81
+ const TableCell = React.forwardRef<TablePrimitive.CellRef, TablePrimitive.CellProps>(
82
+ ({ className, ...props }, ref) => (
83
+ <TablePrimitive.Cell
84
+ ref={ref}
85
+ className={cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)}
86
+ {...props}
87
+ />
88
+ )
89
+ );
97
90
  TableCell.displayName = 'TableCell';
98
91
 
99
92
  export { Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow };