@gv-tech/ui-native 2.23.3 → 2.25.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 (67) hide show
  1. package/dist/__contracts.d.ts +2 -0
  2. package/dist/__contracts.d.ts.map +1 -0
  3. package/dist/accordion.d.ts +4 -4
  4. package/dist/accordion.d.ts.map +1 -1
  5. package/dist/alert-dialog.d.ts +6 -6
  6. package/dist/alert-dialog.d.ts.map +1 -1
  7. package/dist/avatar.d.ts +3 -3
  8. package/dist/avatar.d.ts.map +1 -1
  9. package/dist/button.d.ts +2 -2
  10. package/dist/button.d.ts.map +1 -1
  11. package/dist/calendar.d.ts +111 -1
  12. package/dist/calendar.d.ts.map +1 -1
  13. package/dist/combobox.d.ts +17 -10
  14. package/dist/combobox.d.ts.map +1 -1
  15. package/dist/dialog.d.ts +4 -4
  16. package/dist/dialog.d.ts.map +1 -1
  17. package/dist/drawer.d.ts +1 -1
  18. package/dist/drawer.d.ts.map +1 -1
  19. package/dist/form.d.ts +3 -1
  20. package/dist/form.d.ts.map +1 -1
  21. package/dist/hooks/use-theme.d.ts +1 -1
  22. package/dist/sheet.d.ts +4 -4
  23. package/dist/sheet.d.ts.map +1 -1
  24. package/dist/theme-toggle.d.ts.map +1 -1
  25. package/dist/tooltip.d.ts +1 -1
  26. package/dist/tooltip.d.ts.map +1 -1
  27. package/dist/ui-native.cjs +2 -2
  28. package/dist/ui-native.esm.js +1086 -945
  29. package/package.json +2 -1
  30. package/src/__contracts.ts +880 -0
  31. package/src/accordion.tsx +10 -10
  32. package/src/alert-dialog.tsx +12 -12
  33. package/src/alert.tsx +3 -3
  34. package/src/avatar.tsx +6 -6
  35. package/src/button.tsx +5 -1
  36. package/src/calendar.tsx +52 -3
  37. package/src/card.tsx +6 -6
  38. package/src/carousel.tsx +2 -2
  39. package/src/checkbox.tsx +1 -1
  40. package/src/combobox.tsx +190 -27
  41. package/src/context-menu.tsx +9 -9
  42. package/src/dialog.tsx +76 -29
  43. package/src/drawer.tsx +12 -12
  44. package/src/dropdown-menu.tsx +11 -11
  45. package/src/form.tsx +6 -6
  46. package/src/hover-card.tsx +1 -1
  47. package/src/input.tsx +1 -1
  48. package/src/label.tsx +1 -1
  49. package/src/menubar.tsx +17 -17
  50. package/src/navigation-menu.tsx +8 -8
  51. package/src/popover.tsx +4 -4
  52. package/src/progress.tsx +1 -1
  53. package/src/radio-group.tsx +2 -2
  54. package/src/search.tsx +1 -1
  55. package/src/select.tsx +7 -7
  56. package/src/separator.tsx +1 -1
  57. package/src/sheet.tsx +4 -4
  58. package/src/switch.tsx +1 -1
  59. package/src/table.tsx +8 -8
  60. package/src/tabs.tsx +4 -4
  61. package/src/text.tsx +1 -1
  62. package/src/textarea.tsx +1 -1
  63. package/src/theme-toggle.tsx +16 -13
  64. package/src/toast.tsx +5 -5
  65. package/src/toggle-group.tsx +2 -2
  66. package/src/toggle.tsx +1 -1
  67. package/src/tooltip.tsx +2 -2
@@ -31,7 +31,7 @@ export const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
31
31
  export const ContextMenuSub = ContextMenuPrimitive.Sub;
32
32
 
33
33
  const ContextMenuOverlay = React.forwardRef<
34
- React.ElementRef<typeof ContextMenuPrimitive.Overlay>,
34
+ React.ComponentRef<typeof ContextMenuPrimitive.Overlay>,
35
35
  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Overlay>
36
36
  >(({ className, ...props }, ref) => {
37
37
  return (
@@ -51,7 +51,7 @@ const ContextMenuOverlay = React.forwardRef<
51
51
  ContextMenuOverlay.displayName = 'ContextMenuOverlay';
52
52
 
53
53
  export const ContextMenuContent = React.forwardRef<
54
- React.ElementRef<typeof ContextMenuPrimitive.Content>,
54
+ React.ComponentRef<typeof ContextMenuPrimitive.Content>,
55
55
  ContextMenuContentBaseProps
56
56
  >(({ className, children, ...props }, ref) => {
57
57
  return (
@@ -73,7 +73,7 @@ export const ContextMenuContent = React.forwardRef<
73
73
  ContextMenuContent.displayName = 'ContextMenuContent';
74
74
 
75
75
  export const ContextMenuItem = React.forwardRef<
76
- React.ElementRef<typeof ContextMenuPrimitive.Item>,
76
+ React.ComponentRef<typeof ContextMenuPrimitive.Item>,
77
77
  ContextMenuItemBaseProps
78
78
  >(({ className, children, inset, ...props }, ref) => {
79
79
  return (
@@ -93,7 +93,7 @@ export const ContextMenuItem = React.forwardRef<
93
93
  ContextMenuItem.displayName = 'ContextMenuItem';
94
94
 
95
95
  export const ContextMenuCheckboxItem = React.forwardRef<
96
- React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
96
+ React.ComponentRef<typeof ContextMenuPrimitive.CheckboxItem>,
97
97
  ContextMenuCheckboxItemBaseProps
98
98
  >(({ className, children, checked, onCheckedChange, ...props }, ref) => {
99
99
  return (
@@ -119,7 +119,7 @@ export const ContextMenuCheckboxItem = React.forwardRef<
119
119
  ContextMenuCheckboxItem.displayName = 'ContextMenuCheckboxItem';
120
120
 
121
121
  export const ContextMenuRadioItem = React.forwardRef<
122
- React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
122
+ React.ComponentRef<typeof ContextMenuPrimitive.RadioItem>,
123
123
  ContextMenuRadioItemBaseProps
124
124
  >(({ className, children, value, ...props }, ref) => {
125
125
  return (
@@ -144,7 +144,7 @@ export const ContextMenuRadioItem = React.forwardRef<
144
144
  ContextMenuRadioItem.displayName = 'ContextMenuRadioItem';
145
145
 
146
146
  export const ContextMenuLabel = React.forwardRef<
147
- React.ElementRef<typeof ContextMenuPrimitive.Label>,
147
+ React.ComponentRef<typeof ContextMenuPrimitive.Label>,
148
148
  ContextMenuLabelBaseProps
149
149
  >(({ className, children, inset, ...props }, ref) => {
150
150
  return (
@@ -160,7 +160,7 @@ export const ContextMenuLabel = React.forwardRef<
160
160
  ContextMenuLabel.displayName = 'ContextMenuLabel';
161
161
 
162
162
  export const ContextMenuSeparator = React.forwardRef<
163
- React.ElementRef<typeof ContextMenuPrimitive.Separator>,
163
+ React.ComponentRef<typeof ContextMenuPrimitive.Separator>,
164
164
  ContextMenuSeparatorBaseProps
165
165
  >(({ className, ...props }, ref) => {
166
166
  return <ContextMenuPrimitive.Separator ref={ref} className={cn('bg-border -mx-1 my-1 h-px', className)} {...props} />;
@@ -177,7 +177,7 @@ export const ContextMenuShortcut = ({ className, children, ...props }: ContextMe
177
177
  ContextMenuShortcut.displayName = 'ContextMenuShortcut';
178
178
 
179
179
  export const ContextMenuSubTrigger = React.forwardRef<
180
- React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
180
+ React.ComponentRef<typeof ContextMenuPrimitive.SubTrigger>,
181
181
  ContextMenuSubTriggerBaseProps
182
182
  >(({ className, children, inset, ...props }, ref) => {
183
183
  return (
@@ -198,7 +198,7 @@ export const ContextMenuSubTrigger = React.forwardRef<
198
198
  ContextMenuSubTrigger.displayName = 'ContextMenuSubTrigger';
199
199
 
200
200
  export const ContextMenuSubContent = React.forwardRef<
201
- React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
201
+ React.ComponentRef<typeof ContextMenuPrimitive.SubContent>,
202
202
  ContextMenuSubContentBaseProps
203
203
  >(({ className, children, ...props }, ref) => {
204
204
  return (
package/src/dialog.tsx CHANGED
@@ -2,7 +2,7 @@ import { DialogBaseProps, DialogContentBaseProps } from '@gv-tech/ui-core';
2
2
  import * as DialogPrimitive from '@rn-primitives/dialog';
3
3
  import { X } from 'lucide-react-native';
4
4
  import * as React from 'react';
5
- import { StyleSheet, View, type ViewStyle } from 'react-native';
5
+ import { Platform, View, type StyleProp, type ViewStyle } from 'react-native';
6
6
  import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
7
7
 
8
8
  import { cn } from './lib/utils';
@@ -25,51 +25,98 @@ const DialogPortal = DialogPrimitive.Portal;
25
25
  const DialogClose = DialogPrimitive.Close;
26
26
 
27
27
  export type DialogOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
28
- export type DialogOverlayRef = React.ElementRef<typeof DialogPrimitive.Overlay>;
28
+ export type DialogOverlayRef = React.ComponentRef<typeof DialogPrimitive.Overlay>;
29
29
 
30
30
  const DialogOverlay: React.ForwardRefExoticComponent<DialogOverlayProps & React.RefAttributes<DialogOverlayRef>> =
31
- React.forwardRef<DialogOverlayRef, DialogOverlayProps>(({ className, ...props }, ref) => {
31
+ React.forwardRef<DialogOverlayRef, DialogOverlayProps>(({ className, style, ...props }, ref) => {
32
32
  return (
33
- <DialogPrimitive.Overlay style={StyleSheet.absoluteFill} asChild ref={ref} {...props}>
33
+ <DialogPrimitive.Overlay
34
+ style={[
35
+ {
36
+ position: Platform.OS === 'web' ? 'fixed' : 'absolute',
37
+ top: 0,
38
+ right: 0,
39
+ bottom: 0,
40
+ left: 0,
41
+ zIndex: 50,
42
+ } as unknown as ViewStyle,
43
+ style as StyleProp<ViewStyle>,
44
+ ]}
45
+ asChild
46
+ ref={ref}
47
+ {...props}
48
+ >
34
49
  <Animated.View
35
50
  entering={FadeIn.duration(150)}
36
51
  exiting={FadeOut.duration(150)}
37
- className={cn('z-50 flex items-center justify-center bg-black/80 p-2', className)}
52
+ className={cn('flex items-center justify-center bg-black/80 p-2', className)}
38
53
  />
39
54
  </DialogPrimitive.Overlay>
40
55
  );
41
56
  });
42
57
  DialogOverlay.displayName = DialogPrimitive.Overlay?.displayName || 'DialogOverlay';
43
58
 
44
- export type DialogContentRef = React.ElementRef<typeof DialogPrimitive.Content>;
59
+ export type DialogContentRef = React.ComponentRef<typeof DialogPrimitive.Content>;
45
60
  const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<DialogContentRef>> =
46
61
  React.forwardRef<DialogContentRef, DialogContentProps>(
47
62
  ({ className, children, portalHost, overlayClassName, overlayStyle, ...props }, ref) => {
63
+ const PlatformWrapper = React.useCallback(({ children }: { children: React.ReactNode }) => {
64
+ if (Platform.OS === 'web') {
65
+ return <>{children}</>;
66
+ }
67
+ return (
68
+ <View
69
+ pointerEvents="box-none"
70
+ style={{
71
+ position: 'absolute',
72
+ top: 0,
73
+ right: 0,
74
+ bottom: 0,
75
+ left: 0,
76
+ zIndex: 50,
77
+ alignItems: 'center',
78
+ justifyContent: 'center',
79
+ padding: 16,
80
+ }}
81
+ >
82
+ {children}
83
+ </View>
84
+ );
85
+ }, []);
86
+
48
87
  return (
49
88
  <DialogPortal hostName={portalHost}>
50
89
  <DialogOverlay className={overlayClassName} style={overlayStyle} />
51
- <DialogPrimitive.Content ref={ref} asChild {...props}>
52
- <Animated.View
53
- entering={FadeIn.duration(150)}
54
- exiting={FadeOut.duration(150)}
55
- className={cn(
56
- 'border-border bg-background z-50 w-full max-w-lg gap-4 rounded-xl border p-6 shadow-lg sm:rounded-lg',
57
- className,
58
- )}
59
- >
60
- {children}
61
- <DialogPrimitive.Close
62
- className={
63
- 'ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none'
64
- }
90
+ <PlatformWrapper>
91
+ <DialogPrimitive.Content ref={ref} {...props}>
92
+ <View
93
+ pointerEvents="box-none"
94
+ className="absolute inset-0 z-50 flex items-center justify-center"
95
+ style={Platform.OS === 'web' ? ({ position: 'fixed' } as unknown as ViewStyle) : undefined}
65
96
  >
66
- <X size={18} className="text-muted-foreground" />
67
- <View className="sr-only">
68
- <DialogPrimitive.Title>Close</DialogPrimitive.Title>
69
- </View>
70
- </DialogPrimitive.Close>
71
- </Animated.View>
72
- </DialogPrimitive.Content>
97
+ <Animated.View
98
+ entering={FadeIn.duration(150)}
99
+ exiting={FadeOut.duration(150)}
100
+ className={cn(
101
+ 'border-border bg-background w-full max-w-lg gap-4 rounded-xl border p-6 shadow-lg sm:rounded-lg',
102
+ className,
103
+ )}
104
+ >
105
+ {children}
106
+ <DialogPrimitive.Close
107
+ className={
108
+ 'ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none'
109
+ }
110
+ >
111
+ <X size={18} className="text-muted-foreground" />
112
+ <View className="sr-only">
113
+ <DialogPrimitive.Title>Close</DialogPrimitive.Title>
114
+ </View>
115
+ </DialogPrimitive.Close>
116
+ </Animated.View>
117
+ </View>
118
+ </DialogPrimitive.Content>
119
+ </PlatformWrapper>
73
120
  </DialogPortal>
74
121
  );
75
122
  },
@@ -86,7 +133,7 @@ const DialogFooter = ({ className, ...props }: React.ComponentPropsWithoutRef<ty
86
133
  );
87
134
  DialogFooter.displayName = 'DialogFooter';
88
135
 
89
- export type DialogTitleRef = React.ElementRef<typeof DialogPrimitive.Title>;
136
+ export type DialogTitleRef = React.ComponentRef<typeof DialogPrimitive.Title>;
90
137
  export type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
91
138
  const DialogTitle: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<DialogTitleRef>> =
92
139
  React.forwardRef<DialogTitleRef, DialogTitleProps>(({ className, ...props }, ref) => (
@@ -98,7 +145,7 @@ const DialogTitle: React.ForwardRefExoticComponent<DialogTitleProps & React.RefA
98
145
  ));
99
146
  DialogTitle.displayName = DialogPrimitive.Title?.displayName || 'DialogTitle';
100
147
 
101
- export type DialogDescriptionRef = React.ElementRef<typeof DialogPrimitive.Description>;
148
+ export type DialogDescriptionRef = React.ComponentRef<typeof DialogPrimitive.Description>;
102
149
  export type DialogDescriptionProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
103
150
  const DialogDescription: React.ForwardRefExoticComponent<
104
151
  DialogDescriptionProps & React.RefAttributes<DialogDescriptionRef>
package/src/drawer.tsx CHANGED
@@ -21,12 +21,12 @@ export const Drawer: React.FC<DrawerBaseProps> = ({ children }) => {
21
21
  Drawer.displayName = 'Drawer';
22
22
 
23
23
  export const DrawerTrigger = React.forwardRef<
24
- React.ElementRef<typeof DialogPrimitive.Trigger>,
24
+ React.ComponentRef<typeof DialogPrimitive.Trigger>,
25
25
  DrawerTriggerBaseProps & { className?: string }
26
26
  >(({ children, className, ...props }, ref) => {
27
27
  return (
28
28
  <DialogPrimitive.Trigger ref={ref} className={className} {...props}>
29
- {wrapTextChildren(children)}
29
+ {wrapTextChildren(children as React.ReactNode)}
30
30
  </DialogPrimitive.Trigger>
31
31
  );
32
32
  });
@@ -35,7 +35,7 @@ DrawerTrigger.displayName = 'DrawerTrigger';
35
35
  export const DrawerPortal = DialogPrimitive.Portal;
36
36
 
37
37
  export type DrawerOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
38
- export type DrawerOverlayRef = React.ElementRef<typeof DialogPrimitive.Overlay>;
38
+ export type DrawerOverlayRef = React.ComponentRef<typeof DialogPrimitive.Overlay>;
39
39
 
40
40
  export const DrawerOverlay: React.ForwardRefExoticComponent<
41
41
  DrawerOverlayProps & React.RefAttributes<DrawerOverlayRef>
@@ -53,7 +53,7 @@ export const DrawerOverlay: React.ForwardRefExoticComponent<
53
53
  DrawerOverlay.displayName = 'DrawerOverlay';
54
54
 
55
55
  export const DrawerContent = React.forwardRef<
56
- React.ElementRef<typeof DialogPrimitive.Content>,
56
+ React.ComponentRef<typeof DialogPrimitive.Content>,
57
57
  DrawerContentBaseProps & {
58
58
  portalHost?: string;
59
59
  overlayClassName?: string;
@@ -83,31 +83,31 @@ DrawerContent.displayName = 'DrawerContent';
83
83
 
84
84
  export const DrawerHeader = ({ className, children, ...props }: DrawerHeaderBaseProps) => (
85
85
  <View className={cn('flex flex-col gap-1.5 text-center sm:text-left', className)} {...props}>
86
- {wrapTextChildren(children)}
86
+ {wrapTextChildren(children as React.ReactNode)}
87
87
  </View>
88
88
  );
89
89
  DrawerHeader.displayName = 'DrawerHeader';
90
90
 
91
91
  export const DrawerFooter = ({ className, children, ...props }: DrawerFooterBaseProps) => (
92
92
  <View className={cn('mt-auto flex flex-col gap-2', className)} {...props}>
93
- {wrapTextChildren(children)}
93
+ {wrapTextChildren(children as React.ReactNode)}
94
94
  </View>
95
95
  );
96
96
  DrawerFooter.displayName = 'DrawerFooter';
97
97
 
98
98
  export const DrawerClose = React.forwardRef<
99
- React.ElementRef<typeof DialogPrimitive.Close>,
99
+ React.ComponentRef<typeof DialogPrimitive.Close>,
100
100
  DrawerCloseBaseProps & { className?: string }
101
101
  >(({ children, className, ...props }, ref) => {
102
102
  return (
103
103
  <DialogPrimitive.Close ref={ref} className={className} {...props}>
104
- {wrapTextChildren(children)}
104
+ {wrapTextChildren(children as React.ReactNode)}
105
105
  </DialogPrimitive.Close>
106
106
  );
107
107
  });
108
108
  DrawerClose.displayName = 'DrawerClose';
109
109
 
110
- export const DrawerTitle = React.forwardRef<React.ElementRef<typeof DialogPrimitive.Title>, DrawerTitleBaseProps>(
110
+ export const DrawerTitle = React.forwardRef<React.ComponentRef<typeof DialogPrimitive.Title>, DrawerTitleBaseProps>(
111
111
  ({ className, children, ...props }, ref) => {
112
112
  return (
113
113
  <DialogPrimitive.Title
@@ -115,7 +115,7 @@ export const DrawerTitle = React.forwardRef<React.ElementRef<typeof DialogPrimit
115
115
  className={cn('text-foreground text-lg leading-none font-semibold tracking-tight', className)}
116
116
  {...props}
117
117
  >
118
- {wrapTextChildren(children)}
118
+ {wrapTextChildren(children as React.ReactNode)}
119
119
  </DialogPrimitive.Title>
120
120
  );
121
121
  },
@@ -123,12 +123,12 @@ export const DrawerTitle = React.forwardRef<React.ElementRef<typeof DialogPrimit
123
123
  DrawerTitle.displayName = 'DrawerTitle';
124
124
 
125
125
  export const DrawerDescription = React.forwardRef<
126
- React.ElementRef<typeof DialogPrimitive.Description>,
126
+ React.ComponentRef<typeof DialogPrimitive.Description>,
127
127
  DrawerDescriptionBaseProps
128
128
  >(({ className, children, ...props }, ref) => {
129
129
  return (
130
130
  <DialogPrimitive.Description ref={ref} className={cn('text-muted-foreground text-sm', className)} {...props}>
131
- {wrapTextChildren(children)}
131
+ {wrapTextChildren(children as React.ReactNode)}
132
132
  </DialogPrimitive.Description>
133
133
  );
134
134
  });
@@ -31,7 +31,7 @@ export const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
31
31
  export const DropdownMenuSub = DropdownMenuPrimitive.Sub;
32
32
 
33
33
  const DropdownMenuOverlay = React.forwardRef<
34
- React.ElementRef<typeof DropdownMenuPrimitive.Overlay>,
34
+ React.ComponentRef<typeof DropdownMenuPrimitive.Overlay>,
35
35
  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Overlay>
36
36
  >(({ className, ...props }, ref) => {
37
37
  return (
@@ -51,7 +51,7 @@ const DropdownMenuOverlay = React.forwardRef<
51
51
  DropdownMenuOverlay.displayName = 'DropdownMenuOverlay';
52
52
 
53
53
  export const DropdownMenuContent = React.forwardRef<
54
- React.ElementRef<typeof DropdownMenuPrimitive.Content>,
54
+ React.ComponentRef<typeof DropdownMenuPrimitive.Content>,
55
55
  DropdownMenuContentBaseProps
56
56
  >(({ className, children, side, ...props }, ref) => {
57
57
  const nativeSide = side === 'left' || side === 'right' ? 'bottom' : side;
@@ -75,7 +75,7 @@ export const DropdownMenuContent = React.forwardRef<
75
75
  DropdownMenuContent.displayName = 'DropdownMenuContent';
76
76
 
77
77
  export const DropdownMenuItem = React.forwardRef<
78
- React.ElementRef<typeof DropdownMenuPrimitive.Item>,
78
+ React.ComponentRef<typeof DropdownMenuPrimitive.Item>,
79
79
  DropdownMenuItemBaseProps
80
80
  >(({ className, children, inset, onSelect, ...props }, ref) => {
81
81
  return (
@@ -96,7 +96,7 @@ export const DropdownMenuItem = React.forwardRef<
96
96
  DropdownMenuItem.displayName = 'DropdownMenuItem';
97
97
 
98
98
  export const DropdownMenuCheckboxItem = React.forwardRef<
99
- React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
99
+ React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,
100
100
  DropdownMenuCheckboxItemBaseProps
101
101
  >(({ className, children, checked, onCheckedChange, ...props }, ref) => {
102
102
  return (
@@ -122,7 +122,7 @@ export const DropdownMenuCheckboxItem = React.forwardRef<
122
122
  DropdownMenuCheckboxItem.displayName = 'DropdownMenuCheckboxItem';
123
123
 
124
124
  export const DropdownMenuRadioItem = React.forwardRef<
125
- React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
125
+ React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,
126
126
  DropdownMenuRadioItemBaseProps
127
127
  >(({ className, children, value, ...props }, ref) => {
128
128
  return (
@@ -147,7 +147,7 @@ export const DropdownMenuRadioItem = React.forwardRef<
147
147
  DropdownMenuRadioItem.displayName = 'DropdownMenuRadioItem';
148
148
 
149
149
  export const DropdownMenuLabel = React.forwardRef<
150
- React.ElementRef<typeof DropdownMenuPrimitive.Label>,
150
+ React.ComponentRef<typeof DropdownMenuPrimitive.Label>,
151
151
  DropdownMenuLabelBaseProps
152
152
  >(({ className, children, inset, ...props }, ref) => {
153
153
  return (
@@ -156,14 +156,14 @@ export const DropdownMenuLabel = React.forwardRef<
156
156
  className={cn('text-foreground px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
157
157
  {...props}
158
158
  >
159
- {wrapTextChildren(children, Text)}
159
+ {wrapTextChildren(children as React.ReactNode, Text)}
160
160
  </DropdownMenuPrimitive.Label>
161
161
  );
162
162
  });
163
163
  DropdownMenuLabel.displayName = 'DropdownMenuLabel';
164
164
 
165
165
  export const DropdownMenuSeparator = React.forwardRef<
166
- React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
166
+ React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,
167
167
  DropdownMenuSeparatorBaseProps
168
168
  >(({ className, ...props }, ref) => {
169
169
  return (
@@ -182,7 +182,7 @@ export const DropdownMenuShortcut = ({ className, children, ...props }: Dropdown
182
182
  DropdownMenuShortcut.displayName = 'DropdownMenuShortcut';
183
183
 
184
184
  export const DropdownMenuSubTrigger = React.forwardRef<
185
- React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
185
+ React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,
186
186
  DropdownMenuSubTriggerBaseProps
187
187
  >(({ className, children, inset, ...props }, ref) => {
188
188
  return (
@@ -195,7 +195,7 @@ export const DropdownMenuSubTrigger = React.forwardRef<
195
195
  )}
196
196
  {...props}
197
197
  >
198
- <View className="flex flex-row items-center gap-1.5">{wrapTextChildren(children, Text)}</View>
198
+ <View className="flex flex-row items-center gap-1.5">{wrapTextChildren(children as React.ReactNode, Text)}</View>
199
199
  <ChevronRight size={14} className="text-foreground ml-auto" />
200
200
  </DropdownMenuPrimitive.SubTrigger>
201
201
  );
@@ -203,7 +203,7 @@ export const DropdownMenuSubTrigger = React.forwardRef<
203
203
  DropdownMenuSubTrigger.displayName = 'DropdownMenuSubTrigger';
204
204
 
205
205
  export const DropdownMenuSubContent = React.forwardRef<
206
- React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
206
+ React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,
207
207
  DropdownMenuSubContentBaseProps
208
208
  >(({ className, children, ...props }, ref) => {
209
209
  return (
package/src/form.tsx CHANGED
@@ -79,7 +79,7 @@ type FormItemContextValue = {
79
79
  const FormItemContext = React.createContext<FormItemContextValue | null>(null);
80
80
 
81
81
  const FormItem = React.forwardRef<
82
- React.ElementRef<typeof View>,
82
+ React.ComponentRef<typeof View>,
83
83
  React.ComponentPropsWithoutRef<typeof View> & FormItemBaseProps
84
84
  >(({ className, ...props }, ref) => {
85
85
  const id = React.useId();
@@ -93,7 +93,7 @@ const FormItem = React.forwardRef<
93
93
  FormItem.displayName = 'FormItem';
94
94
 
95
95
  const FormLabel = React.forwardRef<
96
- React.ElementRef<typeof Label>,
96
+ React.ComponentRef<typeof Label>,
97
97
  React.ComponentPropsWithoutRef<typeof Label> & FormLabelBaseProps
98
98
  >(({ className, ...props }, ref) => {
99
99
  const { error, formItemId } = useFormField();
@@ -103,8 +103,8 @@ const FormLabel = React.forwardRef<
103
103
  FormLabel.displayName = 'FormLabel';
104
104
 
105
105
  const FormControl = React.forwardRef<
106
- React.ElementRef<typeof Slot.Slot>,
107
- React.ComponentPropsWithoutRef<typeof Slot.Slot>
106
+ React.ComponentRef<typeof Slot.Slot>,
107
+ React.ComponentPropsWithoutRef<typeof Slot.Slot> & FormControlBaseProps & { children?: React.ReactNode }
108
108
  >(({ ...props }, ref) => {
109
109
  const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
110
110
 
@@ -121,7 +121,7 @@ const FormControl = React.forwardRef<
121
121
  FormControl.displayName = 'FormControl';
122
122
 
123
123
  const FormDescription = React.forwardRef<
124
- React.ElementRef<typeof Text>,
124
+ React.ComponentRef<typeof Text>,
125
125
  React.ComponentPropsWithoutRef<typeof Text> & FormDescriptionBaseProps
126
126
  >(({ className, ...props }, ref) => {
127
127
  const { formDescriptionId } = useFormField();
@@ -138,7 +138,7 @@ const FormDescription = React.forwardRef<
138
138
  FormDescription.displayName = 'FormDescription';
139
139
 
140
140
  const FormMessage = React.forwardRef<
141
- React.ElementRef<typeof Text>,
141
+ React.ComponentRef<typeof Text>,
142
142
  React.ComponentPropsWithoutRef<typeof Text> & FormMessageBaseProps
143
143
  >(({ className, children, ...props }, ref) => {
144
144
  const { error, formMessageId } = useFormField();
@@ -8,7 +8,7 @@ export const HoverCard = HoverCardPrimitive.Root;
8
8
  export const HoverCardTrigger = HoverCardPrimitive.Trigger;
9
9
 
10
10
  export const HoverCardContent = React.forwardRef<
11
- React.ElementRef<typeof HoverCardPrimitive.Content>,
11
+ React.ComponentRef<typeof HoverCardPrimitive.Content>,
12
12
  HoverCardContentBaseProps
13
13
  >(({ className, children, ...props }, ref) => {
14
14
  return (
package/src/input.tsx CHANGED
@@ -6,7 +6,7 @@ import { cn } from './lib/utils';
6
6
 
7
7
  export interface InputProps extends React.ComponentPropsWithoutRef<typeof TextInput>, InputBaseProps {}
8
8
 
9
- const Input = React.forwardRef<React.ElementRef<typeof TextInput>, InputProps>(
9
+ const Input = React.forwardRef<React.ComponentRef<typeof TextInput>, InputProps>(
10
10
  ({ className, placeholderClassName, ...props }, ref) => {
11
11
  return (
12
12
  <TextInput
package/src/label.tsx CHANGED
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
  import { cn } from './lib/utils';
5
5
 
6
6
  const Label = React.forwardRef<
7
- React.ElementRef<typeof LabelPrimitive.Text>,
7
+ React.ComponentRef<typeof LabelPrimitive.Text>,
8
8
  React.ComponentPropsWithoutRef<typeof LabelPrimitive.Text>
9
9
  >(({ className, onPress, onLongPress, onPressIn, onPressOut, ...props }, ref) => (
10
10
  <LabelPrimitive.Root
package/src/menubar.tsx CHANGED
@@ -20,7 +20,7 @@ import { wrapTextChildren } from './lib/render-native';
20
20
  import { cn } from './lib/utils';
21
21
  import { Text } from './text';
22
22
 
23
- export const Menubar = React.forwardRef<React.ElementRef<typeof MenubarPrimitive.Root>, MenubarBaseProps>(
23
+ export const Menubar = React.forwardRef<React.ComponentRef<typeof MenubarPrimitive.Root>, MenubarBaseProps>(
24
24
  ({ className, children, value: valueProp, onValueChange: onValueChangeProp, ...props }, ref) => {
25
25
  const [localValue, setLocalValue] = React.useState<string | undefined>(valueProp || '');
26
26
  const value = valueProp !== undefined ? valueProp : localValue;
@@ -58,7 +58,7 @@ export const MenubarRadioGroup = MenubarPrimitive.RadioGroup;
58
58
  export const MenubarSub = MenubarPrimitive.Sub;
59
59
 
60
60
  const MenubarOverlay = React.forwardRef<
61
- React.ElementRef<typeof MenubarPrimitive.Overlay>,
61
+ React.ComponentRef<typeof MenubarPrimitive.Overlay>,
62
62
  React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Overlay>
63
63
  >(({ className, ...props }, ref) => {
64
64
  return (
@@ -74,7 +74,7 @@ const MenubarOverlay = React.forwardRef<
74
74
  MenubarOverlay.displayName = 'MenubarOverlay';
75
75
 
76
76
  export const MenubarTrigger = React.forwardRef<
77
- React.ElementRef<typeof MenubarPrimitive.Trigger>,
77
+ React.ComponentRef<typeof MenubarPrimitive.Trigger>,
78
78
  MenubarTriggerBaseProps
79
79
  >(({ className, children, ...props }, ref) => {
80
80
  return (
@@ -86,14 +86,14 @@ export const MenubarTrigger = React.forwardRef<
86
86
  )}
87
87
  {...props}
88
88
  >
89
- {wrapTextChildren(children, Text)}
89
+ {wrapTextChildren(children as React.ReactNode, Text)}
90
90
  </MenubarPrimitive.Trigger>
91
91
  );
92
92
  });
93
93
  MenubarTrigger.displayName = 'MenubarTrigger';
94
94
 
95
95
  export const MenubarContent = React.forwardRef<
96
- React.ElementRef<typeof MenubarPrimitive.Content>,
96
+ React.ComponentRef<typeof MenubarPrimitive.Content>,
97
97
  MenubarContentBaseProps
98
98
  >(({ className, children, ...props }, ref) => {
99
99
  return (
@@ -114,7 +114,7 @@ export const MenubarContent = React.forwardRef<
114
114
  });
115
115
  MenubarContent.displayName = 'MenubarContent';
116
116
 
117
- export const MenubarItem = React.forwardRef<React.ElementRef<typeof MenubarPrimitive.Item>, MenubarItemBaseProps>(
117
+ export const MenubarItem = React.forwardRef<React.ComponentRef<typeof MenubarPrimitive.Item>, MenubarItemBaseProps>(
118
118
  ({ className, children, inset, ...props }, ref) => {
119
119
  return (
120
120
  <MenubarPrimitive.Item
@@ -126,7 +126,7 @@ export const MenubarItem = React.forwardRef<React.ElementRef<typeof MenubarPrimi
126
126
  )}
127
127
  {...props}
128
128
  >
129
- {wrapTextChildren(children, Text)}
129
+ {wrapTextChildren(children as React.ReactNode, Text)}
130
130
  </MenubarPrimitive.Item>
131
131
  );
132
132
  },
@@ -134,7 +134,7 @@ export const MenubarItem = React.forwardRef<React.ElementRef<typeof MenubarPrimi
134
134
  MenubarItem.displayName = 'MenubarItem';
135
135
 
136
136
  export const MenubarCheckboxItem = React.forwardRef<
137
- React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
137
+ React.ComponentRef<typeof MenubarPrimitive.CheckboxItem>,
138
138
  MenubarCheckboxItemBaseProps
139
139
  >(({ className, children, checked, onCheckedChange, ...props }, ref) => {
140
140
  return (
@@ -153,14 +153,14 @@ export const MenubarCheckboxItem = React.forwardRef<
153
153
  <Check size={14} className="text-foreground" />
154
154
  </MenubarPrimitive.ItemIndicator>
155
155
  </View>
156
- {wrapTextChildren(children, Text)}
156
+ {wrapTextChildren(children as React.ReactNode, Text)}
157
157
  </MenubarPrimitive.CheckboxItem>
158
158
  );
159
159
  });
160
160
  MenubarCheckboxItem.displayName = 'MenubarCheckboxItem';
161
161
 
162
162
  export const MenubarRadioItem = React.forwardRef<
163
- React.ElementRef<typeof MenubarPrimitive.RadioItem>,
163
+ React.ComponentRef<typeof MenubarPrimitive.RadioItem>,
164
164
  MenubarRadioItemBaseProps
165
165
  >(({ className, children, value, ...props }, ref) => {
166
166
  return (
@@ -178,13 +178,13 @@ export const MenubarRadioItem = React.forwardRef<
178
178
  <Circle size={8} className="text-foreground fill-current" />
179
179
  </MenubarPrimitive.ItemIndicator>
180
180
  </View>
181
- {wrapTextChildren(children, Text)}
181
+ {wrapTextChildren(children as React.ReactNode, Text)}
182
182
  </MenubarPrimitive.RadioItem>
183
183
  );
184
184
  });
185
185
  MenubarRadioItem.displayName = 'MenubarRadioItem';
186
186
 
187
- export const MenubarLabel = React.forwardRef<React.ElementRef<typeof MenubarPrimitive.Label>, MenubarLabelBaseProps>(
187
+ export const MenubarLabel = React.forwardRef<React.ComponentRef<typeof MenubarPrimitive.Label>, MenubarLabelBaseProps>(
188
188
  ({ className, children, inset, ...props }, ref) => {
189
189
  return (
190
190
  <MenubarPrimitive.Label
@@ -192,7 +192,7 @@ export const MenubarLabel = React.forwardRef<React.ElementRef<typeof MenubarPrim
192
192
  className={cn('text-foreground px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
193
193
  {...props}
194
194
  >
195
- {wrapTextChildren(children, Text)}
195
+ {wrapTextChildren(children as React.ReactNode, Text)}
196
196
  </MenubarPrimitive.Label>
197
197
  );
198
198
  },
@@ -200,7 +200,7 @@ export const MenubarLabel = React.forwardRef<React.ElementRef<typeof MenubarPrim
200
200
  MenubarLabel.displayName = 'MenubarLabel';
201
201
 
202
202
  export const MenubarSeparator = React.forwardRef<
203
- React.ElementRef<typeof MenubarPrimitive.Separator>,
203
+ React.ComponentRef<typeof MenubarPrimitive.Separator>,
204
204
  MenubarSeparatorBaseProps
205
205
  >(({ className, ...props }, ref) => {
206
206
  return <MenubarPrimitive.Separator ref={ref} className={cn('bg-border -mx-1 my-1 h-px', className)} {...props} />;
@@ -217,7 +217,7 @@ export const MenubarShortcut = ({ className, children, ...props }: MenubarShortc
217
217
  MenubarShortcut.displayName = 'MenubarShortcut';
218
218
 
219
219
  export const MenubarSubTrigger = React.forwardRef<
220
- React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
220
+ React.ComponentRef<typeof MenubarPrimitive.SubTrigger>,
221
221
  MenubarSubTriggerBaseProps
222
222
  >(({ className, children, inset, ...props }, ref) => {
223
223
  return (
@@ -230,7 +230,7 @@ export const MenubarSubTrigger = React.forwardRef<
230
230
  )}
231
231
  {...props}
232
232
  >
233
- <View className="flex flex-row items-center gap-1.5">{wrapTextChildren(children, Text)}</View>
233
+ <View className="flex flex-row items-center gap-1.5">{wrapTextChildren(children as React.ReactNode, Text)}</View>
234
234
  <ChevronRight size={14} className="text-foreground ml-auto" />
235
235
  </MenubarPrimitive.SubTrigger>
236
236
  );
@@ -238,7 +238,7 @@ export const MenubarSubTrigger = React.forwardRef<
238
238
  MenubarSubTrigger.displayName = 'MenubarSubTrigger';
239
239
 
240
240
  export const MenubarSubContent = React.forwardRef<
241
- React.ElementRef<typeof MenubarPrimitive.SubContent>,
241
+ React.ComponentRef<typeof MenubarPrimitive.SubContent>,
242
242
  MenubarSubContentBaseProps
243
243
  >(({ className, children, ...props }, ref) => {
244
244
  return (