@react-native-reusables/cli 0.0.18 → 0.1.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 (139) hide show
  1. package/README.md +2 -37
  2. package/__generated/components/ui/accordion.tsx +30 -32
  3. package/__generated/components/ui/alert-dialog.tsx +19 -26
  4. package/__generated/components/ui/aspect-ratio.tsx +1 -1
  5. package/__generated/components/ui/avatar.tsx +31 -34
  6. package/__generated/components/ui/badge.tsx +2 -2
  7. package/__generated/components/ui/button.tsx +2 -5
  8. package/__generated/components/ui/card.tsx +39 -51
  9. package/__generated/components/ui/checkbox.tsx +25 -27
  10. package/__generated/components/ui/collapsible.tsx +1 -1
  11. package/__generated/components/ui/context-menu.tsx +28 -31
  12. package/__generated/components/ui/dialog.tsx +40 -43
  13. package/__generated/components/ui/dropdown-menu.tsx +27 -22
  14. package/__generated/components/ui/hover-card.tsx +3 -3
  15. package/__generated/components/ui/input.tsx +17 -18
  16. package/__generated/components/ui/label.tsx +21 -22
  17. package/__generated/components/ui/menubar.tsx +45 -47
  18. package/__generated/components/ui/navigation-menu.tsx +19 -17
  19. package/__generated/components/ui/popover.tsx +4 -4
  20. package/__generated/components/ui/progress.tsx +15 -11
  21. package/__generated/components/ui/radio-group.tsx +27 -29
  22. package/__generated/components/ui/select.tsx +55 -65
  23. package/__generated/components/ui/separator.tsx +16 -17
  24. package/__generated/components/ui/switch.tsx +59 -61
  25. package/__generated/components/ui/table.tsx +69 -76
  26. package/__generated/components/ui/tabs.tsx +49 -52
  27. package/__generated/components/ui/text.tsx +2 -2
  28. package/__generated/components/ui/textarea.tsx +20 -21
  29. package/__generated/components/ui/toggle-group.tsx +5 -7
  30. package/__generated/components/ui/toggle.tsx +4 -4
  31. package/__generated/components/ui/tooltip.tsx +4 -5
  32. package/__generated/components/ui/typography.tsx +2 -2
  33. package/dist/index.js +3 -3
  34. package/dist/index.js.map +1 -1
  35. package/package.json +2 -34
  36. package/__generated/components/primitives/accordion/accordion.tsx +0 -216
  37. package/__generated/components/primitives/accordion/accordion.web.tsx +0 -295
  38. package/__generated/components/primitives/accordion/index.ts +0 -1
  39. package/__generated/components/primitives/accordion/types.ts +0 -45
  40. package/__generated/components/primitives/alert-dialog/alert-dialog.tsx +0 -237
  41. package/__generated/components/primitives/alert-dialog/alert-dialog.web.tsx +0 -256
  42. package/__generated/components/primitives/alert-dialog/index.ts +0 -1
  43. package/__generated/components/primitives/alert-dialog/types.ts +0 -48
  44. package/__generated/components/primitives/aspect-ratio.tsx +0 -23
  45. package/__generated/components/primitives/avatar/index.tsx +0 -95
  46. package/__generated/components/primitives/avatar/types.ts +0 -10
  47. package/__generated/components/primitives/checkbox/checkbox.tsx +0 -101
  48. package/__generated/components/primitives/checkbox/checkbox.web.tsx +0 -114
  49. package/__generated/components/primitives/checkbox/index.ts +0 -1
  50. package/__generated/components/primitives/checkbox/types.ts +0 -11
  51. package/__generated/components/primitives/collapsible/collapsible.tsx +0 -119
  52. package/__generated/components/primitives/collapsible/collapsible.web.tsx +0 -157
  53. package/__generated/components/primitives/collapsible/index.ts +0 -1
  54. package/__generated/components/primitives/collapsible/types.ts +0 -18
  55. package/__generated/components/primitives/context-menu/context-menu.tsx +0 -648
  56. package/__generated/components/primitives/context-menu/context-menu.web.tsx +0 -533
  57. package/__generated/components/primitives/context-menu/index.ts +0 -1
  58. package/__generated/components/primitives/context-menu/types.ts +0 -90
  59. package/__generated/components/primitives/dialog/dialog.tsx +0 -211
  60. package/__generated/components/primitives/dialog/dialog.web.tsx +0 -197
  61. package/__generated/components/primitives/dialog/index.ts +0 -1
  62. package/__generated/components/primitives/dialog/types.ts +0 -60
  63. package/__generated/components/primitives/dropdown-menu/dropdown-menu.tsx +0 -608
  64. package/__generated/components/primitives/dropdown-menu/dropdown-menu.web.tsx +0 -550
  65. package/__generated/components/primitives/dropdown-menu/index.ts +0 -1
  66. package/__generated/components/primitives/dropdown-menu/types.ts +0 -72
  67. package/__generated/components/primitives/hooks/index.ts +0 -3
  68. package/__generated/components/primitives/hooks/useAugmentedRef.tsx +0 -29
  69. package/__generated/components/primitives/hooks/useControllableState.tsx +0 -75
  70. package/__generated/components/primitives/hooks/useRelativePosition.tsx +0 -227
  71. package/__generated/components/primitives/hover-card/hover-card.tsx +0 -279
  72. package/__generated/components/primitives/hover-card/hover-card.web.tsx +0 -150
  73. package/__generated/components/primitives/hover-card/index.ts +0 -1
  74. package/__generated/components/primitives/hover-card/types.ts +0 -51
  75. package/__generated/components/primitives/label/index.ts +0 -1
  76. package/__generated/components/primitives/label/label.tsx +0 -31
  77. package/__generated/components/primitives/label/label.web.tsx +0 -36
  78. package/__generated/components/primitives/label/types.ts +0 -15
  79. package/__generated/components/primitives/menubar/index.ts +0 -1
  80. package/__generated/components/primitives/menubar/menubar.tsx +0 -622
  81. package/__generated/components/primitives/menubar/menubar.web.tsx +0 -548
  82. package/__generated/components/primitives/menubar/types.ts +0 -77
  83. package/__generated/components/primitives/navigation-menu/index.ts +0 -1
  84. package/__generated/components/primitives/navigation-menu/navigation-menu.tsx +0 -315
  85. package/__generated/components/primitives/navigation-menu/navigation-menu.web.tsx +0 -264
  86. package/__generated/components/primitives/navigation-menu/types.ts +0 -49
  87. package/__generated/components/primitives/popover/index.ts +0 -1
  88. package/__generated/components/primitives/popover/popover.tsx +0 -290
  89. package/__generated/components/primitives/popover/popover.web.tsx +0 -191
  90. package/__generated/components/primitives/popover/types.ts +0 -24
  91. package/__generated/components/primitives/portal.tsx +0 -82
  92. package/__generated/components/primitives/progress/index.ts +0 -1
  93. package/__generated/components/primitives/progress/progress.tsx +0 -59
  94. package/__generated/components/primitives/progress/progress.web.tsx +0 -36
  95. package/__generated/components/primitives/progress/types.ts +0 -7
  96. package/__generated/components/primitives/radio-group/index.ts +0 -1
  97. package/__generated/components/primitives/radio-group/radio-group.tsx +0 -116
  98. package/__generated/components/primitives/radio-group/radio-group.web.tsx +0 -78
  99. package/__generated/components/primitives/radio-group/types.ts +0 -15
  100. package/__generated/components/primitives/select/index.ts +0 -1
  101. package/__generated/components/primitives/select/select.tsx +0 -466
  102. package/__generated/components/primitives/select/select.web.tsx +0 -332
  103. package/__generated/components/primitives/select/types.ts +0 -89
  104. package/__generated/components/primitives/separator/index.tsx +0 -23
  105. package/__generated/components/primitives/separator/types.ts +0 -6
  106. package/__generated/components/primitives/slider/index.ts +0 -1
  107. package/__generated/components/primitives/slider/slider.tsx +0 -89
  108. package/__generated/components/primitives/slider/slider.web.tsx +0 -67
  109. package/__generated/components/primitives/slider/types.ts +0 -24
  110. package/__generated/components/primitives/slot.tsx +0 -187
  111. package/__generated/components/primitives/switch/index.ts +0 -1
  112. package/__generated/components/primitives/switch/switch.tsx +0 -65
  113. package/__generated/components/primitives/switch/switch.web.tsx +0 -67
  114. package/__generated/components/primitives/switch/types.ts +0 -11
  115. package/__generated/components/primitives/table.tsx +0 -55
  116. package/__generated/components/primitives/tabs/index.ts +0 -1
  117. package/__generated/components/primitives/tabs/tabs.tsx +0 -133
  118. package/__generated/components/primitives/tabs/tabs.web.tsx +0 -97
  119. package/__generated/components/primitives/tabs/types.ts +0 -24
  120. package/__generated/components/primitives/toast/index.tsx +0 -128
  121. package/__generated/components/primitives/toast/types.ts +0 -7
  122. package/__generated/components/primitives/toggle/index.ts +0 -1
  123. package/__generated/components/primitives/toggle/toggle.tsx +0 -37
  124. package/__generated/components/primitives/toggle/toggle.web.tsx +0 -26
  125. package/__generated/components/primitives/toggle/types.ts +0 -7
  126. package/__generated/components/primitives/toggle-group/index.ts +0 -1
  127. package/__generated/components/primitives/toggle-group/toggle-group.tsx +0 -125
  128. package/__generated/components/primitives/toggle-group/toggle-group.web.tsx +0 -124
  129. package/__generated/components/primitives/toggle-group/types.ts +0 -37
  130. package/__generated/components/primitives/toolbar/index.ts +0 -1
  131. package/__generated/components/primitives/toolbar/toolbar.tsx +0 -125
  132. package/__generated/components/primitives/toolbar/toolbar.web.tsx +0 -129
  133. package/__generated/components/primitives/toolbar/types.ts +0 -39
  134. package/__generated/components/primitives/tooltip/index.ts +0 -1
  135. package/__generated/components/primitives/tooltip/tooltip.tsx +0 -277
  136. package/__generated/components/primitives/tooltip/tooltip.web.tsx +0 -181
  137. package/__generated/components/primitives/tooltip/types.ts +0 -42
  138. package/__generated/components/primitives/types.ts +0 -105
  139. package/__generated/components/primitives/utils.ts +0 -61
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Please follow [the initial setup steps](https://rnr-docs.vercel.app/getting-started/initial-setup/) before using
4
4
 
5
- A CLI to add [react-native-reusables](https://rnr-docs.vercel.app/getting-started/introduction/) components to your project. When components depend on other components and/or primitives, they will also be added to your project.
5
+ A CLI to add [react-native-reusables](https://rnr-docs.vercel.app/getting-started/introduction/) components to your project. When components depend on other components, they will also be added to your project.
6
6
 
7
7
  ## How to use
8
8
 
@@ -50,41 +50,6 @@ If you do not add arguments, you will be promted to select the `ui` components y
50
50
  - `tooltip`
51
51
  - `typography`
52
52
 
53
- #### Primitive Components
54
-
55
- - `accordion-primitive`
56
- - `alert-dialog-primitive`
57
- - `aspect-ratio-primitive`
58
- - `avatar-primitive`
59
- - `checkbox-primitive`
60
- - `collapsible-primitive`
61
- - `context-menu-primitive`
62
- - `dialog-primitive`
63
- - `dropdown-menu-primitive`
64
- - `hover-card-primitive`
65
- - `label-primitive`
66
- - `menubar-primitive`
67
- - `navigation-menu-primitive`
68
- - `popover-primitive`
69
- - `progress-primitive`
70
- - `radio-group-primitive`
71
- - `select-primitive`
72
- - `separator-primitive`
73
- - `slider-primitive`
74
- - `switch-primitive`
75
- - `table-primitive`
76
- - `tabs-primitive`
77
- - `toast-primitive`
78
- - `toggle-primitive`
79
- - `toggle-group-primitive`
80
- - `toolbar-primitive`
81
- - `tooltip-primitive`
82
- - `hooks-primitive`
83
- - `portal-primitive`
84
- - `slot-primitive`
85
- - `types-primitive`
86
- - `utils-primitive`
87
-
88
53
  ### Flags
89
54
 
90
55
  - `-o` or `--overwrite`: Overwrite existing files. Default to `false`
@@ -94,4 +59,4 @@ If you do not add arguments, you will be promted to select the `ui` components y
94
59
  This project uses code from shadcn.
95
60
  The code is licensed under the MIT License.
96
61
  https://github.com/shadcn-ui/ui
97
- ```
62
+ ```
@@ -1,4 +1,4 @@
1
- import * as AccordionPrimitive from '@rnr/accordion';
1
+ import * as AccordionPrimitive from '@rn-primitives/accordion';
2
2
  import * as React from 'react';
3
3
  import { Platform, Pressable, View } from 'react-native';
4
4
  import Animated, {
@@ -16,43 +16,41 @@ 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<
20
- React.ElementRef<typeof AccordionPrimitive.Root>,
21
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Root>
22
- >(({ children, ...props }, ref) => {
23
- return (
24
- <LayoutAnimationConfig skipEntering>
25
- <AccordionPrimitive.Root ref={ref} {...props} asChild={Platform.OS !== 'web'}>
26
- <Animated.View layout={LinearTransition.duration(200)}>{children}</Animated.View>
27
- </AccordionPrimitive.Root>
28
- </LayoutAnimationConfig>
29
- );
30
- });
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
+ );
31
30
 
32
31
  Accordion.displayName = AccordionPrimitive.Root.displayName;
33
32
 
34
- const AccordionItem = React.forwardRef<
35
- React.ElementRef<typeof AccordionPrimitive.Item>,
36
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
37
- >(({ className, value, ...props }, ref) => {
38
- return (
39
- <Animated.View className={'overflow-hidden'} layout={LinearTransition.duration(200)}>
40
- <AccordionPrimitive.Item
41
- ref={ref}
42
- className={cn('border-b border-border', className)}
43
- value={value}
44
- {...props}
45
- />
46
- </Animated.View>
47
- );
48
- });
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
+ );
49
47
  AccordionItem.displayName = AccordionPrimitive.Item.displayName;
50
48
 
51
49
  const Trigger = Platform.OS === 'web' ? View : Pressable;
52
50
 
53
51
  const AccordionTrigger = React.forwardRef<
54
- React.ElementRef<typeof Pressable>,
55
- React.ComponentPropsWithoutRef<typeof Pressable>
52
+ AccordionPrimitive.TriggerRef,
53
+ AccordionPrimitive.TriggerProps
56
54
  >(({ className, children, ...props }, ref) => {
57
55
  const { isExpanded } = AccordionPrimitive.useItemContext();
58
56
 
@@ -87,8 +85,8 @@ const AccordionTrigger = React.forwardRef<
87
85
  AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
88
86
 
89
87
  const AccordionContent = React.forwardRef<
90
- React.ElementRef<typeof AccordionPrimitive.Content>,
91
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
88
+ AccordionPrimitive.ContentRef,
89
+ AccordionPrimitive.ContentProps
92
90
  >(({ className, children, ...props }, ref) => {
93
91
  const { isExpanded } = AccordionPrimitive.useItemContext();
94
92
  return (
@@ -1,8 +1,8 @@
1
+ import * as AlertDialogPrimitive from '@rn-primitives/alert-dialog';
1
2
  import * as React from 'react';
2
- import { Platform, StyleSheet, View } from 'react-native';
3
+ import { Platform, StyleSheet, View, type ViewProps } from 'react-native';
3
4
  import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
4
5
  import { buttonTextVariants, buttonVariants } from '../../components/ui/button';
5
- import * as AlertDialogPrimitive from '@rnr/alert-dialog';
6
6
  import { cn } from '../../lib/utils';
7
7
  import { TextClassContext } from './text';
8
8
 
@@ -13,15 +13,14 @@ const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
13
13
  const AlertDialogPortal = AlertDialogPrimitive.Portal;
14
14
 
15
15
  const AlertDialogOverlayWeb = React.forwardRef<
16
- React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
17
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
16
+ AlertDialogPrimitive.OverlayRef,
17
+ AlertDialogPrimitive.OverlayProps
18
18
  >(({ className, ...props }, ref) => {
19
19
  const { open } = AlertDialogPrimitive.useRootContext();
20
20
  return (
21
21
  <AlertDialogPrimitive.Overlay
22
- style={StyleSheet.absoluteFill}
23
22
  className={cn(
24
- 'z-50 bg-black/80 flex justify-center items-center p-2',
23
+ 'z-50 bg-black/80 flex justify-center items-center p-2 absolute top-0 right-0 bottom-0 left-0',
25
24
  open ? 'web:animate-in web:fade-in-0' : 'web:animate-out web:fade-out-0',
26
25
  className
27
26
  )}
@@ -34,8 +33,8 @@ const AlertDialogOverlayWeb = React.forwardRef<
34
33
  AlertDialogOverlayWeb.displayName = 'AlertDialogOverlayWeb';
35
34
 
36
35
  const AlertDialogOverlayNative = React.forwardRef<
37
- React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
38
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
36
+ AlertDialogPrimitive.OverlayRef,
37
+ AlertDialogPrimitive.OverlayProps
39
38
  >(({ className, children, ...props }, ref) => {
40
39
  return (
41
40
  <AlertDialogPrimitive.Overlay
@@ -60,8 +59,8 @@ const AlertDialogOverlay = Platform.select({
60
59
  });
61
60
 
62
61
  const AlertDialogContent = React.forwardRef<
63
- React.ElementRef<typeof AlertDialogPrimitive.Content>,
64
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> & { portalHost?: string }
62
+ AlertDialogPrimitive.ContentRef,
63
+ AlertDialogPrimitive.ContentProps & { portalHost?: string }
65
64
  >(({ className, portalHost, ...props }, ref) => {
66
65
  const { open } = AlertDialogPrimitive.useRootContext();
67
66
 
@@ -85,18 +84,12 @@ const AlertDialogContent = React.forwardRef<
85
84
  });
86
85
  AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
87
86
 
88
- const AlertDialogHeader = ({
89
- className,
90
- ...props
91
- }: React.ComponentPropsWithoutRef<typeof View>) => (
87
+ const AlertDialogHeader = ({ className, ...props }: ViewProps) => (
92
88
  <View className={cn('flex flex-col gap-2', className)} {...props} />
93
89
  );
94
90
  AlertDialogHeader.displayName = 'AlertDialogHeader';
95
91
 
96
- const AlertDialogFooter = ({
97
- className,
98
- ...props
99
- }: React.ComponentPropsWithoutRef<typeof View>) => (
92
+ const AlertDialogFooter = ({ className, ...props }: ViewProps) => (
100
93
  <View
101
94
  className={cn('flex flex-col-reverse sm:flex-row sm:justify-end gap-2', className)}
102
95
  {...props}
@@ -105,8 +98,8 @@ const AlertDialogFooter = ({
105
98
  AlertDialogFooter.displayName = 'AlertDialogFooter';
106
99
 
107
100
  const AlertDialogTitle = React.forwardRef<
108
- React.ElementRef<typeof AlertDialogPrimitive.Title>,
109
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
101
+ AlertDialogPrimitive.TitleRef,
102
+ AlertDialogPrimitive.TitleProps
110
103
  >(({ className, ...props }, ref) => (
111
104
  <AlertDialogPrimitive.Title
112
105
  ref={ref}
@@ -117,8 +110,8 @@ const AlertDialogTitle = React.forwardRef<
117
110
  AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
118
111
 
119
112
  const AlertDialogDescription = React.forwardRef<
120
- React.ElementRef<typeof AlertDialogPrimitive.Description>,
121
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
113
+ AlertDialogPrimitive.DescriptionRef,
114
+ AlertDialogPrimitive.DescriptionProps
122
115
  >(({ className, ...props }, ref) => (
123
116
  <AlertDialogPrimitive.Description
124
117
  ref={ref}
@@ -129,8 +122,8 @@ const AlertDialogDescription = React.forwardRef<
129
122
  AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
130
123
 
131
124
  const AlertDialogAction = React.forwardRef<
132
- React.ElementRef<typeof AlertDialogPrimitive.Action>,
133
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
125
+ AlertDialogPrimitive.ActionRef,
126
+ AlertDialogPrimitive.ActionProps
134
127
  >(({ className, ...props }, ref) => (
135
128
  <TextClassContext.Provider value={buttonTextVariants({ className })}>
136
129
  <AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
@@ -139,8 +132,8 @@ const AlertDialogAction = React.forwardRef<
139
132
  AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
140
133
 
141
134
  const AlertDialogCancel = React.forwardRef<
142
- React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
143
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
135
+ AlertDialogPrimitive.CancelRef,
136
+ AlertDialogPrimitive.CancelProps
144
137
  >(({ className, ...props }, ref) => (
145
138
  <TextClassContext.Provider value={buttonTextVariants({ className, variant: 'outline' })}>
146
139
  <AlertDialogPrimitive.Cancel
@@ -1,4 +1,4 @@
1
- import * as AspectRatioPrimitive from '@rnr/aspect-ratio';
1
+ import * as AspectRatioPrimitive from '@rn-primitives/aspect-ratio';
2
2
 
3
3
  const AspectRatio = AspectRatioPrimitive.Root;
4
4
 
@@ -1,44 +1,41 @@
1
+ import * as AvatarPrimitive from '@rn-primitives/avatar';
1
2
  import * as React from 'react';
2
- import * as AvatarPrimitive from '@rnr/avatar';
3
3
  import { cn } from '../../lib/utils';
4
4
 
5
- const Avatar = React.forwardRef<
6
- React.ElementRef<typeof AvatarPrimitive.Root>,
7
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
8
- >(({ className, ...props }, ref) => (
9
- <AvatarPrimitive.Root
10
- ref={ref}
11
- className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
12
- {...props}
13
- />
14
- ));
5
+ const Avatar = React.forwardRef<AvatarPrimitive.RootRef, AvatarPrimitive.RootProps>(
6
+ ({ className, ...props }, ref) => (
7
+ <AvatarPrimitive.Root
8
+ ref={ref}
9
+ className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
10
+ {...props}
11
+ />
12
+ )
13
+ );
15
14
  Avatar.displayName = AvatarPrimitive.Root.displayName;
16
15
 
17
- const AvatarImage = React.forwardRef<
18
- React.ElementRef<typeof AvatarPrimitive.Image>,
19
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
20
- >(({ className, ...props }, ref) => (
21
- <AvatarPrimitive.Image
22
- ref={ref}
23
- className={cn('aspect-square h-full w-full', className)}
24
- {...props}
25
- />
26
- ));
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
+ );
27
25
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
28
26
 
29
- const AvatarFallback = React.forwardRef<
30
- React.ElementRef<typeof AvatarPrimitive.Fallback>,
31
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
32
- >(({ className, ...props }, ref) => (
33
- <AvatarPrimitive.Fallback
34
- ref={ref}
35
- className={cn(
36
- 'flex h-full w-full items-center justify-center rounded-full bg-muted',
37
- className
38
- )}
39
- {...props}
40
- />
41
- ));
27
+ const AvatarFallback = React.forwardRef<AvatarPrimitive.FallbackRef, AvatarPrimitive.FallbackProps>(
28
+ ({ className, ...props }, ref) => (
29
+ <AvatarPrimitive.Fallback
30
+ ref={ref}
31
+ className={cn(
32
+ 'flex h-full w-full items-center justify-center rounded-full bg-muted',
33
+ className
34
+ )}
35
+ {...props}
36
+ />
37
+ )
38
+ );
42
39
  AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
43
40
 
44
41
  export { Avatar, AvatarFallback, AvatarImage };
@@ -1,7 +1,7 @@
1
+ import * as Slot from '@rn-primitives/slot';
2
+ import type { SlottableViewProps } from '@rn-primitives/types';
1
3
  import { cva, type VariantProps } from 'class-variance-authority';
2
4
  import { View } from 'react-native';
3
- import * as Slot from '@rnr/slot';
4
- import type { SlottableViewProps } from '@rnr/types';
5
5
  import { cn } from '../../lib/utils';
6
6
  import { TextClassContext } from './text';
7
7
 
@@ -1,8 +1,8 @@
1
1
  import { cva, type VariantProps } from 'class-variance-authority';
2
2
  import * as React from 'react';
3
3
  import { Pressable } from 'react-native';
4
- import { TextClassContext } from './text';
5
4
  import { cn } from '../../lib/utils';
5
+ import { TextClassContext } from './text';
6
6
 
7
7
  const buttonVariants = cva(
8
8
  'group flex items-center justify-center rounded-md web:ring-offset-background web:transition-colors web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
@@ -64,10 +64,7 @@ const Button = React.forwardRef<React.ElementRef<typeof Pressable>, ButtonProps>
64
64
  ({ className, variant, size, ...props }, ref) => {
65
65
  return (
66
66
  <TextClassContext.Provider
67
- value={cn(
68
- props.disabled && 'web:pointer-events-none',
69
- buttonTextVariants({ variant, size })
70
- )}
67
+ value={buttonTextVariants({ variant, size, className: 'web:pointer-events-none' })}
71
68
  >
72
69
  <Pressable
73
70
  className={cn(
@@ -1,67 +1,55 @@
1
+ import { TextRef, ViewRef } from '@rn-primitives/types';
1
2
  import * as React from 'react';
2
- import { Text, View } from 'react-native';
3
- import { TextClassContext } from './text';
4
- import { TextRef, ViewRef } from '@rnr/types';
3
+ import { Text, type TextProps, View, type ViewProps } from 'react-native';
5
4
  import { cn } from '../../lib/utils';
5
+ import { TextClassContext } from './text';
6
6
 
7
- const Card = React.forwardRef<ViewRef, React.ComponentPropsWithoutRef<typeof View>>(
8
- ({ className, ...props }, ref) => (
9
- <View
10
- ref={ref}
11
- className={cn(
12
- 'rounded-lg border border-border bg-card shadow-sm shadow-foreground/10',
13
- className
14
- )}
15
- {...props}
16
- />
17
- )
18
- );
7
+ const Card = React.forwardRef<ViewRef, ViewProps>(({ className, ...props }, ref) => (
8
+ <View
9
+ ref={ref}
10
+ className={cn(
11
+ 'rounded-lg border border-border bg-card shadow-sm shadow-foreground/10',
12
+ className
13
+ )}
14
+ {...props}
15
+ />
16
+ ));
19
17
  Card.displayName = 'Card';
20
18
 
21
- const CardHeader = React.forwardRef<ViewRef, React.ComponentPropsWithoutRef<typeof View>>(
22
- ({ className, ...props }, ref) => (
23
- <View ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />
24
- )
25
- );
19
+ const CardHeader = React.forwardRef<ViewRef, ViewProps>(({ className, ...props }, ref) => (
20
+ <View ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />
21
+ ));
26
22
  CardHeader.displayName = 'CardHeader';
27
23
 
28
- const CardTitle = React.forwardRef<TextRef, React.ComponentPropsWithoutRef<typeof Text>>(
29
- ({ className, ...props }, ref) => (
30
- <Text
31
- role='heading'
32
- aria-level={3}
33
- ref={ref}
34
- className={cn(
35
- 'text-2xl text-card-foreground font-semibold leading-none tracking-tight',
36
- className
37
- )}
38
- {...props}
39
- />
40
- )
41
- );
24
+ const CardTitle = React.forwardRef<TextRef, TextProps>(({ className, ...props }, ref) => (
25
+ <Text
26
+ role='heading'
27
+ aria-level={3}
28
+ ref={ref}
29
+ className={cn(
30
+ 'text-2xl text-card-foreground font-semibold leading-none tracking-tight',
31
+ className
32
+ )}
33
+ {...props}
34
+ />
35
+ ));
42
36
  CardTitle.displayName = 'CardTitle';
43
37
 
44
- const CardDescription = React.forwardRef<TextRef, React.ComponentPropsWithoutRef<typeof Text>>(
45
- ({ className, ...props }, ref) => (
46
- <Text ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
47
- )
48
- );
38
+ const CardDescription = React.forwardRef<TextRef, TextProps>(({ className, ...props }, ref) => (
39
+ <Text ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
40
+ ));
49
41
  CardDescription.displayName = 'CardDescription';
50
42
 
51
- const CardContent = React.forwardRef<ViewRef, React.ComponentPropsWithoutRef<typeof View>>(
52
- ({ className, ...props }, ref) => (
53
- <TextClassContext.Provider value='text-card-foreground'>
54
- <View ref={ref} className={cn('p-6 pt-0', className)} {...props} />
55
- </TextClassContext.Provider>
56
- )
57
- );
43
+ const CardContent = React.forwardRef<ViewRef, ViewProps>(({ className, ...props }, ref) => (
44
+ <TextClassContext.Provider value='text-card-foreground'>
45
+ <View ref={ref} className={cn('p-6 pt-0', className)} {...props} />
46
+ </TextClassContext.Provider>
47
+ ));
58
48
  CardContent.displayName = 'CardContent';
59
49
 
60
- const CardFooter = React.forwardRef<ViewRef, React.ComponentPropsWithoutRef<typeof View>>(
61
- ({ className, ...props }, ref) => (
62
- <View ref={ref} className={cn('flex flex-row items-center p-6 pt-0', className)} {...props} />
63
- )
64
- );
50
+ const CardFooter = React.forwardRef<ViewRef, ViewProps>(({ className, ...props }, ref) => (
51
+ <View ref={ref} className={cn('flex flex-row items-center p-6 pt-0', className)} {...props} />
52
+ ));
65
53
  CardFooter.displayName = 'CardFooter';
66
54
 
67
55
  export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -1,34 +1,32 @@
1
- import * as CheckboxPrimitive from '@rnr/checkbox';
1
+ import * as CheckboxPrimitive from '@rn-primitives/checkbox';
2
2
  import * as React from 'react';
3
- import { Check } from '../../lib/icons/Check';
4
-
5
3
  import { Platform } from 'react-native';
4
+ import { Check } from '../../lib/icons/Check';
6
5
  import { cn } from '../../lib/utils';
7
6
 
8
- const Checkbox = React.forwardRef<
9
- React.ElementRef<typeof CheckboxPrimitive.Root>,
10
- React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
11
- >(({ className, ...props }, ref) => {
12
- return (
13
- <CheckboxPrimitive.Root
14
- ref={ref}
15
- className={cn(
16
- 'web:peer h-4 w-4 native:h-[20] native:w-[20] shrink-0 rounded-sm native:rounded border border-primary 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 disabled:cursor-not-allowed disabled:opacity-50',
17
- props.checked && 'bg-primary',
18
- className
19
- )}
20
- {...props}
21
- >
22
- <CheckboxPrimitive.Indicator className={cn('items-center justify-center h-full w-full')}>
23
- <Check
24
- size={12}
25
- strokeWidth={Platform.OS === 'web' ? 2.5 : 3.5}
26
- className='text-primary-foreground'
27
- />
28
- </CheckboxPrimitive.Indicator>
29
- </CheckboxPrimitive.Root>
30
- );
31
- });
7
+ const Checkbox = React.forwardRef<CheckboxPrimitive.RootRef, CheckboxPrimitive.RootProps>(
8
+ ({ className, ...props }, ref) => {
9
+ return (
10
+ <CheckboxPrimitive.Root
11
+ ref={ref}
12
+ className={cn(
13
+ 'web:peer h-4 w-4 native:h-[20] native:w-[20] shrink-0 rounded-sm native:rounded border border-primary 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 disabled:cursor-not-allowed disabled:opacity-50',
14
+ props.checked && 'bg-primary',
15
+ className
16
+ )}
17
+ {...props}
18
+ >
19
+ <CheckboxPrimitive.Indicator className={cn('items-center justify-center h-full w-full')}>
20
+ <Check
21
+ size={12}
22
+ strokeWidth={Platform.OS === 'web' ? 2.5 : 3.5}
23
+ className='text-primary-foreground'
24
+ />
25
+ </CheckboxPrimitive.Indicator>
26
+ </CheckboxPrimitive.Root>
27
+ );
28
+ }
29
+ );
32
30
  Checkbox.displayName = CheckboxPrimitive.Root.displayName;
33
31
 
34
32
  export { Checkbox };
@@ -1,4 +1,4 @@
1
- import * as CollapsiblePrimitive from '@rnr/collapsible';
1
+ import * as CollapsiblePrimitive from '@rn-primitives/collapsible';
2
2
 
3
3
  const Collapsible = CollapsiblePrimitive.Root;
4
4