@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,181 +0,0 @@
1
- import * as NavigationMenuPrimitive from '@rn-primitives/navigation-menu';
2
- import { cva } from 'class-variance-authority';
3
- import * as React from 'react';
4
- import { Platform, View } from 'react-native';
5
- import Animated, {
6
- Extrapolation,
7
- FadeInLeft,
8
- FadeOutLeft,
9
- interpolate,
10
- useAnimatedStyle,
11
- useDerivedValue,
12
- withTiming,
13
- } from 'react-native-reanimated';
14
- import { ChevronDown } from '../../lib/icons/ChevronDown';
15
- import { cn } from '../../lib/utils';
16
-
17
- const NavigationMenu = React.forwardRef<
18
- NavigationMenuPrimitive.RootRef,
19
- NavigationMenuPrimitive.RootProps
20
- >(({ className, children, ...props }, ref) => (
21
- <NavigationMenuPrimitive.Root
22
- ref={ref}
23
- className={cn('relative z-10 flex flex-row max-w-max items-center justify-center', className)}
24
- {...props}
25
- >
26
- {children}
27
- {Platform.OS === 'web' && <NavigationMenuViewport />}
28
- </NavigationMenuPrimitive.Root>
29
- ));
30
- NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName;
31
-
32
- const NavigationMenuList = React.forwardRef<
33
- NavigationMenuPrimitive.ListRef,
34
- NavigationMenuPrimitive.ListProps
35
- >(({ className, ...props }, ref) => (
36
- <NavigationMenuPrimitive.List
37
- ref={ref}
38
- className={cn(
39
- 'web:group flex flex-1 flex-row web:list-none items-center justify-center gap-1',
40
- className
41
- )}
42
- {...props}
43
- />
44
- ));
45
- NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;
46
-
47
- const NavigationMenuItem = NavigationMenuPrimitive.Item;
48
-
49
- const navigationMenuTriggerStyle = cva(
50
- 'web:group web:inline-flex flex-row h-10 native:h-12 native:px-3 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium web:transition-colors web:hover:bg-accent active:bg-accent web:hover:text-accent-foreground web:focus:bg-accent web:focus:text-accent-foreground web:focus:outline-none web:disabled:pointer-events-none disabled:opacity-50 web:data-[active]:bg-accent/50 web:data-[state=open]:bg-accent/50'
51
- );
52
-
53
- const NavigationMenuTrigger = React.forwardRef<
54
- NavigationMenuPrimitive.TriggerRef,
55
- NavigationMenuPrimitive.TriggerProps
56
- >(({ className, children, ...props }, ref) => {
57
- const { value } = NavigationMenuPrimitive.useRootContext();
58
- const { value: itemValue } = NavigationMenuPrimitive.useItemContext();
59
-
60
- const progress = useDerivedValue(() =>
61
- value === itemValue ? withTiming(1, { duration: 250 }) : withTiming(0, { duration: 200 })
62
- );
63
- const chevronStyle = useAnimatedStyle(() => ({
64
- transform: [{ rotate: `${progress.value * 180}deg` }],
65
- opacity: interpolate(progress.value, [0, 1], [1, 0.8], Extrapolation.CLAMP),
66
- }));
67
-
68
- return (
69
- <NavigationMenuPrimitive.Trigger
70
- ref={ref}
71
- className={cn(
72
- navigationMenuTriggerStyle(),
73
- 'web:group gap-1.5',
74
- value === itemValue && 'bg-accent',
75
- className
76
- )}
77
- {...props}
78
- >
79
- <>{children}</>
80
- <Animated.View style={chevronStyle}>
81
- <ChevronDown
82
- size={12}
83
- className={cn('relative text-foreground h-3 w-3 web:transition web:duration-200')}
84
- aria-hidden={true}
85
- />
86
- </Animated.View>
87
- </NavigationMenuPrimitive.Trigger>
88
- );
89
- });
90
- NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName;
91
-
92
- const NavigationMenuContent = React.forwardRef<
93
- NavigationMenuPrimitive.ContentRef,
94
- NavigationMenuPrimitive.ContentProps & {
95
- portalHost?: string;
96
- }
97
- >(({ className, children, portalHost, ...props }, ref) => {
98
- const { value } = NavigationMenuPrimitive.useRootContext();
99
- const { value: itemValue } = NavigationMenuPrimitive.useItemContext();
100
- return (
101
- <NavigationMenuPrimitive.Portal hostName={portalHost}>
102
- <NavigationMenuPrimitive.Content
103
- ref={ref}
104
- className={cn(
105
- 'w-full native:border native:border-border native:rounded-lg native:shadow-lg native:bg-popover native:text-popover-foreground native:overflow-hidden',
106
- value === itemValue
107
- ? 'web:animate-in web:fade-in web:slide-in-from-right-20'
108
- : 'web:animate-out web:fade-out web:slide-out-to-left-20',
109
- className
110
- )}
111
- {...props}
112
- >
113
- <Animated.View
114
- entering={Platform.OS !== 'web' ? FadeInLeft : undefined}
115
- exiting={Platform.OS !== 'web' ? FadeOutLeft : undefined}
116
- >
117
- {children}
118
- </Animated.View>
119
- </NavigationMenuPrimitive.Content>
120
- </NavigationMenuPrimitive.Portal>
121
- );
122
- });
123
- NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName;
124
-
125
- const NavigationMenuLink = NavigationMenuPrimitive.Link;
126
-
127
- const NavigationMenuViewport = React.forwardRef<
128
- NavigationMenuPrimitive.ViewportRef,
129
- NavigationMenuPrimitive.ViewportProps
130
- >(({ className, ...props }, ref) => {
131
- return (
132
- <View className={cn('absolute left-0 top-full flex justify-center')}>
133
- <View
134
- className={cn(
135
- 'web:origin-top-center relative mt-1.5 web:h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-lg web:animate-in web:zoom-in-90',
136
- className
137
- )}
138
- ref={ref}
139
- {...props}
140
- >
141
- <NavigationMenuPrimitive.Viewport />
142
- </View>
143
- </View>
144
- );
145
- });
146
- NavigationMenuViewport.displayName = NavigationMenuPrimitive.Viewport.displayName;
147
-
148
- const NavigationMenuIndicator = React.forwardRef<
149
- NavigationMenuPrimitive.IndicatorRef,
150
- NavigationMenuPrimitive.IndicatorProps
151
- >(({ className, ...props }, ref) => {
152
- const { value } = NavigationMenuPrimitive.useRootContext();
153
- const { value: itemValue } = NavigationMenuPrimitive.useItemContext();
154
-
155
- return (
156
- <NavigationMenuPrimitive.Indicator
157
- ref={ref}
158
- className={cn(
159
- 'top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden',
160
- value === itemValue ? 'web:animate-in web:fade-in' : 'web:animate-out web:fade-out',
161
- className
162
- )}
163
- {...props}
164
- >
165
- <View className='relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md shadow-foreground/5' />
166
- </NavigationMenuPrimitive.Indicator>
167
- );
168
- });
169
- NavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName;
170
-
171
- export {
172
- NavigationMenu,
173
- NavigationMenuContent,
174
- NavigationMenuIndicator,
175
- NavigationMenuItem,
176
- NavigationMenuLink,
177
- NavigationMenuList,
178
- NavigationMenuTrigger,
179
- navigationMenuTriggerStyle,
180
- NavigationMenuViewport,
181
- };
@@ -1,39 +0,0 @@
1
- import * as PopoverPrimitive from '@rn-primitives/popover';
2
- import * as React from 'react';
3
- import { Platform, StyleSheet } from 'react-native';
4
- import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
5
- import { cn } from '../../lib/utils';
6
- import { TextClassContext } from './text';
7
-
8
- const Popover = PopoverPrimitive.Root;
9
-
10
- const PopoverTrigger = PopoverPrimitive.Trigger;
11
-
12
- const PopoverContent = React.forwardRef<
13
- PopoverPrimitive.ContentRef,
14
- PopoverPrimitive.ContentProps & { portalHost?: string }
15
- >(({ className, align = 'center', sideOffset = 4, portalHost, ...props }, ref) => {
16
- return (
17
- <PopoverPrimitive.Portal hostName={portalHost}>
18
- <PopoverPrimitive.Overlay style={Platform.OS !== 'web' ? StyleSheet.absoluteFill : undefined}>
19
- <Animated.View entering={FadeIn.duration(200)} exiting={FadeOut}>
20
- <TextClassContext.Provider value='text-popover-foreground'>
21
- <PopoverPrimitive.Content
22
- ref={ref}
23
- align={align}
24
- sideOffset={sideOffset}
25
- className={cn(
26
- 'z-50 w-72 rounded-md web:cursor-auto border border-border bg-popover p-4 shadow-md shadow-foreground/5 web:outline-none 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 web:animate-in web:zoom-in-95 web:fade-in-0',
27
- className
28
- )}
29
- {...props}
30
- />
31
- </TextClassContext.Provider>
32
- </Animated.View>
33
- </PopoverPrimitive.Overlay>
34
- </PopoverPrimitive.Portal>
35
- );
36
- });
37
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
38
-
39
- export { Popover, PopoverContent, PopoverTrigger };
@@ -1,61 +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
- const Progress = React.forwardRef<
14
- ProgressPrimitive.RootRef,
15
- ProgressPrimitive.RootProps & {
16
- indicatorClassName?: string;
17
- }
18
- >(({ className, value, indicatorClassName, ...props }, ref) => {
19
- return (
20
- <ProgressPrimitive.Root
21
- ref={ref}
22
- className={cn('relative h-4 w-full overflow-hidden rounded-full bg-secondary', className)}
23
- {...props}
24
- >
25
- <Indicator value={value} className={indicatorClassName} />
26
- </ProgressPrimitive.Root>
27
- );
28
- });
29
- Progress.displayName = ProgressPrimitive.Root.displayName;
30
-
31
- export { Progress };
32
-
33
- function Indicator({ value, className }: { value: number | undefined | null; className?: string }) {
34
- const progress = useDerivedValue(() => value ?? 0);
35
-
36
- const indicator = useAnimatedStyle(() => {
37
- return {
38
- width: withSpring(
39
- `${interpolate(progress.value, [0, 100], [1, 100], Extrapolation.CLAMP)}%`,
40
- { overshootClamping: true }
41
- ),
42
- };
43
- });
44
-
45
- if (Platform.OS === 'web') {
46
- return (
47
- <View
48
- className={cn('h-full w-full flex-1 bg-primary web:transition-all', className)}
49
- style={{ transform: `translateX(-${100 - (value ?? 0)}%)` }}
50
- >
51
- <ProgressPrimitive.Indicator className={cn('h-full w-full', className)} />
52
- </View>
53
- );
54
- }
55
-
56
- return (
57
- <ProgressPrimitive.Indicator asChild>
58
- <Animated.View style={indicator} className={cn('h-full bg-foreground', className)} />
59
- </ProgressPrimitive.Indicator>
60
- );
61
- }
@@ -1,36 +0,0 @@
1
- import * as RadioGroupPrimitive from '@rn-primitives/radio-group';
2
- import * as React from 'react';
3
- import { View } from 'react-native';
4
- import { cn } from '../../lib/utils';
5
-
6
- const RadioGroup = React.forwardRef<RadioGroupPrimitive.RootRef, RadioGroupPrimitive.RootProps>(
7
- ({ className, ...props }, ref) => {
8
- return (
9
- <RadioGroupPrimitive.Root className={cn('web:grid gap-2', className)} {...props} ref={ref} />
10
- );
11
- }
12
- );
13
- RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
14
-
15
- const RadioGroupItem = React.forwardRef<RadioGroupPrimitive.ItemRef, RadioGroupPrimitive.ItemProps>(
16
- ({ className, ...props }, ref) => {
17
- return (
18
- <RadioGroupPrimitive.Item
19
- ref={ref}
20
- className={cn(
21
- 'aspect-square h-4 w-4 native:h-5 native:w-5 rounded-full justify-center items-center border border-primary text-primary web:ring-offset-background web:focus:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
22
- props.disabled && 'web:cursor-not-allowed opacity-50',
23
- className
24
- )}
25
- {...props}
26
- >
27
- <RadioGroupPrimitive.Indicator className='flex items-center justify-center'>
28
- <View className='aspect-square h-[9px] w-[9px] native:h-[10] native:w-[10] bg-primary rounded-full' />
29
- </RadioGroupPrimitive.Indicator>
30
- </RadioGroupPrimitive.Item>
31
- );
32
- }
33
- );
34
- RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
35
-
36
- export { RadioGroup, RadioGroupItem };
@@ -1,173 +0,0 @@
1
- import * as SelectPrimitive from '@rn-primitives/select';
2
- import * as React from 'react';
3
- import { Platform, StyleSheet, View } from 'react-native';
4
- import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
5
- import { Check } from '../../lib/icons/Check';
6
- import { ChevronDown } from '../../lib/icons/ChevronDown';
7
- import { ChevronUp } from '../../lib/icons/ChevronUp';
8
- import { cn } from '../../lib/utils';
9
-
10
- type Option = SelectPrimitive.Option;
11
-
12
- const Select = SelectPrimitive.Root;
13
-
14
- const SelectGroup = SelectPrimitive.Group;
15
-
16
- const SelectValue = SelectPrimitive.Value;
17
-
18
- const SelectTrigger = React.forwardRef<SelectPrimitive.TriggerRef, SelectPrimitive.TriggerProps>(
19
- ({ className, children, ...props }, ref) => (
20
- <SelectPrimitive.Trigger
21
- ref={ref}
22
- className={cn(
23
- 'flex flex-row h-10 native:h-12 items-center text-sm justify-between rounded-md border border-input bg-background px-3 py-2 web:ring-offset-background text-muted-foreground web:focus:outline-none web:focus:ring-2 web:focus:ring-ring web:focus:ring-offset-2 [&>span]:line-clamp-1',
24
- props.disabled && 'web:cursor-not-allowed opacity-50',
25
- className
26
- )}
27
- {...props}
28
- >
29
- <>{children}</>
30
- <ChevronDown size={16} aria-hidden={true} className='text-foreground opacity-50' />
31
- </SelectPrimitive.Trigger>
32
- )
33
- );
34
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
35
-
36
- /**
37
- * Platform: WEB ONLY
38
- */
39
- const SelectScrollUpButton = ({ className, ...props }: SelectPrimitive.ScrollUpButtonProps) => {
40
- if (Platform.OS !== 'web') {
41
- return null;
42
- }
43
- return (
44
- <SelectPrimitive.ScrollUpButton
45
- className={cn('flex web:cursor-default items-center justify-center py-1', className)}
46
- {...props}
47
- >
48
- <ChevronUp size={14} className='text-foreground' />
49
- </SelectPrimitive.ScrollUpButton>
50
- );
51
- };
52
-
53
- /**
54
- * Platform: WEB ONLY
55
- */
56
- const SelectScrollDownButton = ({ className, ...props }: SelectPrimitive.ScrollDownButtonProps) => {
57
- if (Platform.OS !== 'web') {
58
- return null;
59
- }
60
- return (
61
- <SelectPrimitive.ScrollDownButton
62
- className={cn('flex web:cursor-default items-center justify-center py-1', className)}
63
- {...props}
64
- >
65
- <ChevronDown size={14} className='text-foreground' />
66
- </SelectPrimitive.ScrollDownButton>
67
- );
68
- };
69
-
70
- const SelectContent = React.forwardRef<
71
- SelectPrimitive.ContentRef,
72
- SelectPrimitive.ContentProps & { portalHost?: string }
73
- >(({ className, children, position = 'popper', portalHost, ...props }, ref) => {
74
- const { open } = SelectPrimitive.useRootContext();
75
-
76
- return (
77
- <SelectPrimitive.Portal hostName={portalHost}>
78
- <SelectPrimitive.Overlay style={Platform.OS !== 'web' ? StyleSheet.absoluteFill : undefined}>
79
- <Animated.View className='z-50' entering={FadeIn} exiting={FadeOut}>
80
- <SelectPrimitive.Content
81
- ref={ref}
82
- className={cn(
83
- 'relative z-50 max-h-96 min-w-[8rem] rounded-md border border-border bg-popover shadow-md shadow-foreground/10 py-2 px-1 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',
84
- position === 'popper' &&
85
- 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
86
- open
87
- ? 'web:zoom-in-95 web:animate-in web:fade-in-0'
88
- : 'web:zoom-out-95 web:animate-out web:fade-out-0',
89
- className
90
- )}
91
- position={position}
92
- {...props}
93
- >
94
- <SelectScrollUpButton />
95
- <SelectPrimitive.Viewport
96
- className={cn(
97
- 'p-1',
98
- position === 'popper' &&
99
- 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'
100
- )}
101
- >
102
- {children}
103
- </SelectPrimitive.Viewport>
104
- <SelectScrollDownButton />
105
- </SelectPrimitive.Content>
106
- </Animated.View>
107
- </SelectPrimitive.Overlay>
108
- </SelectPrimitive.Portal>
109
- );
110
- });
111
- SelectContent.displayName = SelectPrimitive.Content.displayName;
112
-
113
- const SelectLabel = React.forwardRef<SelectPrimitive.LabelRef, SelectPrimitive.LabelProps>(
114
- ({ className, ...props }, ref) => (
115
- <SelectPrimitive.Label
116
- ref={ref}
117
- className={cn(
118
- 'py-1.5 native:pb-2 pl-8 native:pl-10 pr-2 text-popover-foreground text-sm native:text-base font-semibold',
119
- className
120
- )}
121
- {...props}
122
- />
123
- )
124
- );
125
- SelectLabel.displayName = SelectPrimitive.Label.displayName;
126
-
127
- const SelectItem = React.forwardRef<SelectPrimitive.ItemRef, SelectPrimitive.ItemProps>(
128
- ({ className, children, ...props }, ref) => (
129
- <SelectPrimitive.Item
130
- ref={ref}
131
- className={cn(
132
- 'relative web:group flex flex-row w-full web:cursor-default web:select-none items-center rounded-sm py-1.5 native:py-2 pl-8 native:pl-10 pr-2 web:hover:bg-accent/50 active:bg-accent web:outline-none web:focus:bg-accent',
133
- props.disabled && 'web:pointer-events-none opacity-50',
134
- className
135
- )}
136
- {...props}
137
- >
138
- <View className='absolute left-2 native:left-3.5 flex h-3.5 native:pt-px w-3.5 items-center justify-center'>
139
- <SelectPrimitive.ItemIndicator>
140
- <Check size={16} strokeWidth={3} className='text-popover-foreground' />
141
- </SelectPrimitive.ItemIndicator>
142
- </View>
143
- <SelectPrimitive.ItemText className='text-sm native:text-lg text-popover-foreground native:text-base web:group-focus:text-accent-foreground' />
144
- </SelectPrimitive.Item>
145
- )
146
- );
147
- SelectItem.displayName = SelectPrimitive.Item.displayName;
148
-
149
- const SelectSeparator = React.forwardRef<
150
- SelectPrimitive.SeparatorRef,
151
- SelectPrimitive.SeparatorProps
152
- >(({ className, ...props }, ref) => (
153
- <SelectPrimitive.Separator
154
- ref={ref}
155
- className={cn('-mx-1 my-1 h-px bg-muted', className)}
156
- {...props}
157
- />
158
- ));
159
- SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
160
-
161
- export {
162
- Select,
163
- SelectContent,
164
- SelectGroup,
165
- SelectItem,
166
- SelectLabel,
167
- SelectScrollDownButton,
168
- SelectScrollUpButton,
169
- SelectSeparator,
170
- SelectTrigger,
171
- SelectValue,
172
- type Option,
173
- };
@@ -1,22 +0,0 @@
1
- import * as SeparatorPrimitive from '@rn-primitives/separator';
2
- import * as React from 'react';
3
- import { cn } from '../../lib/utils';
4
-
5
- const Separator = React.forwardRef<SeparatorPrimitive.RootRef, SeparatorPrimitive.RootProps>(
6
- ({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (
7
- <SeparatorPrimitive.Root
8
- ref={ref}
9
- decorative={decorative}
10
- orientation={orientation}
11
- className={cn(
12
- 'shrink-0 bg-border',
13
- orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',
14
- className
15
- )}
16
- {...props}
17
- />
18
- )
19
- );
20
- Separator.displayName = SeparatorPrimitive.Root.displayName;
21
-
22
- export { Separator };
@@ -1,39 +0,0 @@
1
- import * as React from 'react';
2
- import Animated, {
3
- useAnimatedStyle,
4
- useSharedValue,
5
- withRepeat,
6
- withSequence,
7
- withTiming,
8
- } from 'react-native-reanimated';
9
- import { cn } from '../../lib/utils';
10
-
11
- const duration = 1000;
12
-
13
- function Skeleton({
14
- className,
15
- ...props
16
- }: Omit<React.ComponentPropsWithoutRef<typeof Animated.View>, 'style'>) {
17
- const sv = useSharedValue(1);
18
-
19
- React.useEffect(() => {
20
- sv.value = withRepeat(
21
- withSequence(withTiming(0.5, { duration }), withTiming(1, { duration })),
22
- -1
23
- );
24
- }, []);
25
-
26
- const style = useAnimatedStyle(() => ({
27
- opacity: sv.value,
28
- }));
29
-
30
- return (
31
- <Animated.View
32
- style={style}
33
- className={cn('rounded-md bg-secondary dark:bg-muted', className)}
34
- {...props}
35
- />
36
- );
37
- }
38
-
39
- export { Skeleton };
@@ -1,95 +0,0 @@
1
- import * as SwitchPrimitives from '@rn-primitives/switch';
2
- import * as React from 'react';
3
- import { Platform } from 'react-native';
4
- import Animated, {
5
- interpolateColor,
6
- useAnimatedStyle,
7
- useDerivedValue,
8
- withTiming,
9
- } from 'react-native-reanimated';
10
- import { useColorScheme } from '../../lib/useColorScheme';
11
- import { cn } from '../../lib/utils';
12
-
13
- const SwitchWeb = React.forwardRef<SwitchPrimitives.RootRef, SwitchPrimitives.RootProps>(
14
- ({ className, ...props }, ref) => (
15
- <SwitchPrimitives.Root
16
- className={cn(
17
- 'peer flex-row h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed',
18
- props.checked ? 'bg-primary' : 'bg-input',
19
- props.disabled && 'opacity-50',
20
- className
21
- )}
22
- {...props}
23
- ref={ref}
24
- >
25
- <SwitchPrimitives.Thumb
26
- className={cn(
27
- 'pointer-events-none block h-5 w-5 rounded-full bg-background shadow-md shadow-foreground/5 ring-0 transition-transform',
28
- props.checked ? 'translate-x-5' : 'translate-x-0'
29
- )}
30
- />
31
- </SwitchPrimitives.Root>
32
- )
33
- );
34
-
35
- SwitchWeb.displayName = 'SwitchWeb';
36
-
37
- const RGB_COLORS = {
38
- light: {
39
- primary: 'rgb(24, 24, 27)',
40
- input: 'rgb(228, 228, 231)',
41
- },
42
- dark: {
43
- primary: 'rgb(250, 250, 250)',
44
- input: 'rgb(39, 39, 42)',
45
- },
46
- } as const;
47
-
48
- const SwitchNative = React.forwardRef<SwitchPrimitives.RootRef, SwitchPrimitives.RootProps>(
49
- ({ className, ...props }, ref) => {
50
- const { colorScheme } = useColorScheme();
51
- const translateX = useDerivedValue(() => (props.checked ? 18 : 0));
52
- const animatedRootStyle = useAnimatedStyle(() => {
53
- return {
54
- backgroundColor: interpolateColor(
55
- translateX.value,
56
- [0, 18],
57
- [RGB_COLORS[colorScheme].input, RGB_COLORS[colorScheme].primary]
58
- ),
59
- };
60
- });
61
- const animatedThumbStyle = useAnimatedStyle(() => ({
62
- transform: [{ translateX: withTiming(translateX.value, { duration: 200 }) }],
63
- }));
64
- return (
65
- <Animated.View
66
- style={animatedRootStyle}
67
- className={cn('h-8 w-[46px] rounded-full', props.disabled && 'opacity-50')}
68
- >
69
- <SwitchPrimitives.Root
70
- className={cn(
71
- 'flex-row h-8 w-[46px] shrink-0 items-center rounded-full border-2 border-transparent',
72
- props.checked ? 'bg-primary' : 'bg-input',
73
- className
74
- )}
75
- {...props}
76
- ref={ref}
77
- >
78
- <Animated.View style={animatedThumbStyle}>
79
- <SwitchPrimitives.Thumb
80
- className={'h-7 w-7 rounded-full bg-background shadow-md shadow-foreground/25 ring-0'}
81
- />
82
- </Animated.View>
83
- </SwitchPrimitives.Root>
84
- </Animated.View>
85
- );
86
- }
87
- );
88
- SwitchNative.displayName = 'SwitchNative';
89
-
90
- const Switch = Platform.select({
91
- web: SwitchWeb,
92
- default: SwitchNative,
93
- });
94
-
95
- export { Switch };