@react-native-reusables/cli 0.4.1 → 0.5.0-beta.2
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/LICENSE +1 -1
- package/bin.cjs +60513 -0
- package/package.json +7 -80
- package/README.md +0 -63
- package/__generated/components/ui/accordion.tsx +0 -134
- package/__generated/components/ui/alert-dialog.tsx +0 -172
- package/__generated/components/ui/alert.tsx +0 -71
- package/__generated/components/ui/aspect-ratio.tsx +0 -5
- package/__generated/components/ui/avatar.tsx +0 -47
- package/__generated/components/ui/badge.tsx +0 -52
- package/__generated/components/ui/button.tsx +0 -81
- package/__generated/components/ui/card.tsx +0 -82
- package/__generated/components/ui/checkbox.tsx +0 -33
- package/__generated/components/ui/collapsible.tsx +0 -9
- package/__generated/components/ui/context-menu.tsx +0 -264
- package/__generated/components/ui/dialog.tsx +0 -159
- package/__generated/components/ui/dropdown-menu.tsx +0 -274
- package/__generated/components/ui/hover-card.tsx +0 -47
- package/__generated/components/ui/input.tsx +0 -25
- package/__generated/components/ui/label.tsx +0 -34
- package/__generated/components/ui/menubar.tsx +0 -284
- package/__generated/components/ui/navigation-menu.tsx +0 -191
- package/__generated/components/ui/popover.tsx +0 -42
- package/__generated/components/ui/progress.tsx +0 -62
- package/__generated/components/ui/radio-group.tsx +0 -36
- package/__generated/components/ui/select.tsx +0 -191
- package/__generated/components/ui/separator.tsx +0 -27
- package/__generated/components/ui/skeleton.tsx +0 -39
- package/__generated/components/ui/switch.tsx +0 -98
- package/__generated/components/ui/table.tsx +0 -108
- package/__generated/components/ui/tabs.tsx +0 -69
- package/__generated/components/ui/text.tsx +0 -26
- package/__generated/components/ui/textarea.tsx +0 -30
- package/__generated/components/ui/toggle-group.tsx +0 -94
- package/__generated/components/ui/toggle.tsx +0 -90
- package/__generated/components/ui/tooltip.tsx +0 -43
- package/__generated/components/ui/typography.tsx +0 -148
- package/__generated/starter-base/README.md +0 -16
- package/__generated/starter-base/app/+not-found.tsx +0 -18
- package/__generated/starter-base/app/_layout.tsx +0 -71
- package/__generated/starter-base/app/index.tsx +0 -95
- package/__generated/starter-base/app.json +0 -40
- package/__generated/starter-base/assets/images/adaptive-icon.png +0 -0
- package/__generated/starter-base/assets/images/favicon.png +0 -0
- package/__generated/starter-base/assets/images/icon.png +0 -0
- package/__generated/starter-base/assets/images/splash.png +0 -0
- package/__generated/starter-base/babel.config.js +0 -6
- package/__generated/starter-base/components/ThemeToggle.tsx +0 -30
- package/__generated/starter-base/components/ui/avatar.tsx +0 -47
- package/__generated/starter-base/components/ui/button.tsx +0 -81
- package/__generated/starter-base/components/ui/card.tsx +0 -82
- package/__generated/starter-base/components/ui/progress.tsx +0 -62
- package/__generated/starter-base/components/ui/text.tsx +0 -26
- package/__generated/starter-base/components/ui/tooltip.tsx +0 -44
- package/__generated/starter-base/gitignore-template +0 -41
- package/__generated/starter-base/global.css +0 -49
- package/__generated/starter-base/index.js +0 -12
- package/__generated/starter-base/lib/android-navigation-bar.ts +0 -11
- package/__generated/starter-base/lib/constants.ts +0 -18
- package/__generated/starter-base/lib/icons/Info.tsx +0 -4
- package/__generated/starter-base/lib/icons/MoonStar.tsx +0 -4
- package/__generated/starter-base/lib/icons/Sun.tsx +0 -4
- package/__generated/starter-base/lib/icons/iconWithClassName.ts +0 -14
- package/__generated/starter-base/lib/useColorScheme.tsx +0 -11
- package/__generated/starter-base/lib/utils.ts +0 -6
- package/__generated/starter-base/metro.config.js +0 -6
- package/__generated/starter-base/nativewind-env.d.ts +0 -1
- package/__generated/starter-base/npmrc-template +0 -2
- package/__generated/starter-base/package.json +0 -51
- package/__generated/starter-base/tailwind.config.js +0 -65
- package/__generated/starter-base/tsconfig.json +0 -19
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Pressable } from 'react-native';
|
|
4
|
-
import { cn } from '../../lib/utils';
|
|
5
|
-
import { TextClassContext } from './text';
|
|
6
|
-
|
|
7
|
-
const buttonVariants = cva(
|
|
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',
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default: 'bg-primary web:hover:opacity-90 active:opacity-90',
|
|
13
|
-
destructive: 'bg-destructive web:hover:opacity-90 active:opacity-90',
|
|
14
|
-
outline:
|
|
15
|
-
'border border-input bg-background web:hover:bg-accent web:hover:text-accent-foreground active:bg-accent',
|
|
16
|
-
secondary: 'bg-secondary web:hover:opacity-80 active:opacity-80',
|
|
17
|
-
ghost: 'web:hover:bg-accent web:hover:text-accent-foreground active:bg-accent',
|
|
18
|
-
link: 'web:underline-offset-4 web:hover:underline web:focus:underline',
|
|
19
|
-
},
|
|
20
|
-
size: {
|
|
21
|
-
default: 'h-10 px-4 py-2 native:h-12 native:px-5 native:py-3',
|
|
22
|
-
sm: 'h-9 rounded-md px-3',
|
|
23
|
-
lg: 'h-11 rounded-md px-8 native:h-14',
|
|
24
|
-
icon: 'h-10 w-10',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
defaultVariants: {
|
|
28
|
-
variant: 'default',
|
|
29
|
-
size: 'default',
|
|
30
|
-
},
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const buttonTextVariants = cva(
|
|
35
|
-
'web:whitespace-nowrap text-sm native:text-base font-medium text-foreground web:transition-colors',
|
|
36
|
-
{
|
|
37
|
-
variants: {
|
|
38
|
-
variant: {
|
|
39
|
-
default: 'text-primary-foreground',
|
|
40
|
-
destructive: 'text-destructive-foreground',
|
|
41
|
-
outline: 'group-active:text-accent-foreground',
|
|
42
|
-
secondary: 'text-secondary-foreground group-active:text-secondary-foreground',
|
|
43
|
-
ghost: 'group-active:text-accent-foreground',
|
|
44
|
-
link: 'text-primary group-active:underline',
|
|
45
|
-
},
|
|
46
|
-
size: {
|
|
47
|
-
default: '',
|
|
48
|
-
sm: '',
|
|
49
|
-
lg: 'native:text-lg',
|
|
50
|
-
icon: '',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
defaultVariants: {
|
|
54
|
-
variant: 'default',
|
|
55
|
-
size: 'default',
|
|
56
|
-
},
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
type ButtonProps = React.ComponentProps<typeof Pressable> & VariantProps<typeof buttonVariants>;
|
|
61
|
-
|
|
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
|
-
}
|
|
79
|
-
|
|
80
|
-
export { Button, buttonTextVariants, buttonVariants };
|
|
81
|
-
export type { ButtonProps };
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Text, type TextProps, View, type ViewProps } from 'react-native';
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
4
|
-
import { TextClassContext } from './text';
|
|
5
|
-
|
|
6
|
-
function Card({
|
|
7
|
-
className,
|
|
8
|
-
...props
|
|
9
|
-
}: ViewProps & {
|
|
10
|
-
ref?: React.RefObject<View>;
|
|
11
|
-
}) {
|
|
12
|
-
return (
|
|
13
|
-
<View
|
|
14
|
-
className={cn(
|
|
15
|
-
'rounded-lg border border-border bg-card shadow-sm shadow-foreground/10',
|
|
16
|
-
className
|
|
17
|
-
)}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function CardHeader({
|
|
24
|
-
className,
|
|
25
|
-
...props
|
|
26
|
-
}: ViewProps & {
|
|
27
|
-
ref?: React.RefObject<View>;
|
|
28
|
-
}) {
|
|
29
|
-
return <View className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function CardTitle({
|
|
33
|
-
className,
|
|
34
|
-
...props
|
|
35
|
-
}: TextProps & {
|
|
36
|
-
ref?: React.RefObject<Text>;
|
|
37
|
-
}) {
|
|
38
|
-
return (
|
|
39
|
-
<Text
|
|
40
|
-
role='heading'
|
|
41
|
-
aria-level={3}
|
|
42
|
-
className={cn(
|
|
43
|
-
'text-2xl text-card-foreground font-semibold leading-none tracking-tight',
|
|
44
|
-
className
|
|
45
|
-
)}
|
|
46
|
-
{...props}
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function CardDescription({
|
|
52
|
-
className,
|
|
53
|
-
...props
|
|
54
|
-
}: TextProps & {
|
|
55
|
-
ref?: React.RefObject<Text>;
|
|
56
|
-
}) {
|
|
57
|
-
return <Text className={cn('text-sm text-muted-foreground', className)} {...props} />;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function CardContent({
|
|
61
|
-
className,
|
|
62
|
-
...props
|
|
63
|
-
}: ViewProps & {
|
|
64
|
-
ref?: React.RefObject<View>;
|
|
65
|
-
}) {
|
|
66
|
-
return (
|
|
67
|
-
<TextClassContext.Provider value='text-card-foreground'>
|
|
68
|
-
<View className={cn('p-6 pt-0', className)} {...props} />
|
|
69
|
-
</TextClassContext.Provider>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function CardFooter({
|
|
74
|
-
className,
|
|
75
|
-
...props
|
|
76
|
-
}: ViewProps & {
|
|
77
|
-
ref?: React.RefObject<View>;
|
|
78
|
-
}) {
|
|
79
|
-
return <View className={cn('flex flex-row items-center p-6 pt-0', className)} {...props} />;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as CheckboxPrimitive from '@rn-primitives/checkbox';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
|
-
import { Check } from '../../lib/icons/Check';
|
|
5
|
-
import { cn } from '../../lib/utils';
|
|
6
|
-
|
|
7
|
-
function Checkbox({
|
|
8
|
-
className,
|
|
9
|
-
...props
|
|
10
|
-
}: CheckboxPrimitive.RootProps & {
|
|
11
|
-
ref?: React.RefObject<CheckboxPrimitive.RootRef>;
|
|
12
|
-
}) {
|
|
13
|
-
return (
|
|
14
|
-
<CheckboxPrimitive.Root
|
|
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
|
-
}
|
|
32
|
-
|
|
33
|
-
export { Checkbox };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as CollapsiblePrimitive from '@rn-primitives/collapsible';
|
|
2
|
-
|
|
3
|
-
const Collapsible = CollapsiblePrimitive.Root;
|
|
4
|
-
|
|
5
|
-
const CollapsibleTrigger = CollapsiblePrimitive.Trigger;
|
|
6
|
-
|
|
7
|
-
const CollapsibleContent = CollapsiblePrimitive.Content;
|
|
8
|
-
|
|
9
|
-
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import * as ContextMenuPrimitive from '@rn-primitives/context-menu';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
Platform,
|
|
5
|
-
type StyleProp,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
Text,
|
|
8
|
-
type TextProps,
|
|
9
|
-
View,
|
|
10
|
-
type ViewStyle,
|
|
11
|
-
} from 'react-native';
|
|
12
|
-
import { Check } from '../../lib/icons/Check';
|
|
13
|
-
import { ChevronDown } from '../../lib/icons/ChevronDown';
|
|
14
|
-
import { ChevronRight } from '../../lib/icons/ChevronRight';
|
|
15
|
-
import { ChevronUp } from '../../lib/icons/ChevronUp';
|
|
16
|
-
import { cn } from '../../lib/utils';
|
|
17
|
-
import { TextClassContext } from './text';
|
|
18
|
-
|
|
19
|
-
const ContextMenu = ContextMenuPrimitive.Root;
|
|
20
|
-
const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
21
|
-
const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
22
|
-
const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
23
|
-
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
24
|
-
|
|
25
|
-
function ContextMenuSubTrigger({
|
|
26
|
-
className,
|
|
27
|
-
inset,
|
|
28
|
-
children,
|
|
29
|
-
...props
|
|
30
|
-
}: ContextMenuPrimitive.SubTriggerProps & {
|
|
31
|
-
ref?: React.RefObject<ContextMenuPrimitive.SubTriggerRef>;
|
|
32
|
-
children?: React.ReactNode;
|
|
33
|
-
inset?: boolean;
|
|
34
|
-
}) {
|
|
35
|
-
const { open } = ContextMenuPrimitive.useSubContext();
|
|
36
|
-
const Icon = Platform.OS === 'web' ? ChevronRight : open ? ChevronUp : ChevronDown;
|
|
37
|
-
return (
|
|
38
|
-
<TextClassContext.Provider
|
|
39
|
-
value={cn(
|
|
40
|
-
'select-none text-sm native:text-lg text-primary',
|
|
41
|
-
open && 'native:text-accent-foreground'
|
|
42
|
-
)}
|
|
43
|
-
>
|
|
44
|
-
<ContextMenuPrimitive.SubTrigger
|
|
45
|
-
className={cn(
|
|
46
|
-
'flex flex-row web:cursor-default web:select-none items-center gap-2 web:focus:bg-accent active:bg-accent web:hover:bg-accent rounded-sm px-2 py-1.5 native:py-2 web:outline-none',
|
|
47
|
-
open && 'bg-accent',
|
|
48
|
-
inset && 'pl-8',
|
|
49
|
-
className
|
|
50
|
-
)}
|
|
51
|
-
{...props}
|
|
52
|
-
>
|
|
53
|
-
{children}
|
|
54
|
-
<Icon size={18} className='ml-auto text-foreground' />
|
|
55
|
-
</ContextMenuPrimitive.SubTrigger>
|
|
56
|
-
</TextClassContext.Provider>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function ContextMenuSubContent({
|
|
61
|
-
className,
|
|
62
|
-
...props
|
|
63
|
-
}: ContextMenuPrimitive.SubContentProps & {
|
|
64
|
-
ref?: React.RefObject<ContextMenuPrimitive.SubContentRef>;
|
|
65
|
-
}) {
|
|
66
|
-
const { open } = ContextMenuPrimitive.useSubContext();
|
|
67
|
-
return (
|
|
68
|
-
<ContextMenuPrimitive.SubContent
|
|
69
|
-
className={cn(
|
|
70
|
-
'z-50 min-w-[8rem] overflow-hidden rounded-md border mt-1 border-border bg-popover p-1 shadow-md shadow-foreground/5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
71
|
-
open
|
|
72
|
-
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
73
|
-
: 'web:animate-out web:fade-out-0 web:zoom-out',
|
|
74
|
-
className
|
|
75
|
-
)}
|
|
76
|
-
{...props}
|
|
77
|
-
/>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function ContextMenuContent({
|
|
82
|
-
className,
|
|
83
|
-
overlayClassName,
|
|
84
|
-
overlayStyle,
|
|
85
|
-
portalHost,
|
|
86
|
-
...props
|
|
87
|
-
}: ContextMenuPrimitive.ContentProps & {
|
|
88
|
-
ref?: React.RefObject<ContextMenuPrimitive.ContentRef>;
|
|
89
|
-
overlayStyle?: StyleProp<ViewStyle>;
|
|
90
|
-
overlayClassName?: string;
|
|
91
|
-
portalHost?: string;
|
|
92
|
-
}) {
|
|
93
|
-
const { open } = ContextMenuPrimitive.useRootContext();
|
|
94
|
-
return (
|
|
95
|
-
<ContextMenuPrimitive.Portal hostName={portalHost}>
|
|
96
|
-
<ContextMenuPrimitive.Overlay
|
|
97
|
-
style={
|
|
98
|
-
overlayStyle
|
|
99
|
-
? StyleSheet.flatten([
|
|
100
|
-
Platform.OS !== 'web' ? StyleSheet.absoluteFill : undefined,
|
|
101
|
-
overlayStyle as typeof StyleSheet.absoluteFill,
|
|
102
|
-
])
|
|
103
|
-
: Platform.OS !== 'web'
|
|
104
|
-
? StyleSheet.absoluteFill
|
|
105
|
-
: undefined
|
|
106
|
-
}
|
|
107
|
-
className={overlayClassName}
|
|
108
|
-
>
|
|
109
|
-
<ContextMenuPrimitive.Content
|
|
110
|
-
className={cn(
|
|
111
|
-
'z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 shadow-md shadow-foreground/5 web:data-[side=bottom]:slide-in-from-top-2 web:data-[side=left]:slide-in-from-right-2 web:data-[side=right]:slide-in-from-left-2 web:data-[side=top]:slide-in-from-bottom-2',
|
|
112
|
-
open
|
|
113
|
-
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
114
|
-
: 'web:animate-out web:fade-out-0 web:zoom-out-95',
|
|
115
|
-
className
|
|
116
|
-
)}
|
|
117
|
-
{...props}
|
|
118
|
-
/>
|
|
119
|
-
</ContextMenuPrimitive.Overlay>
|
|
120
|
-
</ContextMenuPrimitive.Portal>
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function ContextMenuItem({
|
|
125
|
-
className,
|
|
126
|
-
inset,
|
|
127
|
-
...props
|
|
128
|
-
}: ContextMenuPrimitive.ItemProps & {
|
|
129
|
-
ref?: React.RefObject<ContextMenuPrimitive.ItemRef>;
|
|
130
|
-
className?: string;
|
|
131
|
-
inset?: boolean;
|
|
132
|
-
}) {
|
|
133
|
-
return (
|
|
134
|
-
<TextClassContext.Provider value='select-none text-sm native:text-lg text-popover-foreground web:group-focus:text-accent-foreground'>
|
|
135
|
-
<ContextMenuPrimitive.Item
|
|
136
|
-
className={cn(
|
|
137
|
-
'relative flex flex-row web:cursor-default items-center gap-2 rounded-sm px-2 py-1.5 native:py-2 web:outline-none web:focus:bg-accent active:bg-accent web:hover:bg-accent group',
|
|
138
|
-
inset && 'pl-8',
|
|
139
|
-
props.disabled && 'opacity-50 web:pointer-events-none',
|
|
140
|
-
className
|
|
141
|
-
)}
|
|
142
|
-
{...props}
|
|
143
|
-
/>
|
|
144
|
-
</TextClassContext.Provider>
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function ContextMenuCheckboxItem({
|
|
149
|
-
className,
|
|
150
|
-
children,
|
|
151
|
-
...props
|
|
152
|
-
}: ContextMenuPrimitive.CheckboxItemProps & {
|
|
153
|
-
ref?: React.RefObject<ContextMenuPrimitive.CheckboxItemRef>;
|
|
154
|
-
children?: React.ReactNode;
|
|
155
|
-
}) {
|
|
156
|
-
return (
|
|
157
|
-
<ContextMenuPrimitive.CheckboxItem
|
|
158
|
-
className={cn(
|
|
159
|
-
'relative flex flex-row web:cursor-default items-center web:group rounded-sm py-1.5 native:py-2 pl-8 pr-2 web:outline-none web:focus:bg-accent active:bg-accent',
|
|
160
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
161
|
-
className
|
|
162
|
-
)}
|
|
163
|
-
{...props}
|
|
164
|
-
>
|
|
165
|
-
<View className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>
|
|
166
|
-
<ContextMenuPrimitive.ItemIndicator>
|
|
167
|
-
<Check size={14} strokeWidth={3} className='text-foreground' />
|
|
168
|
-
</ContextMenuPrimitive.ItemIndicator>
|
|
169
|
-
</View>
|
|
170
|
-
{children}
|
|
171
|
-
</ContextMenuPrimitive.CheckboxItem>
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function ContextMenuRadioItem({
|
|
176
|
-
className,
|
|
177
|
-
children,
|
|
178
|
-
...props
|
|
179
|
-
}: ContextMenuPrimitive.RadioItemProps & {
|
|
180
|
-
ref?: React.RefObject<ContextMenuPrimitive.RadioItemRef>;
|
|
181
|
-
children?: React.ReactNode;
|
|
182
|
-
}) {
|
|
183
|
-
return (
|
|
184
|
-
<ContextMenuPrimitive.RadioItem
|
|
185
|
-
className={cn(
|
|
186
|
-
'relative flex flex-row web:cursor-default web:group items-center rounded-sm py-1.5 native:py-2 pl-8 pr-2 web:outline-none web:focus:bg-accent active:bg-accent',
|
|
187
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
188
|
-
className
|
|
189
|
-
)}
|
|
190
|
-
{...props}
|
|
191
|
-
>
|
|
192
|
-
<View className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>
|
|
193
|
-
<ContextMenuPrimitive.ItemIndicator>
|
|
194
|
-
<View className='bg-foreground h-2 w-2 rounded-full' />
|
|
195
|
-
</ContextMenuPrimitive.ItemIndicator>
|
|
196
|
-
</View>
|
|
197
|
-
{children}
|
|
198
|
-
</ContextMenuPrimitive.RadioItem>
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function ContextMenuLabel({
|
|
203
|
-
className,
|
|
204
|
-
inset,
|
|
205
|
-
...props
|
|
206
|
-
}: ContextMenuPrimitive.LabelProps & {
|
|
207
|
-
ref?: React.RefObject<ContextMenuPrimitive.LabelRef>;
|
|
208
|
-
className?: string;
|
|
209
|
-
inset?: boolean;
|
|
210
|
-
}) {
|
|
211
|
-
return (
|
|
212
|
-
<ContextMenuPrimitive.Label
|
|
213
|
-
className={cn(
|
|
214
|
-
'px-2 py-1.5 text-sm native:text-base font-semibold text-foreground web:cursor-default',
|
|
215
|
-
inset && 'pl-8',
|
|
216
|
-
className
|
|
217
|
-
)}
|
|
218
|
-
{...props}
|
|
219
|
-
/>
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function ContextMenuSeparator({
|
|
224
|
-
className,
|
|
225
|
-
...props
|
|
226
|
-
}: ContextMenuPrimitive.SeparatorProps & {
|
|
227
|
-
ref?: React.RefObject<ContextMenuPrimitive.SeparatorRef>;
|
|
228
|
-
}) {
|
|
229
|
-
return (
|
|
230
|
-
<ContextMenuPrimitive.Separator
|
|
231
|
-
className={cn('-mx-1 my-1 h-px bg-border', className)}
|
|
232
|
-
{...props}
|
|
233
|
-
/>
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function ContextMenuShortcut({ className, ...props }: TextProps) {
|
|
238
|
-
return (
|
|
239
|
-
<Text
|
|
240
|
-
className={cn(
|
|
241
|
-
'ml-auto text-xs native:text-sm tracking-widest text-muted-foreground',
|
|
242
|
-
className
|
|
243
|
-
)}
|
|
244
|
-
{...props}
|
|
245
|
-
/>
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export {
|
|
250
|
-
ContextMenu,
|
|
251
|
-
ContextMenuCheckboxItem,
|
|
252
|
-
ContextMenuContent,
|
|
253
|
-
ContextMenuGroup,
|
|
254
|
-
ContextMenuItem,
|
|
255
|
-
ContextMenuLabel,
|
|
256
|
-
ContextMenuRadioGroup,
|
|
257
|
-
ContextMenuRadioItem,
|
|
258
|
-
ContextMenuSeparator,
|
|
259
|
-
ContextMenuShortcut,
|
|
260
|
-
ContextMenuSub,
|
|
261
|
-
ContextMenuSubContent,
|
|
262
|
-
ContextMenuSubTrigger,
|
|
263
|
-
ContextMenuTrigger,
|
|
264
|
-
};
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import * as DialogPrimitive from '@rn-primitives/dialog';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Platform, StyleSheet, View, type ViewProps } from 'react-native';
|
|
4
|
-
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
5
|
-
import { X } from '../../lib/icons/X';
|
|
6
|
-
import { cn } from '../../lib/utils';
|
|
7
|
-
|
|
8
|
-
const Dialog = DialogPrimitive.Root;
|
|
9
|
-
|
|
10
|
-
const DialogTrigger = DialogPrimitive.Trigger;
|
|
11
|
-
|
|
12
|
-
const DialogPortal = DialogPrimitive.Portal;
|
|
13
|
-
|
|
14
|
-
const DialogClose = DialogPrimitive.Close;
|
|
15
|
-
|
|
16
|
-
function DialogOverlayWeb({
|
|
17
|
-
className,
|
|
18
|
-
...props
|
|
19
|
-
}: DialogPrimitive.OverlayProps & {
|
|
20
|
-
ref?: React.RefObject<DialogPrimitive.OverlayRef>;
|
|
21
|
-
}) {
|
|
22
|
-
const { open } = DialogPrimitive.useRootContext();
|
|
23
|
-
return (
|
|
24
|
-
<DialogPrimitive.Overlay
|
|
25
|
-
className={cn(
|
|
26
|
-
'bg-black/80 flex justify-center items-center p-2 absolute top-0 right-0 bottom-0 left-0',
|
|
27
|
-
open ? 'web:animate-in web:fade-in-0' : 'web:animate-out web:fade-out-0',
|
|
28
|
-
className
|
|
29
|
-
)}
|
|
30
|
-
{...props}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function DialogOverlayNative({
|
|
36
|
-
className,
|
|
37
|
-
children,
|
|
38
|
-
...props
|
|
39
|
-
}: DialogPrimitive.OverlayProps & {
|
|
40
|
-
ref?: React.RefObject<DialogPrimitive.OverlayRef>;
|
|
41
|
-
children?: React.ReactNode;
|
|
42
|
-
}) {
|
|
43
|
-
return (
|
|
44
|
-
<DialogPrimitive.Overlay
|
|
45
|
-
style={StyleSheet.absoluteFill}
|
|
46
|
-
className={cn('flex bg-black/80 justify-center items-center p-2', className)}
|
|
47
|
-
{...props}
|
|
48
|
-
>
|
|
49
|
-
<Animated.View entering={FadeIn.duration(150)} exiting={FadeOut.duration(150)}>
|
|
50
|
-
{children}
|
|
51
|
-
</Animated.View>
|
|
52
|
-
</DialogPrimitive.Overlay>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const DialogOverlay = Platform.select({
|
|
57
|
-
web: DialogOverlayWeb,
|
|
58
|
-
default: DialogOverlayNative,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
function DialogContent({
|
|
62
|
-
className,
|
|
63
|
-
children,
|
|
64
|
-
portalHost,
|
|
65
|
-
...props
|
|
66
|
-
}: DialogPrimitive.ContentProps & {
|
|
67
|
-
ref?: React.RefObject<DialogPrimitive.ContentRef>;
|
|
68
|
-
className?: string;
|
|
69
|
-
portalHost?: string;
|
|
70
|
-
}) {
|
|
71
|
-
const { open } = DialogPrimitive.useRootContext();
|
|
72
|
-
return (
|
|
73
|
-
<DialogPortal hostName={portalHost}>
|
|
74
|
-
<DialogOverlay>
|
|
75
|
-
<DialogPrimitive.Content
|
|
76
|
-
className={cn(
|
|
77
|
-
'max-w-lg gap-4 border border-border web:cursor-default bg-background p-6 shadow-lg web:duration-200 rounded-lg',
|
|
78
|
-
open
|
|
79
|
-
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
80
|
-
: 'web:animate-out web:fade-out-0 web:zoom-out-95',
|
|
81
|
-
className
|
|
82
|
-
)}
|
|
83
|
-
{...props}
|
|
84
|
-
>
|
|
85
|
-
{children}
|
|
86
|
-
<DialogPrimitive.Close
|
|
87
|
-
className={
|
|
88
|
-
'absolute right-4 top-4 p-0.5 web:group rounded-sm opacity-70 web:ring-offset-background web:transition-opacity web:hover:opacity-100 web:focus:outline-none web:focus:ring-2 web:focus:ring-ring web:focus:ring-offset-2 web:disabled:pointer-events-none'
|
|
89
|
-
}
|
|
90
|
-
>
|
|
91
|
-
<X
|
|
92
|
-
size={Platform.OS === 'web' ? 16 : 18}
|
|
93
|
-
className={cn('text-muted-foreground', open && 'text-accent-foreground')}
|
|
94
|
-
/>
|
|
95
|
-
</DialogPrimitive.Close>
|
|
96
|
-
</DialogPrimitive.Content>
|
|
97
|
-
</DialogOverlay>
|
|
98
|
-
</DialogPortal>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function DialogHeader({ className, ...props }: ViewProps) {
|
|
103
|
-
return (
|
|
104
|
-
<View className={cn('flex flex-col gap-1.5 text-center sm:text-left', className)} {...props} />
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function DialogFooter({ className, ...props }: ViewProps) {
|
|
109
|
-
return (
|
|
110
|
-
<View
|
|
111
|
-
className={cn('flex flex-col-reverse sm:flex-row sm:justify-end gap-2', className)}
|
|
112
|
-
{...props}
|
|
113
|
-
/>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function DialogTitle({
|
|
118
|
-
className,
|
|
119
|
-
...props
|
|
120
|
-
}: DialogPrimitive.TitleProps & {
|
|
121
|
-
ref?: React.RefObject<DialogPrimitive.TitleRef>;
|
|
122
|
-
}) {
|
|
123
|
-
return (
|
|
124
|
-
<DialogPrimitive.Title
|
|
125
|
-
className={cn(
|
|
126
|
-
'text-lg native:text-xl text-foreground font-semibold leading-none tracking-tight',
|
|
127
|
-
className
|
|
128
|
-
)}
|
|
129
|
-
{...props}
|
|
130
|
-
/>
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function DialogDescription({
|
|
135
|
-
className,
|
|
136
|
-
...props
|
|
137
|
-
}: DialogPrimitive.DescriptionProps & {
|
|
138
|
-
ref?: React.RefObject<DialogPrimitive.DescriptionRef>;
|
|
139
|
-
}) {
|
|
140
|
-
return (
|
|
141
|
-
<DialogPrimitive.Description
|
|
142
|
-
className={cn('text-sm native:text-base text-muted-foreground', className)}
|
|
143
|
-
{...props}
|
|
144
|
-
/>
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export {
|
|
149
|
-
Dialog,
|
|
150
|
-
DialogClose,
|
|
151
|
-
DialogContent,
|
|
152
|
-
DialogDescription,
|
|
153
|
-
DialogFooter,
|
|
154
|
-
DialogHeader,
|
|
155
|
-
DialogOverlay,
|
|
156
|
-
DialogPortal,
|
|
157
|
-
DialogTitle,
|
|
158
|
-
DialogTrigger,
|
|
159
|
-
};
|