@react-native-reusables/cli 0.0.18 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -37
- package/__generated/components/ui/accordion.tsx +1 -1
- package/__generated/components/ui/alert-dialog.tsx +2 -3
- package/__generated/components/ui/aspect-ratio.tsx +1 -1
- package/__generated/components/ui/avatar.tsx +17 -13
- package/__generated/components/ui/badge.tsx +2 -2
- package/__generated/components/ui/card.tsx +1 -1
- package/__generated/components/ui/checkbox.tsx +2 -3
- package/__generated/components/ui/collapsible.tsx +1 -1
- package/__generated/components/ui/context-menu.tsx +3 -11
- package/__generated/components/ui/dialog.tsx +2 -3
- package/__generated/components/ui/dropdown-menu.tsx +1 -1
- package/__generated/components/ui/hover-card.tsx +1 -1
- package/__generated/components/ui/label.tsx +1 -1
- package/__generated/components/ui/menubar.tsx +1 -1
- package/__generated/components/ui/navigation-menu.tsx +6 -4
- package/__generated/components/ui/popover.tsx +1 -1
- package/__generated/components/ui/progress.tsx +14 -10
- package/__generated/components/ui/radio-group.tsx +1 -1
- package/__generated/components/ui/select.tsx +13 -12
- package/__generated/components/ui/separator.tsx +1 -1
- package/__generated/components/ui/switch.tsx +1 -2
- package/__generated/components/ui/table.tsx +1 -1
- package/__generated/components/ui/tabs.tsx +1 -1
- package/__generated/components/ui/text.tsx +2 -2
- package/__generated/components/ui/toggle-group.tsx +1 -1
- package/__generated/components/ui/toggle.tsx +1 -1
- package/__generated/components/ui/tooltip.tsx +1 -2
- package/__generated/components/ui/typography.tsx +2 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -34
- package/__generated/components/primitives/accordion/accordion.tsx +0 -216
- package/__generated/components/primitives/accordion/accordion.web.tsx +0 -295
- package/__generated/components/primitives/accordion/index.ts +0 -1
- package/__generated/components/primitives/accordion/types.ts +0 -45
- package/__generated/components/primitives/alert-dialog/alert-dialog.tsx +0 -237
- package/__generated/components/primitives/alert-dialog/alert-dialog.web.tsx +0 -256
- package/__generated/components/primitives/alert-dialog/index.ts +0 -1
- package/__generated/components/primitives/alert-dialog/types.ts +0 -48
- package/__generated/components/primitives/aspect-ratio.tsx +0 -23
- package/__generated/components/primitives/avatar/index.tsx +0 -95
- package/__generated/components/primitives/avatar/types.ts +0 -10
- package/__generated/components/primitives/checkbox/checkbox.tsx +0 -101
- package/__generated/components/primitives/checkbox/checkbox.web.tsx +0 -114
- package/__generated/components/primitives/checkbox/index.ts +0 -1
- package/__generated/components/primitives/checkbox/types.ts +0 -11
- package/__generated/components/primitives/collapsible/collapsible.tsx +0 -119
- package/__generated/components/primitives/collapsible/collapsible.web.tsx +0 -157
- package/__generated/components/primitives/collapsible/index.ts +0 -1
- package/__generated/components/primitives/collapsible/types.ts +0 -18
- package/__generated/components/primitives/context-menu/context-menu.tsx +0 -648
- package/__generated/components/primitives/context-menu/context-menu.web.tsx +0 -533
- package/__generated/components/primitives/context-menu/index.ts +0 -1
- package/__generated/components/primitives/context-menu/types.ts +0 -90
- package/__generated/components/primitives/dialog/dialog.tsx +0 -211
- package/__generated/components/primitives/dialog/dialog.web.tsx +0 -197
- package/__generated/components/primitives/dialog/index.ts +0 -1
- package/__generated/components/primitives/dialog/types.ts +0 -60
- package/__generated/components/primitives/dropdown-menu/dropdown-menu.tsx +0 -608
- package/__generated/components/primitives/dropdown-menu/dropdown-menu.web.tsx +0 -550
- package/__generated/components/primitives/dropdown-menu/index.ts +0 -1
- package/__generated/components/primitives/dropdown-menu/types.ts +0 -72
- package/__generated/components/primitives/hooks/index.ts +0 -3
- package/__generated/components/primitives/hooks/useAugmentedRef.tsx +0 -29
- package/__generated/components/primitives/hooks/useControllableState.tsx +0 -75
- package/__generated/components/primitives/hooks/useRelativePosition.tsx +0 -227
- package/__generated/components/primitives/hover-card/hover-card.tsx +0 -279
- package/__generated/components/primitives/hover-card/hover-card.web.tsx +0 -150
- package/__generated/components/primitives/hover-card/index.ts +0 -1
- package/__generated/components/primitives/hover-card/types.ts +0 -51
- package/__generated/components/primitives/label/index.ts +0 -1
- package/__generated/components/primitives/label/label.tsx +0 -31
- package/__generated/components/primitives/label/label.web.tsx +0 -36
- package/__generated/components/primitives/label/types.ts +0 -15
- package/__generated/components/primitives/menubar/index.ts +0 -1
- package/__generated/components/primitives/menubar/menubar.tsx +0 -622
- package/__generated/components/primitives/menubar/menubar.web.tsx +0 -548
- package/__generated/components/primitives/menubar/types.ts +0 -77
- package/__generated/components/primitives/navigation-menu/index.ts +0 -1
- package/__generated/components/primitives/navigation-menu/navigation-menu.tsx +0 -315
- package/__generated/components/primitives/navigation-menu/navigation-menu.web.tsx +0 -264
- package/__generated/components/primitives/navigation-menu/types.ts +0 -49
- package/__generated/components/primitives/popover/index.ts +0 -1
- package/__generated/components/primitives/popover/popover.tsx +0 -290
- package/__generated/components/primitives/popover/popover.web.tsx +0 -191
- package/__generated/components/primitives/popover/types.ts +0 -24
- package/__generated/components/primitives/portal.tsx +0 -82
- package/__generated/components/primitives/progress/index.ts +0 -1
- package/__generated/components/primitives/progress/progress.tsx +0 -59
- package/__generated/components/primitives/progress/progress.web.tsx +0 -36
- package/__generated/components/primitives/progress/types.ts +0 -7
- package/__generated/components/primitives/radio-group/index.ts +0 -1
- package/__generated/components/primitives/radio-group/radio-group.tsx +0 -116
- package/__generated/components/primitives/radio-group/radio-group.web.tsx +0 -78
- package/__generated/components/primitives/radio-group/types.ts +0 -15
- package/__generated/components/primitives/select/index.ts +0 -1
- package/__generated/components/primitives/select/select.tsx +0 -466
- package/__generated/components/primitives/select/select.web.tsx +0 -332
- package/__generated/components/primitives/select/types.ts +0 -89
- package/__generated/components/primitives/separator/index.tsx +0 -23
- package/__generated/components/primitives/separator/types.ts +0 -6
- package/__generated/components/primitives/slider/index.ts +0 -1
- package/__generated/components/primitives/slider/slider.tsx +0 -89
- package/__generated/components/primitives/slider/slider.web.tsx +0 -67
- package/__generated/components/primitives/slider/types.ts +0 -24
- package/__generated/components/primitives/slot.tsx +0 -187
- package/__generated/components/primitives/switch/index.ts +0 -1
- package/__generated/components/primitives/switch/switch.tsx +0 -65
- package/__generated/components/primitives/switch/switch.web.tsx +0 -67
- package/__generated/components/primitives/switch/types.ts +0 -11
- package/__generated/components/primitives/table.tsx +0 -55
- package/__generated/components/primitives/tabs/index.ts +0 -1
- package/__generated/components/primitives/tabs/tabs.tsx +0 -133
- package/__generated/components/primitives/tabs/tabs.web.tsx +0 -97
- package/__generated/components/primitives/tabs/types.ts +0 -24
- package/__generated/components/primitives/toast/index.tsx +0 -128
- package/__generated/components/primitives/toast/types.ts +0 -7
- package/__generated/components/primitives/toggle/index.ts +0 -1
- package/__generated/components/primitives/toggle/toggle.tsx +0 -37
- package/__generated/components/primitives/toggle/toggle.web.tsx +0 -26
- package/__generated/components/primitives/toggle/types.ts +0 -7
- package/__generated/components/primitives/toggle-group/index.ts +0 -1
- package/__generated/components/primitives/toggle-group/toggle-group.tsx +0 -125
- package/__generated/components/primitives/toggle-group/toggle-group.web.tsx +0 -124
- package/__generated/components/primitives/toggle-group/types.ts +0 -37
- package/__generated/components/primitives/toolbar/index.ts +0 -1
- package/__generated/components/primitives/toolbar/toolbar.tsx +0 -125
- package/__generated/components/primitives/toolbar/toolbar.web.tsx +0 -129
- package/__generated/components/primitives/toolbar/types.ts +0 -39
- package/__generated/components/primitives/tooltip/index.ts +0 -1
- package/__generated/components/primitives/tooltip/tooltip.tsx +0 -277
- package/__generated/components/primitives/tooltip/tooltip.web.tsx +0 -181
- package/__generated/components/primitives/tooltip/types.ts +0 -42
- package/__generated/components/primitives/types.ts +0 -105
- package/__generated/components/primitives/utils.ts +0 -61
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Please follow [the initial setup steps](https://rnr-docs.vercel.app/getting-started/initial-setup/) before using
|
|
4
4
|
|
|
5
|
-
A CLI to add [react-native-reusables](https://rnr-docs.vercel.app/getting-started/introduction/) components to your project. When components depend on other components
|
|
5
|
+
A CLI to add [react-native-reusables](https://rnr-docs.vercel.app/getting-started/introduction/) components to your project. When components depend on other components, they will also be added to your project.
|
|
6
6
|
|
|
7
7
|
## How to use
|
|
8
8
|
|
|
@@ -50,41 +50,6 @@ If you do not add arguments, you will be promted to select the `ui` components y
|
|
|
50
50
|
- `tooltip`
|
|
51
51
|
- `typography`
|
|
52
52
|
|
|
53
|
-
#### Primitive Components
|
|
54
|
-
|
|
55
|
-
- `accordion-primitive`
|
|
56
|
-
- `alert-dialog-primitive`
|
|
57
|
-
- `aspect-ratio-primitive`
|
|
58
|
-
- `avatar-primitive`
|
|
59
|
-
- `checkbox-primitive`
|
|
60
|
-
- `collapsible-primitive`
|
|
61
|
-
- `context-menu-primitive`
|
|
62
|
-
- `dialog-primitive`
|
|
63
|
-
- `dropdown-menu-primitive`
|
|
64
|
-
- `hover-card-primitive`
|
|
65
|
-
- `label-primitive`
|
|
66
|
-
- `menubar-primitive`
|
|
67
|
-
- `navigation-menu-primitive`
|
|
68
|
-
- `popover-primitive`
|
|
69
|
-
- `progress-primitive`
|
|
70
|
-
- `radio-group-primitive`
|
|
71
|
-
- `select-primitive`
|
|
72
|
-
- `separator-primitive`
|
|
73
|
-
- `slider-primitive`
|
|
74
|
-
- `switch-primitive`
|
|
75
|
-
- `table-primitive`
|
|
76
|
-
- `tabs-primitive`
|
|
77
|
-
- `toast-primitive`
|
|
78
|
-
- `toggle-primitive`
|
|
79
|
-
- `toggle-group-primitive`
|
|
80
|
-
- `toolbar-primitive`
|
|
81
|
-
- `tooltip-primitive`
|
|
82
|
-
- `hooks-primitive`
|
|
83
|
-
- `portal-primitive`
|
|
84
|
-
- `slot-primitive`
|
|
85
|
-
- `types-primitive`
|
|
86
|
-
- `utils-primitive`
|
|
87
|
-
|
|
88
53
|
### Flags
|
|
89
54
|
|
|
90
55
|
- `-o` or `--overwrite`: Overwrite existing files. Default to `false`
|
|
@@ -94,4 +59,4 @@ If you do not add arguments, you will be promted to select the `ui` components y
|
|
|
94
59
|
This project uses code from shadcn.
|
|
95
60
|
The code is licensed under the MIT License.
|
|
96
61
|
https://github.com/shadcn-ui/ui
|
|
97
|
-
```
|
|
62
|
+
```
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { Platform, StyleSheet, View } from 'react-native';
|
|
3
3
|
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
4
4
|
import { buttonTextVariants, buttonVariants } from '../../components/ui/button';
|
|
5
|
-
import * as AlertDialogPrimitive from '@
|
|
5
|
+
import * as AlertDialogPrimitive from '@rn-primitives/alert-dialog';
|
|
6
6
|
import { cn } from '../../lib/utils';
|
|
7
7
|
import { TextClassContext } from './text';
|
|
8
8
|
|
|
@@ -19,9 +19,8 @@ const AlertDialogOverlayWeb = React.forwardRef<
|
|
|
19
19
|
const { open } = AlertDialogPrimitive.useRootContext();
|
|
20
20
|
return (
|
|
21
21
|
<AlertDialogPrimitive.Overlay
|
|
22
|
-
style={StyleSheet.absoluteFill}
|
|
23
22
|
className={cn(
|
|
24
|
-
'z-50 bg-black/80 flex justify-center items-center p-2',
|
|
23
|
+
'z-50 bg-black/80 flex justify-center items-center p-2 absolute top-0 right-0 bottom-0 left-0',
|
|
25
24
|
open ? 'web:animate-in web:fade-in-0' : 'web:animate-out web:fade-out-0',
|
|
26
25
|
className
|
|
27
26
|
)}
|
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import * as AvatarPrimitive from '@
|
|
2
|
+
import * as AvatarPrimitive from '@rn-primitives/avatar';
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
4
|
|
|
5
|
+
const AvatarPrimitiveRoot = AvatarPrimitive.Root;
|
|
6
|
+
const AvatarPrimitiveImage = AvatarPrimitive.Image;
|
|
7
|
+
const AvatarPrimitiveFallback = AvatarPrimitive.Fallback;
|
|
8
|
+
|
|
5
9
|
const Avatar = React.forwardRef<
|
|
6
|
-
React.ElementRef<typeof
|
|
7
|
-
React.ComponentPropsWithoutRef<typeof
|
|
10
|
+
React.ElementRef<typeof AvatarPrimitiveRoot>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitiveRoot>
|
|
8
12
|
>(({ className, ...props }, ref) => (
|
|
9
|
-
<
|
|
13
|
+
<AvatarPrimitiveRoot
|
|
10
14
|
ref={ref}
|
|
11
15
|
className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
|
|
12
16
|
{...props}
|
|
13
17
|
/>
|
|
14
18
|
));
|
|
15
|
-
Avatar.displayName =
|
|
19
|
+
Avatar.displayName = AvatarPrimitiveRoot.displayName;
|
|
16
20
|
|
|
17
21
|
const AvatarImage = React.forwardRef<
|
|
18
|
-
React.ElementRef<typeof
|
|
19
|
-
React.ComponentPropsWithoutRef<typeof
|
|
22
|
+
React.ElementRef<typeof AvatarPrimitiveImage>,
|
|
23
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitiveImage>
|
|
20
24
|
>(({ className, ...props }, ref) => (
|
|
21
|
-
<
|
|
25
|
+
<AvatarPrimitiveImage
|
|
22
26
|
ref={ref}
|
|
23
27
|
className={cn('aspect-square h-full w-full', className)}
|
|
24
28
|
{...props}
|
|
25
29
|
/>
|
|
26
30
|
));
|
|
27
|
-
AvatarImage.displayName =
|
|
31
|
+
AvatarImage.displayName = AvatarPrimitiveImage.displayName;
|
|
28
32
|
|
|
29
33
|
const AvatarFallback = React.forwardRef<
|
|
30
|
-
React.ElementRef<typeof
|
|
31
|
-
React.ComponentPropsWithoutRef<typeof
|
|
34
|
+
React.ElementRef<typeof AvatarPrimitiveFallback>,
|
|
35
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitiveFallback>
|
|
32
36
|
>(({ className, ...props }, ref) => (
|
|
33
|
-
<
|
|
37
|
+
<AvatarPrimitiveFallback
|
|
34
38
|
ref={ref}
|
|
35
39
|
className={cn(
|
|
36
40
|
'flex h-full w-full items-center justify-center rounded-full bg-muted',
|
|
@@ -39,6 +43,6 @@ const AvatarFallback = React.forwardRef<
|
|
|
39
43
|
{...props}
|
|
40
44
|
/>
|
|
41
45
|
));
|
|
42
|
-
AvatarFallback.displayName =
|
|
46
|
+
AvatarFallback.displayName = AvatarPrimitiveFallback.displayName;
|
|
43
47
|
|
|
44
48
|
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import * as Slot from '@
|
|
4
|
-
import type { SlottableViewProps } from '@
|
|
3
|
+
import * as Slot from '@rn-primitives/slot';
|
|
4
|
+
import type { SlottableViewProps } from '@rn-primitives/types';
|
|
5
5
|
import { cn } from '../../lib/utils';
|
|
6
6
|
import { TextClassContext } from './text';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Text, View } from 'react-native';
|
|
3
3
|
import { TextClassContext } from './text';
|
|
4
|
-
import { TextRef, ViewRef } from '@
|
|
4
|
+
import { TextRef, ViewRef } from '@rn-primitives/types';
|
|
5
5
|
import { cn } from '../../lib/utils';
|
|
6
6
|
|
|
7
7
|
const Card = React.forwardRef<ViewRef, React.ComponentPropsWithoutRef<typeof View>>(
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as CheckboxPrimitive from '@
|
|
1
|
+
import * as CheckboxPrimitive from '@rn-primitives/checkbox';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Check } from '../../lib/icons/Check';
|
|
4
|
-
|
|
5
3
|
import { Platform } from 'react-native';
|
|
4
|
+
import { Check } from '../../lib/icons/Check';
|
|
6
5
|
import { cn } from '../../lib/utils';
|
|
7
6
|
|
|
8
7
|
const Checkbox = React.forwardRef<
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as ContextMenuPrimitive from '@
|
|
1
|
+
import * as ContextMenuPrimitive from '@rn-primitives/context-menu';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Platform, StyleProp, StyleSheet, Text, View, ViewStyle } from 'react-native';
|
|
4
4
|
import { Check } from '../../lib/icons/Check';
|
|
@@ -9,15 +9,9 @@ import { cn } from '../../lib/utils';
|
|
|
9
9
|
import { TextClassContext } from './text';
|
|
10
10
|
|
|
11
11
|
const ContextMenu = ContextMenuPrimitive.Root;
|
|
12
|
-
|
|
13
12
|
const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
14
|
-
|
|
15
13
|
const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
16
|
-
|
|
17
|
-
const ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
18
|
-
|
|
19
14
|
const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
20
|
-
|
|
21
15
|
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
22
16
|
|
|
23
17
|
const ContextMenuSubTrigger = React.forwardRef<
|
|
@@ -139,7 +133,7 @@ ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
|
139
133
|
const ContextMenuCheckboxItem = React.forwardRef<
|
|
140
134
|
React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
|
141
135
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
|
|
142
|
-
>(({ className, children,
|
|
136
|
+
>(({ className, children, ...props }, ref) => (
|
|
143
137
|
<ContextMenuPrimitive.CheckboxItem
|
|
144
138
|
ref={ref}
|
|
145
139
|
className={cn(
|
|
@@ -147,7 +141,6 @@ const ContextMenuCheckboxItem = React.forwardRef<
|
|
|
147
141
|
props.disabled && 'web:pointer-events-none opacity-50',
|
|
148
142
|
className
|
|
149
143
|
)}
|
|
150
|
-
checked={checked}
|
|
151
144
|
{...props}
|
|
152
145
|
>
|
|
153
146
|
<View className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>
|
|
@@ -233,10 +226,10 @@ export {
|
|
|
233
226
|
ContextMenu,
|
|
234
227
|
ContextMenuCheckboxItem,
|
|
235
228
|
ContextMenuContent,
|
|
229
|
+
ContextMenuTrigger,
|
|
236
230
|
ContextMenuGroup,
|
|
237
231
|
ContextMenuItem,
|
|
238
232
|
ContextMenuLabel,
|
|
239
|
-
ContextMenuPortal,
|
|
240
233
|
ContextMenuRadioGroup,
|
|
241
234
|
ContextMenuRadioItem,
|
|
242
235
|
ContextMenuSeparator,
|
|
@@ -244,5 +237,4 @@ export {
|
|
|
244
237
|
ContextMenuSub,
|
|
245
238
|
ContextMenuSubContent,
|
|
246
239
|
ContextMenuSubTrigger,
|
|
247
|
-
ContextMenuTrigger,
|
|
248
240
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as DialogPrimitive from '@
|
|
1
|
+
import * as DialogPrimitive from '@rn-primitives/dialog';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Platform, StyleSheet, View } from 'react-native';
|
|
4
4
|
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
@@ -20,9 +20,8 @@ const DialogOverlayWeb = React.forwardRef<
|
|
|
20
20
|
const { open } = DialogPrimitive.useRootContext();
|
|
21
21
|
return (
|
|
22
22
|
<DialogPrimitive.Overlay
|
|
23
|
-
style={StyleSheet.absoluteFill}
|
|
24
23
|
className={cn(
|
|
25
|
-
'z-50 bg-black/80 flex justify-center items-center p-2',
|
|
24
|
+
'z-50 bg-black/80 flex justify-center items-center p-2 absolute top-0 right-0 bottom-0 left-0',
|
|
26
25
|
open ? 'web:animate-in web:fade-in-0' : 'web:animate-out web:fade-out-0',
|
|
27
26
|
className
|
|
28
27
|
)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as DropdownMenuPrimitive from '@
|
|
1
|
+
import * as DropdownMenuPrimitive from '@rn-primitives/dropdown-menu';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Platform, StyleProp, StyleSheet, Text, View, ViewStyle } from 'react-native';
|
|
4
4
|
import { Check } from '../../lib/icons/Check';
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { Platform, StyleSheet } from 'react-native';
|
|
3
3
|
import Animated, { FadeIn } from 'react-native-reanimated';
|
|
4
4
|
import { TextClassContext } from './text';
|
|
5
|
-
import * as HoverCardPrimitive from '@
|
|
5
|
+
import * as HoverCardPrimitive from '@rn-primitives/hover-card';
|
|
6
6
|
import { cn } from '../../lib/utils';
|
|
7
7
|
|
|
8
8
|
const HoverCard = HoverCardPrimitive.Root;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as NavigationMenuPrimitive from '@
|
|
1
|
+
import * as NavigationMenuPrimitive from '@rn-primitives/navigation-menu';
|
|
2
2
|
import { cva } from 'class-variance-authority';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Platform, View } from 'react-native';
|
|
@@ -102,7 +102,7 @@ const NavigationMenuContent = React.forwardRef<
|
|
|
102
102
|
<NavigationMenuPrimitive.Content
|
|
103
103
|
ref={ref}
|
|
104
104
|
className={cn(
|
|
105
|
-
'
|
|
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
106
|
value === itemValue
|
|
107
107
|
? 'web:animate-in web:fade-in web:slide-in-from-right-20'
|
|
108
108
|
: 'web:animate-out web:fade-out web:slide-out-to-left-20',
|
|
@@ -130,14 +130,16 @@ const NavigationMenuViewport = React.forwardRef<
|
|
|
130
130
|
>(({ className, ...props }, ref) => {
|
|
131
131
|
return (
|
|
132
132
|
<View className={cn('absolute left-0 top-full flex justify-center')}>
|
|
133
|
-
<
|
|
133
|
+
<View
|
|
134
134
|
className={cn(
|
|
135
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
136
|
className
|
|
137
137
|
)}
|
|
138
138
|
ref={ref}
|
|
139
139
|
{...props}
|
|
140
|
-
|
|
140
|
+
>
|
|
141
|
+
<NavigationMenuPrimitive.Viewport />
|
|
142
|
+
</View>
|
|
141
143
|
</View>
|
|
142
144
|
);
|
|
143
145
|
});
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { Platform, StyleSheet } from 'react-native';
|
|
3
3
|
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
4
4
|
import { TextClassContext } from './text';
|
|
5
|
-
import * as PopoverPrimitive from '@
|
|
5
|
+
import * as PopoverPrimitive from '@rn-primitives/popover';
|
|
6
6
|
import { cn } from '../../lib/utils';
|
|
7
7
|
|
|
8
8
|
const Popover = PopoverPrimitive.Root;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Platform } from 'react-native';
|
|
2
|
+
import { Platform, View } from 'react-native';
|
|
3
3
|
import Animated, {
|
|
4
4
|
Extrapolation,
|
|
5
5
|
interpolate,
|
|
@@ -7,20 +7,22 @@ import Animated, {
|
|
|
7
7
|
useDerivedValue,
|
|
8
8
|
withSpring,
|
|
9
9
|
} from 'react-native-reanimated';
|
|
10
|
-
import * as ProgressPrimitive from '@
|
|
10
|
+
import * as ProgressPrimitive from '@rn-primitives/progress';
|
|
11
11
|
import { cn } from '../../lib/utils';
|
|
12
12
|
|
|
13
13
|
const Progress = React.forwardRef<
|
|
14
14
|
React.ElementRef<typeof ProgressPrimitive.Root>,
|
|
15
|
-
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
|
|
16
|
-
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> & {
|
|
16
|
+
indicatorClassName?: string;
|
|
17
|
+
}
|
|
18
|
+
>(({ className, value, indicatorClassName, ...props }, ref) => {
|
|
17
19
|
return (
|
|
18
20
|
<ProgressPrimitive.Root
|
|
19
21
|
ref={ref}
|
|
20
22
|
className={cn('relative h-4 w-full overflow-hidden rounded-full bg-secondary', className)}
|
|
21
23
|
{...props}
|
|
22
24
|
>
|
|
23
|
-
<Indicator value={value} />
|
|
25
|
+
<Indicator value={value} className={indicatorClassName} />
|
|
24
26
|
</ProgressPrimitive.Root>
|
|
25
27
|
);
|
|
26
28
|
});
|
|
@@ -28,7 +30,7 @@ Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
|
28
30
|
|
|
29
31
|
export { Progress };
|
|
30
32
|
|
|
31
|
-
function Indicator({ value }: { value: number | undefined | null }) {
|
|
33
|
+
function Indicator({ value, className }: { value: number | undefined | null; className?: string }) {
|
|
32
34
|
const progress = useDerivedValue(() => value ?? 0);
|
|
33
35
|
|
|
34
36
|
const indicator = useAnimatedStyle(() => {
|
|
@@ -42,16 +44,18 @@ function Indicator({ value }: { value: number | undefined | null }) {
|
|
|
42
44
|
|
|
43
45
|
if (Platform.OS === 'web') {
|
|
44
46
|
return (
|
|
45
|
-
<
|
|
46
|
-
className='h-full w-full flex-1 bg-primary web:transition-all'
|
|
47
|
+
<View
|
|
48
|
+
className={cn('h-full w-full flex-1 bg-primary web:transition-all', className)}
|
|
47
49
|
style={{ transform: `translateX(-${100 - (value ?? 0)}%)` }}
|
|
48
|
-
|
|
50
|
+
>
|
|
51
|
+
<ProgressPrimitive.Indicator className={cn('h-full w-full ', className)} />
|
|
52
|
+
</View>
|
|
49
53
|
);
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
return (
|
|
53
57
|
<ProgressPrimitive.Indicator asChild>
|
|
54
|
-
<Animated.View style={indicator} className={cn('h-full bg-foreground')} />
|
|
58
|
+
<Animated.View style={indicator} className={cn('h-full bg-foreground', className)} />
|
|
55
59
|
</ProgressPrimitive.Indicator>
|
|
56
60
|
);
|
|
57
61
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import * as RadioGroupPrimitive from '@
|
|
3
|
+
import * as RadioGroupPrimitive from '@rn-primitives/radio-group';
|
|
4
4
|
import { cn } from '../../lib/utils';
|
|
5
5
|
|
|
6
6
|
const RadioGroup = React.forwardRef<
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as SelectPrimitive from '@
|
|
1
|
+
import * as SelectPrimitive from '@rn-primitives/select';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Platform, StyleSheet, View } from 'react-native';
|
|
4
4
|
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
@@ -99,15 +99,17 @@ const SelectContent = React.forwardRef<
|
|
|
99
99
|
{...props}
|
|
100
100
|
>
|
|
101
101
|
<SelectScrollUpButton />
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
<View>
|
|
103
|
+
<SelectPrimitive.Viewport
|
|
104
|
+
className={cn(
|
|
105
|
+
'p-1',
|
|
106
|
+
position === 'popper' &&
|
|
107
|
+
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'
|
|
108
|
+
)}
|
|
109
|
+
>
|
|
110
|
+
{children}
|
|
111
|
+
</SelectPrimitive.Viewport>
|
|
112
|
+
</View>
|
|
111
113
|
<SelectScrollDownButton />
|
|
112
114
|
</SelectPrimitive.Content>
|
|
113
115
|
</Animated.View>
|
|
@@ -139,7 +141,7 @@ const SelectItem = React.forwardRef<
|
|
|
139
141
|
<SelectPrimitive.Item
|
|
140
142
|
ref={ref}
|
|
141
143
|
className={cn(
|
|
142
|
-
'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 active:bg-accent web:outline-none web:focus:bg-accent',
|
|
144
|
+
'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',
|
|
143
145
|
props.disabled && 'web:pointer-events-none opacity-50',
|
|
144
146
|
className
|
|
145
147
|
)}
|
|
@@ -150,7 +152,6 @@ const SelectItem = React.forwardRef<
|
|
|
150
152
|
<Check size={16} strokeWidth={3} className='text-popover-foreground' />
|
|
151
153
|
</SelectPrimitive.ItemIndicator>
|
|
152
154
|
</View>
|
|
153
|
-
|
|
154
155
|
<SelectPrimitive.ItemText className='text-sm native:text-lg text-popover-foreground native:text-base web:group-focus:text-accent-foreground' />
|
|
155
156
|
</SelectPrimitive.Item>
|
|
156
157
|
));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as SwitchPrimitives from '@rn-primitives/switch';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { Platform } from 'react-native';
|
|
3
4
|
import Animated, {
|
|
@@ -6,9 +7,7 @@ import Animated, {
|
|
|
6
7
|
useDerivedValue,
|
|
7
8
|
withTiming,
|
|
8
9
|
} from 'react-native-reanimated';
|
|
9
|
-
import * as SwitchPrimitives from '@rnr/switch';
|
|
10
10
|
import { useColorScheme } from '../../lib/useColorScheme';
|
|
11
|
-
|
|
12
11
|
import { cn } from '../../lib/utils';
|
|
13
12
|
|
|
14
13
|
const SwitchWeb = React.forwardRef<
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as Slot from '@
|
|
2
|
-
import { SlottableTextProps, TextRef } from '@
|
|
1
|
+
import * as Slot from '@rn-primitives/slot';
|
|
2
|
+
import { SlottableTextProps, TextRef } from '@rn-primitives/types';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Text as RNText } from 'react-native';
|
|
5
5
|
import { cn } from '../../lib/utils';
|
|
@@ -3,7 +3,7 @@ import type { LucideIcon } from 'lucide-react-native';
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { toggleTextVariants, toggleVariants } from '../../components/ui/toggle';
|
|
5
5
|
import { TextClassContext } from './text';
|
|
6
|
-
import * as ToggleGroupPrimitive from '@
|
|
6
|
+
import * as ToggleGroupPrimitive from '@rn-primitives/toggle-group';
|
|
7
7
|
import { cn } from '../../lib/utils';
|
|
8
8
|
|
|
9
9
|
const ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariants> | null>(null);
|
|
@@ -2,7 +2,7 @@ import { cva, type VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
import type { LucideIcon } from 'lucide-react-native';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { TextClassContext } from './text';
|
|
5
|
-
import * as TogglePrimitive from '@
|
|
5
|
+
import * as TogglePrimitive from '@rn-primitives/toggle';
|
|
6
6
|
import { cn } from '../../lib/utils';
|
|
7
7
|
|
|
8
8
|
const toggleVariants = cva(
|
|
@@ -2,11 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import { Platform, StyleSheet } from 'react-native';
|
|
3
3
|
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
4
4
|
import { TextClassContext } from './text';
|
|
5
|
-
import * as TooltipPrimitive from '@
|
|
5
|
+
import * as TooltipPrimitive from '@rn-primitives/tooltip';
|
|
6
6
|
import { cn } from '../../lib/utils';
|
|
7
7
|
|
|
8
8
|
const Tooltip = TooltipPrimitive.Root;
|
|
9
|
-
|
|
10
9
|
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
11
10
|
|
|
12
11
|
const TooltipContent = React.forwardRef<
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as Slot from '@
|
|
2
|
-
import { SlottableTextProps, TextRef } from '@
|
|
1
|
+
import * as Slot from '@rn-primitives/slot';
|
|
2
|
+
import { SlottableTextProps, TextRef } from '@rn-primitives/types';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Platform, Text as RNText } from 'react-native';
|
|
5
5
|
import { cn } from '../../lib/utils';
|