@react-native-reusables/cli 0.1.0 → 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.
- package/__generated/components/ui/accordion.tsx +29 -31
- package/__generated/components/ui/alert-dialog.tsx +18 -24
- package/__generated/components/ui/avatar.tsx +34 -41
- package/__generated/components/ui/badge.tsx +2 -2
- package/__generated/components/ui/button.tsx +2 -5
- package/__generated/components/ui/card.tsx +39 -51
- package/__generated/components/ui/checkbox.tsx +23 -24
- package/__generated/components/ui/context-menu.tsx +27 -22
- package/__generated/components/ui/dialog.tsx +39 -41
- package/__generated/components/ui/dropdown-menu.tsx +26 -21
- package/__generated/components/ui/hover-card.tsx +2 -2
- package/__generated/components/ui/input.tsx +17 -18
- package/__generated/components/ui/label.tsx +20 -21
- package/__generated/components/ui/menubar.tsx +44 -46
- package/__generated/components/ui/navigation-menu.tsx +13 -13
- package/__generated/components/ui/popover.tsx +4 -4
- package/__generated/components/ui/progress.tsx +3 -3
- package/__generated/components/ui/radio-group.tsx +27 -29
- package/__generated/components/ui/select.tsx +63 -74
- package/__generated/components/ui/separator.tsx +16 -17
- package/__generated/components/ui/switch.tsx +58 -59
- package/__generated/components/ui/table.tsx +69 -76
- package/__generated/components/ui/tabs.tsx +49 -52
- package/__generated/components/ui/textarea.tsx +20 -21
- package/__generated/components/ui/toggle-group.tsx +4 -6
- package/__generated/components/ui/toggle.tsx +4 -4
- package/__generated/components/ui/tooltip.tsx +4 -4
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
21
|
-
|
|
22
|
-
>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
55
|
-
|
|
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
|
-
|
|
91
|
-
|
|
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 '@rn-primitives/alert-dialog';
|
|
6
6
|
import { cn } from '../../lib/utils';
|
|
7
7
|
import { TextClassContext } from './text';
|
|
8
8
|
|
|
@@ -13,8 +13,8 @@ const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
|
13
13
|
const AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
14
14
|
|
|
15
15
|
const AlertDialogOverlayWeb = React.forwardRef<
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
AlertDialogPrimitive.OverlayRef,
|
|
17
|
+
AlertDialogPrimitive.OverlayProps
|
|
18
18
|
>(({ className, ...props }, ref) => {
|
|
19
19
|
const { open } = AlertDialogPrimitive.useRootContext();
|
|
20
20
|
return (
|
|
@@ -33,8 +33,8 @@ const AlertDialogOverlayWeb = React.forwardRef<
|
|
|
33
33
|
AlertDialogOverlayWeb.displayName = 'AlertDialogOverlayWeb';
|
|
34
34
|
|
|
35
35
|
const AlertDialogOverlayNative = React.forwardRef<
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
AlertDialogPrimitive.OverlayRef,
|
|
37
|
+
AlertDialogPrimitive.OverlayProps
|
|
38
38
|
>(({ className, children, ...props }, ref) => {
|
|
39
39
|
return (
|
|
40
40
|
<AlertDialogPrimitive.Overlay
|
|
@@ -59,8 +59,8 @@ const AlertDialogOverlay = Platform.select({
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
const AlertDialogContent = React.forwardRef<
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
AlertDialogPrimitive.ContentRef,
|
|
63
|
+
AlertDialogPrimitive.ContentProps & { portalHost?: string }
|
|
64
64
|
>(({ className, portalHost, ...props }, ref) => {
|
|
65
65
|
const { open } = AlertDialogPrimitive.useRootContext();
|
|
66
66
|
|
|
@@ -84,18 +84,12 @@ const AlertDialogContent = React.forwardRef<
|
|
|
84
84
|
});
|
|
85
85
|
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
86
86
|
|
|
87
|
-
const AlertDialogHeader = ({
|
|
88
|
-
className,
|
|
89
|
-
...props
|
|
90
|
-
}: React.ComponentPropsWithoutRef<typeof View>) => (
|
|
87
|
+
const AlertDialogHeader = ({ className, ...props }: ViewProps) => (
|
|
91
88
|
<View className={cn('flex flex-col gap-2', className)} {...props} />
|
|
92
89
|
);
|
|
93
90
|
AlertDialogHeader.displayName = 'AlertDialogHeader';
|
|
94
91
|
|
|
95
|
-
const AlertDialogFooter = ({
|
|
96
|
-
className,
|
|
97
|
-
...props
|
|
98
|
-
}: React.ComponentPropsWithoutRef<typeof View>) => (
|
|
92
|
+
const AlertDialogFooter = ({ className, ...props }: ViewProps) => (
|
|
99
93
|
<View
|
|
100
94
|
className={cn('flex flex-col-reverse sm:flex-row sm:justify-end gap-2', className)}
|
|
101
95
|
{...props}
|
|
@@ -104,8 +98,8 @@ const AlertDialogFooter = ({
|
|
|
104
98
|
AlertDialogFooter.displayName = 'AlertDialogFooter';
|
|
105
99
|
|
|
106
100
|
const AlertDialogTitle = React.forwardRef<
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
AlertDialogPrimitive.TitleRef,
|
|
102
|
+
AlertDialogPrimitive.TitleProps
|
|
109
103
|
>(({ className, ...props }, ref) => (
|
|
110
104
|
<AlertDialogPrimitive.Title
|
|
111
105
|
ref={ref}
|
|
@@ -116,8 +110,8 @@ const AlertDialogTitle = React.forwardRef<
|
|
|
116
110
|
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
117
111
|
|
|
118
112
|
const AlertDialogDescription = React.forwardRef<
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
AlertDialogPrimitive.DescriptionRef,
|
|
114
|
+
AlertDialogPrimitive.DescriptionProps
|
|
121
115
|
>(({ className, ...props }, ref) => (
|
|
122
116
|
<AlertDialogPrimitive.Description
|
|
123
117
|
ref={ref}
|
|
@@ -128,8 +122,8 @@ const AlertDialogDescription = React.forwardRef<
|
|
|
128
122
|
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
129
123
|
|
|
130
124
|
const AlertDialogAction = React.forwardRef<
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
AlertDialogPrimitive.ActionRef,
|
|
126
|
+
AlertDialogPrimitive.ActionProps
|
|
133
127
|
>(({ className, ...props }, ref) => (
|
|
134
128
|
<TextClassContext.Provider value={buttonTextVariants({ className })}>
|
|
135
129
|
<AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
|
|
@@ -138,8 +132,8 @@ const AlertDialogAction = React.forwardRef<
|
|
|
138
132
|
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
139
133
|
|
|
140
134
|
const AlertDialogCancel = React.forwardRef<
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
AlertDialogPrimitive.CancelRef,
|
|
136
|
+
AlertDialogPrimitive.CancelProps
|
|
143
137
|
>(({ className, ...props }, ref) => (
|
|
144
138
|
<TextClassContext.Provider value={buttonTextVariants({ className, variant: 'outline' })}>
|
|
145
139
|
<AlertDialogPrimitive.Cancel
|
|
@@ -1,48 +1,41 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as AvatarPrimitive from '@rn-primitives/avatar';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
));
|
|
19
|
-
Avatar.displayName = AvatarPrimitiveRoot.displayName;
|
|
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
|
+
);
|
|
14
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
20
15
|
|
|
21
|
-
const AvatarImage = React.forwardRef<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
AvatarImage.displayName = AvatarPrimitiveImage.displayName;
|
|
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;
|
|
32
26
|
|
|
33
|
-
const AvatarFallback = React.forwardRef<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
AvatarFallback.displayName = AvatarPrimitiveFallback.displayName;
|
|
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
|
+
);
|
|
39
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
47
40
|
|
|
48
41
|
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
1
|
import * as Slot from '@rn-primitives/slot';
|
|
4
2
|
import type { SlottableViewProps } from '@rn-primitives/types';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { View } from 'react-native';
|
|
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={
|
|
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 * as React from 'react';
|
|
2
|
-
import { Text, View } from 'react-native';
|
|
3
|
-
import { TextClassContext } from './text';
|
|
4
1
|
import { TextRef, ViewRef } from '@rn-primitives/types';
|
|
2
|
+
import * as React from 'react';
|
|
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,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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,
|
|
22
|
-
|
|
23
|
-
|
|
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,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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,
|
|
45
|
-
|
|
46
|
-
|
|
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,
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
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,
|
|
61
|
-
|
|
62
|
-
|
|
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 };
|
|
@@ -4,30 +4,29 @@ import { Platform } from 'react-native';
|
|
|
4
4
|
import { Check } from '../../lib/icons/Check';
|
|
5
5
|
import { cn } from '../../lib/utils';
|
|
6
6
|
|
|
7
|
-
const Checkbox = React.forwardRef<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
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
|
+
);
|
|
31
30
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
32
31
|
|
|
33
32
|
export { Checkbox };
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import * as ContextMenuPrimitive from '@rn-primitives/context-menu';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Platform,
|
|
5
|
+
type StyleProp,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Text,
|
|
8
|
+
type TextProps,
|
|
9
|
+
View,
|
|
10
|
+
type ViewStyle,
|
|
11
|
+
} from 'react-native';
|
|
4
12
|
import { Check } from '../../lib/icons/Check';
|
|
5
13
|
import { ChevronDown } from '../../lib/icons/ChevronDown';
|
|
6
14
|
import { ChevronRight } from '../../lib/icons/ChevronRight';
|
|
@@ -15,8 +23,8 @@ const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
|
15
23
|
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
16
24
|
|
|
17
25
|
const ContextMenuSubTrigger = React.forwardRef<
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
ContextMenuPrimitive.SubTriggerRef,
|
|
27
|
+
ContextMenuPrimitive.SubTriggerProps & {
|
|
20
28
|
inset?: boolean;
|
|
21
29
|
}
|
|
22
30
|
>(({ className, inset, children, ...props }, ref) => {
|
|
@@ -48,8 +56,8 @@ const ContextMenuSubTrigger = React.forwardRef<
|
|
|
48
56
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
49
57
|
|
|
50
58
|
const ContextMenuSubContent = React.forwardRef<
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
ContextMenuPrimitive.SubContentRef,
|
|
60
|
+
ContextMenuPrimitive.SubContentProps
|
|
53
61
|
>(({ className, ...props }, ref) => {
|
|
54
62
|
const { open } = ContextMenuPrimitive.useSubContext();
|
|
55
63
|
return (
|
|
@@ -69,8 +77,8 @@ const ContextMenuSubContent = React.forwardRef<
|
|
|
69
77
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
70
78
|
|
|
71
79
|
const ContextMenuContent = React.forwardRef<
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
ContextMenuPrimitive.ContentRef,
|
|
81
|
+
ContextMenuPrimitive.ContentProps & {
|
|
74
82
|
overlayStyle?: StyleProp<ViewStyle>;
|
|
75
83
|
overlayClassName?: string;
|
|
76
84
|
portalHost?: string;
|
|
@@ -110,8 +118,8 @@ const ContextMenuContent = React.forwardRef<
|
|
|
110
118
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
111
119
|
|
|
112
120
|
const ContextMenuItem = React.forwardRef<
|
|
113
|
-
|
|
114
|
-
|
|
121
|
+
ContextMenuPrimitive.ItemRef,
|
|
122
|
+
ContextMenuPrimitive.ItemProps & {
|
|
115
123
|
inset?: boolean;
|
|
116
124
|
}
|
|
117
125
|
>(({ className, inset, ...props }, ref) => (
|
|
@@ -131,8 +139,8 @@ const ContextMenuItem = React.forwardRef<
|
|
|
131
139
|
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
132
140
|
|
|
133
141
|
const ContextMenuCheckboxItem = React.forwardRef<
|
|
134
|
-
|
|
135
|
-
|
|
142
|
+
ContextMenuPrimitive.CheckboxItemRef,
|
|
143
|
+
ContextMenuPrimitive.CheckboxItemProps
|
|
136
144
|
>(({ className, children, ...props }, ref) => (
|
|
137
145
|
<ContextMenuPrimitive.CheckboxItem
|
|
138
146
|
ref={ref}
|
|
@@ -154,8 +162,8 @@ const ContextMenuCheckboxItem = React.forwardRef<
|
|
|
154
162
|
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
155
163
|
|
|
156
164
|
const ContextMenuRadioItem = React.forwardRef<
|
|
157
|
-
|
|
158
|
-
|
|
165
|
+
ContextMenuPrimitive.RadioItemRef,
|
|
166
|
+
ContextMenuPrimitive.RadioItemProps
|
|
159
167
|
>(({ className, children, ...props }, ref) => (
|
|
160
168
|
<ContextMenuPrimitive.RadioItem
|
|
161
169
|
ref={ref}
|
|
@@ -177,8 +185,8 @@ const ContextMenuRadioItem = React.forwardRef<
|
|
|
177
185
|
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
178
186
|
|
|
179
187
|
const ContextMenuLabel = React.forwardRef<
|
|
180
|
-
|
|
181
|
-
|
|
188
|
+
ContextMenuPrimitive.LabelRef,
|
|
189
|
+
ContextMenuPrimitive.LabelProps & {
|
|
182
190
|
inset?: boolean;
|
|
183
191
|
}
|
|
184
192
|
>(({ className, inset, ...props }, ref) => (
|
|
@@ -195,8 +203,8 @@ const ContextMenuLabel = React.forwardRef<
|
|
|
195
203
|
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
196
204
|
|
|
197
205
|
const ContextMenuSeparator = React.forwardRef<
|
|
198
|
-
|
|
199
|
-
|
|
206
|
+
ContextMenuPrimitive.SeparatorRef,
|
|
207
|
+
ContextMenuPrimitive.SeparatorProps
|
|
200
208
|
>(({ className, ...props }, ref) => (
|
|
201
209
|
<ContextMenuPrimitive.Separator
|
|
202
210
|
ref={ref}
|
|
@@ -206,10 +214,7 @@ const ContextMenuSeparator = React.forwardRef<
|
|
|
206
214
|
));
|
|
207
215
|
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
208
216
|
|
|
209
|
-
const ContextMenuShortcut = ({
|
|
210
|
-
className,
|
|
211
|
-
...props
|
|
212
|
-
}: React.ComponentPropsWithoutRef<typeof Text>) => {
|
|
217
|
+
const ContextMenuShortcut = ({ className, ...props }: TextProps) => {
|
|
213
218
|
return (
|
|
214
219
|
<Text
|
|
215
220
|
className={cn(
|
|
@@ -226,7 +231,6 @@ export {
|
|
|
226
231
|
ContextMenu,
|
|
227
232
|
ContextMenuCheckboxItem,
|
|
228
233
|
ContextMenuContent,
|
|
229
|
-
ContextMenuTrigger,
|
|
230
234
|
ContextMenuGroup,
|
|
231
235
|
ContextMenuItem,
|
|
232
236
|
ContextMenuLabel,
|
|
@@ -237,4 +241,5 @@ export {
|
|
|
237
241
|
ContextMenuSub,
|
|
238
242
|
ContextMenuSubContent,
|
|
239
243
|
ContextMenuSubTrigger,
|
|
244
|
+
ContextMenuTrigger,
|
|
240
245
|
};
|