@react-native-reusables/cli 0.3.8 → 0.4.1

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