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