@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.
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 -134
  6. package/__generated/components/ui/alert-dialog.tsx +0 -172
  7. package/__generated/components/ui/alert.tsx +0 -71
  8. package/__generated/components/ui/aspect-ratio.tsx +0 -5
  9. package/__generated/components/ui/avatar.tsx +0 -47
  10. package/__generated/components/ui/badge.tsx +0 -52
  11. package/__generated/components/ui/button.tsx +0 -81
  12. package/__generated/components/ui/card.tsx +0 -82
  13. package/__generated/components/ui/checkbox.tsx +0 -33
  14. package/__generated/components/ui/collapsible.tsx +0 -9
  15. package/__generated/components/ui/context-menu.tsx +0 -264
  16. package/__generated/components/ui/dialog.tsx +0 -159
  17. package/__generated/components/ui/dropdown-menu.tsx +0 -274
  18. package/__generated/components/ui/hover-card.tsx +0 -47
  19. package/__generated/components/ui/input.tsx +0 -25
  20. package/__generated/components/ui/label.tsx +0 -34
  21. package/__generated/components/ui/menubar.tsx +0 -284
  22. package/__generated/components/ui/navigation-menu.tsx +0 -191
  23. package/__generated/components/ui/popover.tsx +0 -42
  24. package/__generated/components/ui/progress.tsx +0 -62
  25. package/__generated/components/ui/radio-group.tsx +0 -36
  26. package/__generated/components/ui/select.tsx +0 -191
  27. package/__generated/components/ui/separator.tsx +0 -27
  28. package/__generated/components/ui/skeleton.tsx +0 -39
  29. package/__generated/components/ui/switch.tsx +0 -98
  30. package/__generated/components/ui/table.tsx +0 -108
  31. package/__generated/components/ui/tabs.tsx +0 -69
  32. package/__generated/components/ui/text.tsx +0 -26
  33. package/__generated/components/ui/textarea.tsx +0 -30
  34. package/__generated/components/ui/toggle-group.tsx +0 -94
  35. package/__generated/components/ui/toggle.tsx +0 -90
  36. package/__generated/components/ui/tooltip.tsx +0 -43
  37. package/__generated/components/ui/typography.tsx +0 -148
  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 -71
  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 -30
  49. package/__generated/starter-base/components/ui/avatar.tsx +0 -47
  50. package/__generated/starter-base/components/ui/button.tsx +0 -81
  51. package/__generated/starter-base/components/ui/card.tsx +0 -82
  52. package/__generated/starter-base/components/ui/progress.tsx +0 -62
  53. package/__generated/starter-base/components/ui/text.tsx +0 -26
  54. package/__generated/starter-base/components/ui/tooltip.tsx +0 -44
  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 -51
  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,71 +0,0 @@
1
- import '~/global.css';
2
-
3
- import { DarkTheme, DefaultTheme, Theme, ThemeProvider } from '@react-navigation/native';
4
- import { Stack } from 'expo-router';
5
- import { StatusBar } from 'expo-status-bar';
6
- import * as React from 'react';
7
- import { Appearance, Platform, View } from 'react-native';
8
- import { NAV_THEME } from '~/lib/constants';
9
- import { useColorScheme } from '~/lib/useColorScheme';
10
- import { PortalHost } from '@rn-primitives/portal';
11
- import { ThemeToggle } from '~/components/ThemeToggle';
12
- import { setAndroidNavigationBar } from '~/lib/android-navigation-bar';
13
-
14
- const LIGHT_THEME: Theme = {
15
- ...DefaultTheme,
16
- colors: NAV_THEME.light,
17
- };
18
- const DARK_THEME: Theme = {
19
- ...DarkTheme,
20
- colors: NAV_THEME.dark,
21
- };
22
-
23
- export {
24
- // Catch any errors thrown by the Layout component.
25
- ErrorBoundary,
26
- } from 'expo-router';
27
-
28
- const usePlatformSpecificSetup = Platform.select({
29
- web: useSetWebBackgroundClassName,
30
- android: useSetAndroidNavigationBar,
31
- default: noop,
32
- });
33
-
34
- export default function RootLayout() {
35
- usePlatformSpecificSetup();
36
- const { isDarkColorScheme } = useColorScheme();
37
-
38
- return (
39
- <ThemeProvider value={isDarkColorScheme ? DARK_THEME : LIGHT_THEME}>
40
- <StatusBar style={isDarkColorScheme ? 'light' : 'dark'} />
41
- <Stack>
42
- <Stack.Screen
43
- name='index'
44
- options={{
45
- title: 'Starter Base',
46
- headerRight: () => <ThemeToggle />,
47
- }}
48
- />
49
- </Stack>
50
- <PortalHost />
51
- </ThemeProvider>
52
- );
53
- }
54
-
55
- const useIsomorphicLayoutEffect =
56
- Platform.OS === 'web' && typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;
57
-
58
- function useSetWebBackgroundClassName() {
59
- useIsomorphicLayoutEffect(() => {
60
- // Adds the background color to the html element to prevent white background on overscroll.
61
- document.documentElement.classList.add('bg-background');
62
- }, []);
63
- }
64
-
65
- function useSetAndroidNavigationBar() {
66
- React.useLayoutEffect(() => {
67
- setAndroidNavigationBar(Appearance.getColorScheme() ?? 'light');
68
- }, []);
69
- }
70
-
71
- function noop() {}
@@ -1,95 +0,0 @@
1
- import * as React from 'react';
2
- import { View } from 'react-native';
3
- import Animated, { FadeInUp, FadeOutDown, LayoutAnimationConfig } from 'react-native-reanimated';
4
- import { Info } from '~/lib/icons/Info';
5
- import { Avatar, AvatarFallback, AvatarImage } from '~/components/ui/avatar';
6
- import { Button } from '~/components/ui/button';
7
- import {
8
- Card,
9
- CardContent,
10
- CardDescription,
11
- CardFooter,
12
- CardHeader,
13
- CardTitle,
14
- } from '~/components/ui/card';
15
- import { Progress } from '~/components/ui/progress';
16
- import { Text } from '~/components/ui/text';
17
- import { Tooltip, TooltipContent, TooltipTrigger } from '~/components/ui/tooltip';
18
-
19
- const GITHUB_AVATAR_URI =
20
- 'https://i.pinimg.com/originals/ef/a2/8d/efa28d18a04e7fa40ed49eeb0ab660db.jpg';
21
-
22
- export default function Screen() {
23
- const [progress, setProgress] = React.useState(78);
24
-
25
- function updateProgressValue() {
26
- setProgress(Math.floor(Math.random() * 100));
27
- }
28
- return (
29
- <View className='flex-1 justify-center items-center gap-5 p-6 bg-secondary/30'>
30
- <Card className='w-full max-w-sm p-6 rounded-2xl'>
31
- <CardHeader className='items-center'>
32
- <Avatar alt="Rick Sanchez's Avatar" className='w-24 h-24'>
33
- <AvatarImage source={{ uri: GITHUB_AVATAR_URI }} />
34
- <AvatarFallback>
35
- <Text>RS</Text>
36
- </AvatarFallback>
37
- </Avatar>
38
- <View className='p-3' />
39
- <CardTitle className='pb-2 text-center'>Rick Sanchez</CardTitle>
40
- <View className='flex-row'>
41
- <CardDescription className='text-base font-semibold'>Scientist</CardDescription>
42
- <Tooltip delayDuration={150}>
43
- <TooltipTrigger className='px-2 pb-0.5 active:opacity-50'>
44
- <Info size={14} strokeWidth={2.5} className='w-4 h-4 text-foreground/70' />
45
- </TooltipTrigger>
46
- <TooltipContent className='py-2 px-4 shadow'>
47
- <Text className='native:text-lg'>Freelance</Text>
48
- </TooltipContent>
49
- </Tooltip>
50
- </View>
51
- </CardHeader>
52
- <CardContent>
53
- <View className='flex-row justify-around gap-3'>
54
- <View className='items-center'>
55
- <Text className='text-sm text-muted-foreground'>Dimension</Text>
56
- <Text className='text-xl font-semibold'>C-137</Text>
57
- </View>
58
- <View className='items-center'>
59
- <Text className='text-sm text-muted-foreground'>Age</Text>
60
- <Text className='text-xl font-semibold'>70</Text>
61
- </View>
62
- <View className='items-center'>
63
- <Text className='text-sm text-muted-foreground'>Species</Text>
64
- <Text className='text-xl font-semibold'>Human</Text>
65
- </View>
66
- </View>
67
- </CardContent>
68
- <CardFooter className='flex-col gap-3 pb-0'>
69
- <View className='flex-row items-center overflow-hidden'>
70
- <Text className='text-sm text-muted-foreground'>Productivity:</Text>
71
- <LayoutAnimationConfig skipEntering>
72
- <Animated.View
73
- key={progress}
74
- entering={FadeInUp}
75
- exiting={FadeOutDown}
76
- className='w-11 items-center'
77
- >
78
- <Text className='text-sm font-bold text-sky-600'>{progress}%</Text>
79
- </Animated.View>
80
- </LayoutAnimationConfig>
81
- </View>
82
- <Progress value={progress} className='h-2' indicatorClassName='bg-sky-600' />
83
- <View />
84
- <Button
85
- variant='outline'
86
- className='shadow shadow-foreground/5'
87
- onPress={updateProgressValue}
88
- >
89
- <Text>Update</Text>
90
- </Button>
91
- </CardFooter>
92
- </Card>
93
- </View>
94
- );
95
- }
@@ -1,40 +0,0 @@
1
- {
2
- "expo": {
3
- "name": "starter-base",
4
- "slug": "starter-base",
5
- "version": "1.0.0",
6
- "orientation": "portrait",
7
- "icon": "./assets/images/icon.png",
8
- "scheme": "myapp",
9
- "userInterfaceStyle": "automatic",
10
- "newArchEnabled": true,
11
- "splash": {
12
- "image": "./assets/images/splash.png",
13
- "resizeMode": "contain",
14
- "backgroundColor": "#ffffff"
15
- },
16
- "assetBundlePatterns": [
17
- "**/*"
18
- ],
19
- "ios": {
20
- "supportsTablet": true
21
- },
22
- "android": {
23
- "adaptiveIcon": {
24
- "foregroundImage": "./assets/images/adaptive-icon.png",
25
- "backgroundColor": "#ffffff"
26
- }
27
- },
28
- "web": {
29
- "bundler": "metro",
30
- "output": "static",
31
- "favicon": "./assets/images/favicon.png"
32
- },
33
- "plugins": [
34
- "expo-router"
35
- ],
36
- "experiments": {
37
- "typedRoutes": true
38
- }
39
- }
40
- }
@@ -1,6 +0,0 @@
1
- module.exports = function (api) {
2
- api.cache(true);
3
- return {
4
- presets: [['babel-preset-expo', { jsxImportSource: 'nativewind' }], 'nativewind/babel'],
5
- };
6
- };
@@ -1,30 +0,0 @@
1
- import { Pressable, View } from 'react-native';
2
- import { setAndroidNavigationBar } from '~/lib/android-navigation-bar';
3
- import { MoonStar } from '~/lib/icons/MoonStar';
4
- import { Sun } from '~/lib/icons/Sun';
5
- import { useColorScheme } from '~/lib/useColorScheme';
6
-
7
- export function ThemeToggle() {
8
- const { isDarkColorScheme, setColorScheme } = useColorScheme();
9
-
10
- function toggleColorScheme() {
11
- const newTheme = isDarkColorScheme ? 'light' : 'dark';
12
- setColorScheme(newTheme);
13
- setAndroidNavigationBar(newTheme);
14
- }
15
-
16
- return (
17
- <Pressable
18
- onPress={toggleColorScheme}
19
- className='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 active:opacity-70'
20
- >
21
- <View className='flex-1 aspect-square pt-0.5 justify-center items-start web:px-5'>
22
- {isDarkColorScheme ? (
23
- <MoonStar className='text-foreground' size={23} strokeWidth={1.25} />
24
- ) : (
25
- <Sun className='text-foreground' size={24} strokeWidth={1.25} />
26
- )}
27
- </View>
28
- </Pressable>
29
- );
30
- }
@@ -1,47 +0,0 @@
1
- import * as AvatarPrimitive from '@rn-primitives/avatar';
2
- import * as React from 'react';
3
- import { cn } from '~/lib/utils';
4
-
5
- function Avatar({
6
- className,
7
- ...props
8
- }: AvatarPrimitive.RootProps & {
9
- ref?: React.RefObject<AvatarPrimitive.RootRef>;
10
- }) {
11
- return (
12
- <AvatarPrimitive.Root
13
- className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
14
- {...props}
15
- />
16
- );
17
- }
18
-
19
- function AvatarImage({
20
- className,
21
- ...props
22
- }: AvatarPrimitive.ImageProps & {
23
- ref?: React.RefObject<AvatarPrimitive.ImageRef>;
24
- }) {
25
- return (
26
- <AvatarPrimitive.Image className={cn('aspect-square h-full w-full', className)} {...props} />
27
- );
28
- }
29
-
30
- function AvatarFallback({
31
- className,
32
- ...props
33
- }: AvatarPrimitive.FallbackProps & {
34
- ref?: React.RefObject<AvatarPrimitive.FallbackRef>;
35
- }) {
36
- return (
37
- <AvatarPrimitive.Fallback
38
- className={cn(
39
- 'flex h-full w-full items-center justify-center rounded-full bg-muted',
40
- className
41
- )}
42
- {...props}
43
- />
44
- );
45
- }
46
-
47
- export { Avatar, AvatarFallback, AvatarImage };
@@ -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 { TextClassContext } from '~/components/ui/text';
5
- import { cn } from '~/lib/utils';
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, TextProps, View, ViewProps } from 'react-native';
3
- import { TextClassContext } from '~/components/ui/text';
4
- import { cn } from '~/lib/utils';
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,62 +0,0 @@
1
- import * as ProgressPrimitive from '@rn-primitives/progress';
2
- import * as React from 'react';
3
- import { Platform, View } from 'react-native';
4
- import Animated, {
5
- Extrapolation,
6
- interpolate,
7
- useAnimatedStyle,
8
- useDerivedValue,
9
- withSpring,
10
- } from 'react-native-reanimated';
11
- import { cn } from '~/lib/utils';
12
-
13
- function Progress({
14
- className,
15
- value,
16
- indicatorClassName,
17
- ...props
18
- }: ProgressPrimitive.RootProps & {
19
- ref?: React.RefObject<ProgressPrimitive.RootRef>;
20
- indicatorClassName?: string;
21
- }) {
22
- return (
23
- <ProgressPrimitive.Root
24
- className={cn('relative h-4 w-full overflow-hidden rounded-full bg-secondary', className)}
25
- {...props}
26
- >
27
- <Indicator value={value} className={indicatorClassName} />
28
- </ProgressPrimitive.Root>
29
- );
30
- }
31
-
32
- export { Progress };
33
-
34
- function Indicator({ value, className }: { value: number | undefined | null; className?: string }) {
35
- const progress = useDerivedValue(() => value ?? 0);
36
-
37
- const indicator = useAnimatedStyle(() => {
38
- return {
39
- width: withSpring(
40
- `${interpolate(progress.value, [0, 100], [1, 100], Extrapolation.CLAMP)}%`,
41
- { overshootClamping: true }
42
- ),
43
- };
44
- });
45
-
46
- if (Platform.OS === 'web') {
47
- return (
48
- <View
49
- className={cn('h-full w-full flex-1 bg-primary web:transition-all', className)}
50
- style={{ transform: `translateX(-${100 - (value ?? 0)}%)` }}
51
- >
52
- <ProgressPrimitive.Indicator className={cn('h-full w-full', className)} />
53
- </View>
54
- );
55
- }
56
-
57
- return (
58
- <ProgressPrimitive.Indicator asChild>
59
- <Animated.View style={indicator} className={cn('h-full bg-foreground', className)} />
60
- </ProgressPrimitive.Indicator>
61
- );
62
- }
@@ -1,26 +0,0 @@
1
- import * as Slot from '@rn-primitives/slot';
2
- import * as React from 'react';
3
- import { Text as RNText } from 'react-native';
4
- import { cn } from '~/lib/utils';
5
-
6
- const TextClassContext = React.createContext<string | undefined>(undefined);
7
-
8
- function Text({
9
- className,
10
- asChild = false,
11
- ...props
12
- }: React.ComponentProps<typeof RNText> & {
13
- ref?: React.RefObject<RNText>;
14
- asChild?: boolean;
15
- }) {
16
- const textClass = React.useContext(TextClassContext);
17
- const Component = asChild ? Slot.Text : RNText;
18
- return (
19
- <Component
20
- className={cn('text-base text-foreground web:select-text', textClass, className)}
21
- {...props}
22
- />
23
- );
24
- }
25
-
26
- export { Text, TextClassContext };
@@ -1,44 +0,0 @@
1
- import * as TooltipPrimitive from '@rn-primitives/tooltip';
2
- import * as React from 'react';
3
- import { Platform, StyleSheet } from 'react-native';
4
- import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
5
- import { TextClassContext } from '~/components/ui/text';
6
- import { cn } from '~/lib/utils';
7
-
8
- const Tooltip = TooltipPrimitive.Root;
9
-
10
- const TooltipTrigger = TooltipPrimitive.Trigger;
11
-
12
- function TooltipContent({
13
- className,
14
- sideOffset = 4,
15
- portalHost,
16
- ...props
17
- }: TooltipPrimitive.ContentProps & {
18
- ref?: React.RefObject<TooltipPrimitive.ContentRef>;
19
- portalHost?: string;
20
- }) {
21
- return (
22
- <TooltipPrimitive.Portal hostName={portalHost}>
23
- <TooltipPrimitive.Overlay style={Platform.OS !== 'web' ? StyleSheet.absoluteFill : undefined}>
24
- <Animated.View
25
- entering={Platform.select({ web: undefined, default: FadeIn })}
26
- exiting={Platform.select({ web: undefined, default: FadeOut })}
27
- >
28
- <TextClassContext.Provider value='text-sm native:text-base text-popover-foreground'>
29
- <TooltipPrimitive.Content
30
- sideOffset={sideOffset}
31
- className={cn(
32
- 'z-50 overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 shadow-md shadow-foreground/5 web:animate-in web:fade-in-0 web:zoom-in-95 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',
33
- className
34
- )}
35
- {...props}
36
- />
37
- </TextClassContext.Provider>
38
- </Animated.View>
39
- </TooltipPrimitive.Overlay>
40
- </TooltipPrimitive.Portal>
41
- );
42
- }
43
-
44
- export { Tooltip, TooltipContent, TooltipTrigger };
@@ -1,41 +0,0 @@
1
- # Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2
-
3
- # dependencies
4
- node_modules/
5
-
6
- # Expo
7
- .expo/
8
- dist/
9
- web-build/
10
-
11
- # Native
12
- *.orig.*
13
- *.jks
14
- *.p8
15
- *.p12
16
- *.key
17
- *.mobileprovision
18
-
19
- # Metro
20
- .metro-health-check*
21
-
22
- # debug
23
- npm-debug.*
24
- yarn-debug.*
25
- yarn-error.*
26
-
27
- # macOS
28
- .DS_Store
29
- *.pem
30
-
31
- # local env files
32
- .env*.local
33
-
34
- # typescript
35
- *.tsbuildinfo
36
-
37
- # @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
38
- # The following patterns were generated by expo-cli
39
-
40
- expo-env.d.ts
41
- # @end expo-cli