@react-native-reusables/cli 0.4.0 → 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 +1 -3
  40. package/dist/index.js +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/package.json +3 -3
@@ -16,42 +16,52 @@ import { ChevronDown } from '../../lib/icons/ChevronDown';
16
16
  import { cn } from '../../lib/utils';
17
17
  import { TextClassContext } from './text';
18
18
 
19
- const Accordion = React.forwardRef<AccordionPrimitive.RootRef, AccordionPrimitive.RootProps>(
20
- ({ children, ...props }, ref) => {
21
- return (
22
- <LayoutAnimationConfig skipEntering>
23
- <AccordionPrimitive.Root ref={ref} {...props} asChild={Platform.OS !== 'web'}>
24
- <Animated.View layout={LinearTransition.duration(200)}>{children}</Animated.View>
25
- </AccordionPrimitive.Root>
26
- </LayoutAnimationConfig>
27
- );
28
- }
29
- );
30
-
31
- Accordion.displayName = AccordionPrimitive.Root.displayName;
19
+ function Accordion({
20
+ children,
21
+ ...props
22
+ }: Omit<AccordionPrimitive.RootProps, 'asChild'> & {
23
+ ref?: React.RefObject<AccordionPrimitive.RootRef>;
24
+ }) {
25
+ return (
26
+ <LayoutAnimationConfig skipEntering>
27
+ <AccordionPrimitive.Root
28
+ {...(props as AccordionPrimitive.RootProps)}
29
+ asChild={Platform.OS !== 'web'}
30
+ >
31
+ <Animated.View layout={LinearTransition.duration(200)}>{children}</Animated.View>
32
+ </AccordionPrimitive.Root>
33
+ </LayoutAnimationConfig>
34
+ );
35
+ }
32
36
 
33
- const AccordionItem = React.forwardRef<AccordionPrimitive.ItemRef, AccordionPrimitive.ItemProps>(
34
- ({ className, value, ...props }, ref) => {
35
- return (
36
- <Animated.View className={'overflow-hidden'} layout={LinearTransition.duration(200)}>
37
- <AccordionPrimitive.Item
38
- ref={ref}
39
- className={cn('border-b border-border', className)}
40
- value={value}
41
- {...props}
42
- />
43
- </Animated.View>
44
- );
45
- }
46
- );
47
- AccordionItem.displayName = AccordionPrimitive.Item.displayName;
37
+ function AccordionItem({
38
+ className,
39
+ value,
40
+ ...props
41
+ }: AccordionPrimitive.ItemProps & {
42
+ ref?: React.RefObject<AccordionPrimitive.ItemRef>;
43
+ }) {
44
+ return (
45
+ <Animated.View className={'overflow-hidden'} layout={LinearTransition.duration(200)}>
46
+ <AccordionPrimitive.Item
47
+ className={cn('border-b border-border', className)}
48
+ value={value}
49
+ {...props}
50
+ />
51
+ </Animated.View>
52
+ );
53
+ }
48
54
 
49
55
  const Trigger = Platform.OS === 'web' ? View : Pressable;
50
56
 
51
- const AccordionTrigger = React.forwardRef<
52
- AccordionPrimitive.TriggerRef,
53
- AccordionPrimitive.TriggerProps
54
- >(({ className, children, ...props }, ref) => {
57
+ function AccordionTrigger({
58
+ className,
59
+ children,
60
+ ...props
61
+ }: AccordionPrimitive.TriggerProps & {
62
+ children?: React.ReactNode;
63
+ ref?: React.RefObject<AccordionPrimitive.TriggerRef>;
64
+ }) {
55
65
  const { isExpanded } = AccordionPrimitive.useItemContext();
56
66
 
57
67
  const progress = useDerivedValue(() =>
@@ -65,14 +75,14 @@ const AccordionTrigger = React.forwardRef<
65
75
  return (
66
76
  <TextClassContext.Provider value='native:text-lg font-medium web:group-hover:underline'>
67
77
  <AccordionPrimitive.Header className='flex'>
68
- <AccordionPrimitive.Trigger ref={ref} {...props} asChild>
78
+ <AccordionPrimitive.Trigger {...props} asChild>
69
79
  <Trigger
70
80
  className={cn(
71
81
  'flex flex-row web:flex-1 items-center justify-between py-4 web:transition-all group web:focus-visible:outline-none web:focus-visible:ring-1 web:focus-visible:ring-muted-foreground',
72
82
  className
73
83
  )}
74
84
  >
75
- <>{children}</>
85
+ {children}
76
86
  <Animated.View style={chevronStyle}>
77
87
  <ChevronDown size={18} className={'text-foreground shrink-0'} />
78
88
  </Animated.View>
@@ -81,13 +91,15 @@ const AccordionTrigger = React.forwardRef<
81
91
  </AccordionPrimitive.Header>
82
92
  </TextClassContext.Provider>
83
93
  );
84
- });
85
- AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
94
+ }
86
95
 
87
- const AccordionContent = React.forwardRef<
88
- AccordionPrimitive.ContentRef,
89
- AccordionPrimitive.ContentProps
90
- >(({ className, children, ...props }, ref) => {
96
+ function AccordionContent({
97
+ className,
98
+ children,
99
+ ...props
100
+ }: AccordionPrimitive.ContentProps & {
101
+ ref?: React.RefObject<AccordionPrimitive.ContentRef>;
102
+ }) {
91
103
  const { isExpanded } = AccordionPrimitive.useItemContext();
92
104
  return (
93
105
  <TextClassContext.Provider value='native:text-lg'>
@@ -96,14 +108,13 @@ const AccordionContent = React.forwardRef<
96
108
  'overflow-hidden text-sm web:transition-all',
97
109
  isExpanded ? 'web:animate-accordion-down' : 'web:animate-accordion-up'
98
110
  )}
99
- ref={ref}
100
111
  {...props}
101
112
  >
102
113
  <InnerContent className={cn('pb-4', className)}>{children}</InnerContent>
103
114
  </AccordionPrimitive.Content>
104
115
  </TextClassContext.Provider>
105
116
  );
106
- });
117
+ }
107
118
 
108
119
  function InnerContent({ children, className }: { children: React.ReactNode; className?: string }) {
109
120
  if (Platform.OS === 'web') {
@@ -120,6 +131,4 @@ function InnerContent({ children, className }: { children: React.ReactNode; clas
120
131
  );
121
132
  }
122
133
 
123
- AccordionContent.displayName = AccordionPrimitive.Content.displayName;
124
-
125
134
  export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
@@ -1,6 +1,6 @@
1
1
  import * as AlertDialogPrimitive from '@rn-primitives/alert-dialog';
2
2
  import * as React from 'react';
3
- import { Platform, StyleSheet, View, type ViewProps } from 'react-native';
3
+ import { Platform, View, type ViewProps } from 'react-native';
4
4
  import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
5
5
  import { buttonTextVariants, buttonVariants } from '../../components/ui/button';
6
6
  import { cn } from '../../lib/utils';
@@ -12,10 +12,12 @@ const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
12
12
 
13
13
  const AlertDialogPortal = AlertDialogPrimitive.Portal;
14
14
 
15
- const AlertDialogOverlayWeb = React.forwardRef<
16
- AlertDialogPrimitive.OverlayRef,
17
- AlertDialogPrimitive.OverlayProps
18
- >(({ className, ...props }, ref) => {
15
+ function AlertDialogOverlayWeb({
16
+ className,
17
+ ...props
18
+ }: AlertDialogPrimitive.OverlayProps & {
19
+ ref?: React.RefObject<AlertDialogPrimitive.OverlayRef>;
20
+ }) {
19
21
  const { open } = AlertDialogPrimitive.useRootContext();
20
22
  return (
21
23
  <AlertDialogPrimitive.Overlay
@@ -25,23 +27,24 @@ const AlertDialogOverlayWeb = React.forwardRef<
25
27
  className
26
28
  )}
27
29
  {...props}
28
- ref={ref}
29
30
  />
30
31
  );
31
- });
32
-
33
- AlertDialogOverlayWeb.displayName = 'AlertDialogOverlayWeb';
34
-
35
- const AlertDialogOverlayNative = React.forwardRef<
36
- AlertDialogPrimitive.OverlayRef,
37
- AlertDialogPrimitive.OverlayProps
38
- >(({ className, children, ...props }, ref) => {
32
+ }
33
+
34
+ function AlertDialogOverlayNative({
35
+ className,
36
+ children,
37
+ ...props
38
+ }: AlertDialogPrimitive.OverlayProps & {
39
+ ref?: React.RefObject<AlertDialogPrimitive.OverlayRef>;
40
+ }) {
39
41
  return (
40
42
  <AlertDialogPrimitive.Overlay
41
- style={StyleSheet.absoluteFill}
42
- className={cn('z-50 bg-black/80 flex justify-center items-center p-2', className)}
43
+ className={cn(
44
+ 'z-50 absolute top-0 right-0 bottom-0 left-0 bg-black/80 flex justify-center items-center p-2',
45
+ className
46
+ )}
43
47
  {...props}
44
- ref={ref}
45
48
  asChild
46
49
  >
47
50
  <Animated.View entering={FadeIn.duration(150)} exiting={FadeOut.duration(150)}>
@@ -49,26 +52,27 @@ const AlertDialogOverlayNative = React.forwardRef<
49
52
  </Animated.View>
50
53
  </AlertDialogPrimitive.Overlay>
51
54
  );
52
- });
53
-
54
- AlertDialogOverlayNative.displayName = 'AlertDialogOverlayNative';
55
+ }
55
56
 
56
57
  const AlertDialogOverlay = Platform.select({
57
58
  web: AlertDialogOverlayWeb,
58
59
  default: AlertDialogOverlayNative,
59
60
  });
60
61
 
61
- const AlertDialogContent = React.forwardRef<
62
- AlertDialogPrimitive.ContentRef,
63
- AlertDialogPrimitive.ContentProps & { portalHost?: string }
64
- >(({ className, portalHost, ...props }, ref) => {
62
+ function AlertDialogContent({
63
+ className,
64
+ portalHost,
65
+ ...props
66
+ }: AlertDialogPrimitive.ContentProps & {
67
+ ref?: React.RefObject<AlertDialogPrimitive.ContentRef>;
68
+ portalHost?: string;
69
+ }) {
65
70
  const { open } = AlertDialogPrimitive.useRootContext();
66
71
 
67
72
  return (
68
73
  <AlertDialogPortal hostName={portalHost}>
69
74
  <AlertDialogOverlay>
70
75
  <AlertDialogPrimitive.Content
71
- ref={ref}
72
76
  className={cn(
73
77
  'z-50 max-w-lg gap-4 border border-border bg-background p-6 shadow-lg shadow-foreground/10 web:duration-200 rounded-lg',
74
78
  open
@@ -81,69 +85,77 @@ const AlertDialogContent = React.forwardRef<
81
85
  </AlertDialogOverlay>
82
86
  </AlertDialogPortal>
83
87
  );
84
- });
85
- AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
86
-
87
- const AlertDialogHeader = ({ className, ...props }: ViewProps) => (
88
- <View className={cn('flex flex-col gap-2', className)} {...props} />
89
- );
90
- AlertDialogHeader.displayName = 'AlertDialogHeader';
91
-
92
- const AlertDialogFooter = ({ className, ...props }: ViewProps) => (
93
- <View
94
- className={cn('flex flex-col-reverse sm:flex-row sm:justify-end gap-2', className)}
95
- {...props}
96
- />
97
- );
98
- AlertDialogFooter.displayName = 'AlertDialogFooter';
88
+ }
99
89
 
100
- const AlertDialogTitle = React.forwardRef<
101
- AlertDialogPrimitive.TitleRef,
102
- AlertDialogPrimitive.TitleProps
103
- >(({ className, ...props }, ref) => (
104
- <AlertDialogPrimitive.Title
105
- ref={ref}
106
- className={cn('text-lg native:text-xl text-foreground font-semibold', className)}
107
- {...props}
108
- />
109
- ));
110
- AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
90
+ function AlertDialogHeader({ className, ...props }: ViewProps) {
91
+ return <View className={cn('flex flex-col gap-2', className)} {...props} />;
92
+ }
111
93
 
112
- const AlertDialogDescription = React.forwardRef<
113
- AlertDialogPrimitive.DescriptionRef,
114
- AlertDialogPrimitive.DescriptionProps
115
- >(({ className, ...props }, ref) => (
116
- <AlertDialogPrimitive.Description
117
- ref={ref}
118
- className={cn('text-sm native:text-base text-muted-foreground', className)}
119
- {...props}
120
- />
121
- ));
122
- AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
123
-
124
- const AlertDialogAction = React.forwardRef<
125
- AlertDialogPrimitive.ActionRef,
126
- AlertDialogPrimitive.ActionProps
127
- >(({ className, ...props }, ref) => (
128
- <TextClassContext.Provider value={buttonTextVariants({ className })}>
129
- <AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
130
- </TextClassContext.Provider>
131
- ));
132
- AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
133
-
134
- const AlertDialogCancel = React.forwardRef<
135
- AlertDialogPrimitive.CancelRef,
136
- AlertDialogPrimitive.CancelProps
137
- >(({ className, ...props }, ref) => (
138
- <TextClassContext.Provider value={buttonTextVariants({ className, variant: 'outline' })}>
139
- <AlertDialogPrimitive.Cancel
140
- ref={ref}
141
- className={cn(buttonVariants({ variant: 'outline', className }))}
94
+ function AlertDialogFooter({ className, ...props }: ViewProps) {
95
+ return (
96
+ <View
97
+ className={cn('flex flex-col-reverse sm:flex-row sm:justify-end gap-2', className)}
142
98
  {...props}
143
99
  />
144
- </TextClassContext.Provider>
145
- ));
146
- AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
100
+ );
101
+ }
102
+
103
+ function AlertDialogTitle({
104
+ className,
105
+ ...props
106
+ }: AlertDialogPrimitive.TitleProps & {
107
+ ref?: React.RefObject<AlertDialogPrimitive.TitleRef>;
108
+ }) {
109
+ return (
110
+ <AlertDialogPrimitive.Title
111
+ className={cn('text-lg native:text-xl text-foreground font-semibold', className)}
112
+ {...props}
113
+ />
114
+ );
115
+ }
116
+
117
+ function AlertDialogDescription({
118
+ className,
119
+ ...props
120
+ }: AlertDialogPrimitive.DescriptionProps & {
121
+ ref?: React.RefObject<AlertDialogPrimitive.DescriptionRef>;
122
+ }) {
123
+ return (
124
+ <AlertDialogPrimitive.Description
125
+ className={cn('text-sm native:text-base text-muted-foreground', className)}
126
+ {...props}
127
+ />
128
+ );
129
+ }
130
+
131
+ function AlertDialogAction({
132
+ className,
133
+ ...props
134
+ }: AlertDialogPrimitive.ActionProps & {
135
+ ref?: React.RefObject<AlertDialogPrimitive.ActionRef>;
136
+ }) {
137
+ return (
138
+ <TextClassContext.Provider value={buttonTextVariants({ className })}>
139
+ <AlertDialogPrimitive.Action className={cn(buttonVariants(), className)} {...props} />
140
+ </TextClassContext.Provider>
141
+ );
142
+ }
143
+
144
+ function AlertDialogCancel({
145
+ className,
146
+ ...props
147
+ }: AlertDialogPrimitive.CancelProps & {
148
+ ref?: React.RefObject<AlertDialogPrimitive.CancelRef>;
149
+ }) {
150
+ return (
151
+ <TextClassContext.Provider value={buttonTextVariants({ className, variant: 'outline' })}>
152
+ <AlertDialogPrimitive.Cancel
153
+ className={cn(buttonVariants({ variant: 'outline', className }))}
154
+ {...props}
155
+ />
156
+ </TextClassContext.Provider>
157
+ );
158
+ }
147
159
 
148
160
  export {
149
161
  AlertDialog,
@@ -21,18 +21,24 @@ const alertVariants = cva(
21
21
  }
22
22
  );
23
23
 
24
- const Alert = React.forwardRef<
25
- React.ElementRef<typeof View>,
26
- ViewProps &
27
- VariantProps<typeof alertVariants> & {
28
- icon: LucideIcon;
29
- iconSize?: number;
30
- iconClassName?: string;
31
- }
32
- >(({ className, variant, children, icon: Icon, iconSize = 16, iconClassName, ...props }, ref) => {
24
+ function Alert({
25
+ className,
26
+ variant,
27
+ children,
28
+ icon: Icon,
29
+ iconSize = 16,
30
+ iconClassName,
31
+ ...props
32
+ }: ViewProps &
33
+ VariantProps<typeof alertVariants> & {
34
+ ref?: React.RefObject<View>;
35
+ icon: LucideIcon;
36
+ iconSize?: number;
37
+ iconClassName?: string;
38
+ }) {
33
39
  const { colors } = useTheme();
34
40
  return (
35
- <View ref={ref} role='alert' className={alertVariants({ variant, className })} {...props}>
41
+ <View role='alert' className={alertVariants({ variant, className })} {...props}>
36
42
  <View className='absolute left-3.5 top-4 -translate-y-0.5'>
37
43
  <Icon
38
44
  size={iconSize}
@@ -42,34 +48,24 @@ const Alert = React.forwardRef<
42
48
  {children}
43
49
  </View>
44
50
  );
45
- });
46
- Alert.displayName = 'Alert';
51
+ }
47
52
 
48
- const AlertTitle = React.forwardRef<
49
- React.ElementRef<typeof Text>,
50
- React.ComponentPropsWithoutRef<typeof Text>
51
- >(({ className, ...props }, ref) => (
52
- <Text
53
- ref={ref}
54
- className={cn(
55
- 'pl-7 mb-1 font-medium text-base leading-none tracking-tight text-foreground',
56
- className
57
- )}
58
- {...props}
59
- />
60
- ));
61
- AlertTitle.displayName = 'AlertTitle';
53
+ function AlertTitle({ className, ...props }: React.ComponentProps<typeof Text>) {
54
+ return (
55
+ <Text
56
+ className={cn(
57
+ 'pl-7 mb-1 font-medium text-base leading-none tracking-tight text-foreground',
58
+ className
59
+ )}
60
+ {...props}
61
+ />
62
+ );
63
+ }
62
64
 
63
- const AlertDescription = React.forwardRef<
64
- React.ElementRef<typeof Text>,
65
- React.ComponentPropsWithoutRef<typeof Text>
66
- >(({ className, ...props }, ref) => (
67
- <Text
68
- ref={ref}
69
- className={cn('pl-7 text-sm leading-relaxed text-foreground', className)}
70
- {...props}
71
- />
72
- ));
73
- AlertDescription.displayName = 'AlertDescription';
65
+ function AlertDescription({ className, ...props }: React.ComponentProps<typeof Text>) {
66
+ return (
67
+ <Text className={cn('pl-7 text-sm leading-relaxed text-foreground', className)} {...props} />
68
+ );
69
+ }
74
70
 
75
71
  export { Alert, AlertDescription, AlertTitle };
@@ -2,40 +2,46 @@ import * as AvatarPrimitive from '@rn-primitives/avatar';
2
2
  import * as React from 'react';
3
3
  import { cn } from '../../lib/utils';
4
4
 
5
- const Avatar = React.forwardRef<AvatarPrimitive.RootRef, AvatarPrimitive.RootProps>(
6
- ({ className, ...props }, ref) => (
5
+ function Avatar({
6
+ className,
7
+ ...props
8
+ }: AvatarPrimitive.RootProps & {
9
+ ref?: React.RefObject<AvatarPrimitive.RootRef>;
10
+ }) {
11
+ return (
7
12
  <AvatarPrimitive.Root
8
- ref={ref}
9
13
  className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
10
14
  {...props}
11
15
  />
12
- )
13
- );
14
- Avatar.displayName = AvatarPrimitive.Root.displayName;
16
+ );
17
+ }
15
18
 
16
- const AvatarImage = React.forwardRef<AvatarPrimitive.ImageRef, AvatarPrimitive.ImageProps>(
17
- ({ className, ...props }, ref) => (
18
- <AvatarPrimitive.Image
19
- ref={ref}
20
- className={cn('aspect-square h-full w-full', className)}
21
- {...props}
22
- />
23
- )
24
- );
25
- AvatarImage.displayName = AvatarPrimitive.Image.displayName;
19
+ function AvatarImage({
20
+ className,
21
+ ...props
22
+ }: AvatarPrimitive.ImageProps & {
23
+ ref?: React.RefObject<AvatarPrimitive.ImageRef>;
24
+ }) {
25
+ return (
26
+ <AvatarPrimitive.Image className={cn('aspect-square h-full w-full', className)} {...props} />
27
+ );
28
+ }
26
29
 
27
- const AvatarFallback = React.forwardRef<AvatarPrimitive.FallbackRef, AvatarPrimitive.FallbackProps>(
28
- ({ className, ...props }, ref) => (
30
+ function AvatarFallback({
31
+ className,
32
+ ...props
33
+ }: AvatarPrimitive.FallbackProps & {
34
+ ref?: React.RefObject<AvatarPrimitive.FallbackRef>;
35
+ }) {
36
+ return (
29
37
  <AvatarPrimitive.Fallback
30
- ref={ref}
31
38
  className={cn(
32
39
  'flex h-full w-full items-center justify-center rounded-full bg-muted',
33
40
  className
34
41
  )}
35
42
  {...props}
36
43
  />
37
- )
38
- );
39
- AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
44
+ );
45
+ }
40
46
 
41
47
  export { Avatar, AvatarFallback, AvatarImage };
@@ -1,7 +1,6 @@
1
1
  import * as Slot from '@rn-primitives/slot';
2
- import type { SlottableViewProps } from '@rn-primitives/types';
3
2
  import { cva, type VariantProps } from 'class-variance-authority';
4
- import { View } from 'react-native';
3
+ import { View, ViewProps } from 'react-native';
5
4
  import { cn } from '../../lib/utils';
6
5
  import { TextClassContext } from './text';
7
6
 
@@ -36,7 +35,9 @@ const badgeTextVariants = cva('text-xs font-semibold ', {
36
35
  },
37
36
  });
38
37
 
39
- type BadgeProps = SlottableViewProps & VariantProps<typeof badgeVariants>;
38
+ type BadgeProps = ViewProps & {
39
+ asChild?: boolean;
40
+ } & VariantProps<typeof badgeVariants>;
40
41
 
41
42
  function Badge({ className, variant, asChild, ...props }: BadgeProps) {
42
43
  const Component = asChild ? Slot.View : View;
@@ -57,29 +57,25 @@ const buttonTextVariants = cva(
57
57
  }
58
58
  );
59
59
 
60
- type ButtonProps = React.ComponentPropsWithoutRef<typeof Pressable> &
61
- VariantProps<typeof buttonVariants>;
60
+ type ButtonProps = React.ComponentProps<typeof Pressable> & VariantProps<typeof buttonVariants>;
62
61
 
63
- const Button = React.forwardRef<React.ElementRef<typeof Pressable>, ButtonProps>(
64
- ({ className, variant, size, ...props }, ref) => {
65
- return (
66
- <TextClassContext.Provider
67
- value={buttonTextVariants({ variant, size, className: 'web:pointer-events-none' })}
68
- >
69
- <Pressable
70
- className={cn(
71
- props.disabled && 'opacity-50 web:pointer-events-none',
72
- buttonVariants({ variant, size, className })
73
- )}
74
- ref={ref}
75
- role='button'
76
- {...props}
77
- />
78
- </TextClassContext.Provider>
79
- );
80
- }
81
- );
82
- Button.displayName = 'Button';
62
+ function Button({ ref, className, variant, size, ...props }: ButtonProps) {
63
+ return (
64
+ <TextClassContext.Provider
65
+ value={buttonTextVariants({ variant, size, className: 'web:pointer-events-none' })}
66
+ >
67
+ <Pressable
68
+ className={cn(
69
+ props.disabled && 'opacity-50 web:pointer-events-none',
70
+ buttonVariants({ variant, size, className })
71
+ )}
72
+ ref={ref}
73
+ role='button'
74
+ {...props}
75
+ />
76
+ </TextClassContext.Provider>
77
+ );
78
+ }
83
79
 
84
80
  export { Button, buttonTextVariants, buttonVariants };
85
81
  export type { ButtonProps };