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