@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.
- package/LICENSE +1 -1
- package/bin.cjs +60513 -0
- package/package.json +7 -80
- package/README.md +0 -63
- package/__generated/components/ui/accordion.tsx +0 -125
- package/__generated/components/ui/alert-dialog.tsx +0 -160
- package/__generated/components/ui/alert.tsx +0 -75
- package/__generated/components/ui/aspect-ratio.tsx +0 -5
- package/__generated/components/ui/avatar.tsx +0 -41
- package/__generated/components/ui/badge.tsx +0 -51
- package/__generated/components/ui/button.tsx +0 -85
- package/__generated/components/ui/card.tsx +0 -55
- package/__generated/components/ui/checkbox.tsx +0 -32
- package/__generated/components/ui/collapsible.tsx +0 -9
- package/__generated/components/ui/context-menu.tsx +0 -245
- package/__generated/components/ui/dialog.tsx +0 -147
- package/__generated/components/ui/dropdown-menu.tsx +0 -253
- package/__generated/components/ui/hover-card.tsx +0 -45
- package/__generated/components/ui/input.tsx +0 -24
- package/__generated/components/ui/label.tsx +0 -27
- package/__generated/components/ui/menubar.tsx +0 -261
- package/__generated/components/ui/navigation-menu.tsx +0 -181
- package/__generated/components/ui/popover.tsx +0 -39
- package/__generated/components/ui/progress.tsx +0 -61
- package/__generated/components/ui/radio-group.tsx +0 -36
- package/__generated/components/ui/select.tsx +0 -173
- package/__generated/components/ui/separator.tsx +0 -22
- package/__generated/components/ui/skeleton.tsx +0 -39
- package/__generated/components/ui/switch.tsx +0 -95
- package/__generated/components/ui/table.tsx +0 -92
- package/__generated/components/ui/tabs.tsx +0 -62
- package/__generated/components/ui/text.tsx +0 -24
- package/__generated/components/ui/textarea.tsx +0 -27
- package/__generated/components/ui/toggle-group.tsx +0 -84
- package/__generated/components/ui/toggle.tsx +0 -85
- package/__generated/components/ui/tooltip.tsx +0 -38
- package/__generated/components/ui/typography.tsx +0 -205
- package/__generated/starter-base/README.md +0 -16
- package/__generated/starter-base/app/+not-found.tsx +0 -18
- package/__generated/starter-base/app/_layout.tsx +0 -69
- package/__generated/starter-base/app/index.tsx +0 -95
- package/__generated/starter-base/app.json +0 -40
- package/__generated/starter-base/assets/images/adaptive-icon.png +0 -0
- package/__generated/starter-base/assets/images/favicon.png +0 -0
- package/__generated/starter-base/assets/images/icon.png +0 -0
- package/__generated/starter-base/assets/images/splash.png +0 -0
- package/__generated/starter-base/babel.config.js +0 -6
- package/__generated/starter-base/components/ThemeToggle.tsx +0 -38
- package/__generated/starter-base/components/ui/avatar.tsx +0 -45
- package/__generated/starter-base/components/ui/button.tsx +0 -88
- package/__generated/starter-base/components/ui/card.tsx +0 -57
- package/__generated/starter-base/components/ui/progress.tsx +0 -61
- package/__generated/starter-base/components/ui/text.tsx +0 -24
- package/__generated/starter-base/components/ui/tooltip.tsx +0 -39
- package/__generated/starter-base/gitignore-template +0 -41
- package/__generated/starter-base/global.css +0 -49
- package/__generated/starter-base/index.js +0 -12
- package/__generated/starter-base/lib/android-navigation-bar.ts +0 -11
- package/__generated/starter-base/lib/constants.ts +0 -18
- package/__generated/starter-base/lib/icons/Info.tsx +0 -4
- package/__generated/starter-base/lib/icons/MoonStar.tsx +0 -4
- package/__generated/starter-base/lib/icons/Sun.tsx +0 -4
- package/__generated/starter-base/lib/icons/iconWithClassName.ts +0 -14
- package/__generated/starter-base/lib/useColorScheme.tsx +0 -11
- package/__generated/starter-base/lib/utils.ts +0 -6
- package/__generated/starter-base/metro.config.js +0 -6
- package/__generated/starter-base/nativewind-env.d.ts +0 -1
- package/__generated/starter-base/npmrc-template +0 -2
- package/__generated/starter-base/package.json +0 -53
- package/__generated/starter-base/tailwind.config.js +0 -65
- package/__generated/starter-base/tsconfig.json +0 -19
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,87 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-reusables/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"author": {
|
|
10
|
-
"name": "mrzachnugent",
|
|
11
|
-
"url": "https://twitter.com/mrzachnugent"
|
|
12
|
-
},
|
|
3
|
+
"version": "0.5.0-alpha.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "A CLI for React Native Reusables",
|
|
6
|
+
"main": "bin.cjs",
|
|
7
|
+
"bin": "bin.cjs",
|
|
13
8
|
"repository": {
|
|
14
9
|
"type": "git",
|
|
15
10
|
"url": "https://github.com/mrzachnugent/react-native-reusables.git",
|
|
16
|
-
"directory": "
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"dist",
|
|
20
|
-
"__generated"
|
|
21
|
-
],
|
|
22
|
-
"keywords": [
|
|
23
|
-
"expo",
|
|
24
|
-
"react-native",
|
|
25
|
-
"universal-components",
|
|
26
|
-
"components",
|
|
27
|
-
"tailwind",
|
|
28
|
-
"nativewind",
|
|
29
|
-
"radix-ui",
|
|
30
|
-
"shadcn"
|
|
31
|
-
],
|
|
32
|
-
"type": "module",
|
|
33
|
-
"exports": "./dist/index.js",
|
|
34
|
-
"bin": "./dist/index.js",
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"@antfu/ni": "^24.3.0",
|
|
37
|
-
"@babel/core": "^7.26.0",
|
|
38
|
-
"@babel/parser": "^7.22.6",
|
|
39
|
-
"@babel/plugin-transform-typescript": "^7.22.5",
|
|
40
|
-
"chalk": "5.2.0",
|
|
41
|
-
"commander": "^10.0.0",
|
|
42
|
-
"cosmiconfig": "^8.1.3",
|
|
43
|
-
"diff": "^5.1.0",
|
|
44
|
-
"execa": "^7.0.0",
|
|
45
|
-
"fast-glob": "^3.3.2",
|
|
46
|
-
"fs-extra": "^11.1.0",
|
|
47
|
-
"https-proxy-agent": "^6.2.0",
|
|
48
|
-
"lodash.template": "^4.5.0",
|
|
49
|
-
"node-fetch": "^3.3.0",
|
|
50
|
-
"ora": "^6.1.2",
|
|
51
|
-
"prompts": "^2.4.2",
|
|
52
|
-
"recast": "^0.23.2",
|
|
53
|
-
"ts-morph": "^18.0.0",
|
|
54
|
-
"tsconfig-paths": "^4.2.0",
|
|
55
|
-
"zod": "^3.20.2"
|
|
56
|
-
},
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"@types/babel__core": "^7.20.1",
|
|
59
|
-
"@types/diff": "^5.0.3",
|
|
60
|
-
"@types/fs-extra": "^11.0.1",
|
|
61
|
-
"@types/lodash.template": "^4.5.1",
|
|
62
|
-
"@types/prompts": "^2.4.2",
|
|
63
|
-
"rimraf": "^4.1.3",
|
|
64
|
-
"tsup": "^6.6.3",
|
|
65
|
-
"tsx": "^4.7.1",
|
|
66
|
-
"type-fest": "^3.8.0",
|
|
67
|
-
"typescript": "^5.8.3",
|
|
68
|
-
"@rnr/reusables": "0.0.0",
|
|
69
|
-
"@rnr/starter-base": "1.0.0"
|
|
11
|
+
"directory": "apps/cli"
|
|
70
12
|
},
|
|
71
|
-
"
|
|
72
|
-
"gen": "rm -rf __generated && tsx scripts/generate-source-files.ts",
|
|
73
|
-
"dev": "pnpm gen && tsup --watch",
|
|
74
|
-
"build": "pnpm gen && tsup",
|
|
75
|
-
"typecheck": "tsc --noEmit",
|
|
76
|
-
"clean": "rm -rf node_modules && rm -rf dist && rm -rf __generated",
|
|
77
|
-
"start:dev": "node dist/index.js",
|
|
78
|
-
"start": "node dist/index.js",
|
|
79
|
-
"format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache",
|
|
80
|
-
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache",
|
|
81
|
-
"release": "changeset version",
|
|
82
|
-
"pub:beta": "pnpm publish --no-git-checks --access public --tag beta",
|
|
83
|
-
"pub:next": "pnpm publish --no-git-checks --access public --tag next",
|
|
84
|
-
"pub:release": "pnpm publish --access public",
|
|
85
|
-
"test": "vitest run"
|
|
86
|
-
}
|
|
13
|
+
"license": "MIT"
|
|
87
14
|
}
|
package/README.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# React Native Reusables CLI
|
|
2
|
-
|
|
3
|
-
> Please follow [the initial setup steps](https://rnr-docs.vercel.app/getting-started/initial-setup/) before using
|
|
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, they will also be added to your project.
|
|
6
|
-
|
|
7
|
-
## How to use
|
|
8
|
-
|
|
9
|
-
Use the following command _(with optional arugments and flags)_:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npx @react-native-reusables/cli@latest add
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Arguments
|
|
16
|
-
|
|
17
|
-
If you do not add arguments, you will be prompted to select the `ui` components you would like to add to your project.
|
|
18
|
-
|
|
19
|
-
#### UI Components
|
|
20
|
-
|
|
21
|
-
- `accordion`
|
|
22
|
-
- `alert`
|
|
23
|
-
- `alert-dialog`
|
|
24
|
-
- `aspect-ratio`
|
|
25
|
-
- `avatar`
|
|
26
|
-
- `badge`
|
|
27
|
-
- `button`
|
|
28
|
-
- `card`
|
|
29
|
-
- `checkbox`
|
|
30
|
-
- `collapsible`
|
|
31
|
-
- `context-menu`
|
|
32
|
-
- `dialog`
|
|
33
|
-
- `dropdown-menu`
|
|
34
|
-
- `hover-card`
|
|
35
|
-
- `input`
|
|
36
|
-
- `label`
|
|
37
|
-
- `menubar`
|
|
38
|
-
- `navigation-menu`
|
|
39
|
-
- `popover`
|
|
40
|
-
- `radio-group`
|
|
41
|
-
- `select`
|
|
42
|
-
- `separator`
|
|
43
|
-
- `skeleton`
|
|
44
|
-
- `switch`
|
|
45
|
-
- `table`
|
|
46
|
-
- `tabs`
|
|
47
|
-
- `text`
|
|
48
|
-
- `textarea`
|
|
49
|
-
- `toggle`
|
|
50
|
-
- `toggle-group`
|
|
51
|
-
- `tooltip`
|
|
52
|
-
- `typography`
|
|
53
|
-
|
|
54
|
-
### Flags
|
|
55
|
-
|
|
56
|
-
- `-o` or `--overwrite`: Overwrite existing files. Default to `false`
|
|
57
|
-
- `-c <cmd>` or `--cwd <cwd>`: The working directory. Defaults to the current directory.
|
|
58
|
-
|
|
59
|
-
```mdx
|
|
60
|
-
This project uses code from shadcn.
|
|
61
|
-
The code is licensed under the MIT License.
|
|
62
|
-
https://github.com/shadcn-ui/ui
|
|
63
|
-
```
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import * as AccordionPrimitive from '@rn-primitives/accordion';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Platform, Pressable, View } from 'react-native';
|
|
4
|
-
import Animated, {
|
|
5
|
-
Extrapolation,
|
|
6
|
-
FadeIn,
|
|
7
|
-
FadeOutUp,
|
|
8
|
-
LayoutAnimationConfig,
|
|
9
|
-
LinearTransition,
|
|
10
|
-
interpolate,
|
|
11
|
-
useAnimatedStyle,
|
|
12
|
-
useDerivedValue,
|
|
13
|
-
withTiming,
|
|
14
|
-
} from 'react-native-reanimated';
|
|
15
|
-
import { ChevronDown } from '../../lib/icons/ChevronDown';
|
|
16
|
-
import { cn } from '../../lib/utils';
|
|
17
|
-
import { TextClassContext } from './text';
|
|
18
|
-
|
|
19
|
-
const Accordion = React.forwardRef<AccordionPrimitive.RootRef, AccordionPrimitive.RootProps>(
|
|
20
|
-
({ children, ...props }, ref) => {
|
|
21
|
-
return (
|
|
22
|
-
<LayoutAnimationConfig skipEntering>
|
|
23
|
-
<AccordionPrimitive.Root ref={ref} {...props} asChild={Platform.OS !== 'web'}>
|
|
24
|
-
<Animated.View layout={LinearTransition.duration(200)}>{children}</Animated.View>
|
|
25
|
-
</AccordionPrimitive.Root>
|
|
26
|
-
</LayoutAnimationConfig>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
Accordion.displayName = AccordionPrimitive.Root.displayName;
|
|
32
|
-
|
|
33
|
-
const AccordionItem = React.forwardRef<AccordionPrimitive.ItemRef, AccordionPrimitive.ItemProps>(
|
|
34
|
-
({ className, value, ...props }, ref) => {
|
|
35
|
-
return (
|
|
36
|
-
<Animated.View className={'overflow-hidden'} layout={LinearTransition.duration(200)}>
|
|
37
|
-
<AccordionPrimitive.Item
|
|
38
|
-
ref={ref}
|
|
39
|
-
className={cn('border-b border-border', className)}
|
|
40
|
-
value={value}
|
|
41
|
-
{...props}
|
|
42
|
-
/>
|
|
43
|
-
</Animated.View>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
AccordionItem.displayName = AccordionPrimitive.Item.displayName;
|
|
48
|
-
|
|
49
|
-
const Trigger = Platform.OS === 'web' ? View : Pressable;
|
|
50
|
-
|
|
51
|
-
const AccordionTrigger = React.forwardRef<
|
|
52
|
-
AccordionPrimitive.TriggerRef,
|
|
53
|
-
AccordionPrimitive.TriggerProps
|
|
54
|
-
>(({ className, children, ...props }, ref) => {
|
|
55
|
-
const { isExpanded } = AccordionPrimitive.useItemContext();
|
|
56
|
-
|
|
57
|
-
const progress = useDerivedValue(() =>
|
|
58
|
-
isExpanded ? withTiming(1, { duration: 250 }) : withTiming(0, { duration: 200 })
|
|
59
|
-
);
|
|
60
|
-
const chevronStyle = useAnimatedStyle(() => ({
|
|
61
|
-
transform: [{ rotate: `${progress.value * 180}deg` }],
|
|
62
|
-
opacity: interpolate(progress.value, [0, 1], [1, 0.8], Extrapolation.CLAMP),
|
|
63
|
-
}));
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<TextClassContext.Provider value='native:text-lg font-medium web:group-hover:underline'>
|
|
67
|
-
<AccordionPrimitive.Header className='flex'>
|
|
68
|
-
<AccordionPrimitive.Trigger ref={ref} {...props} asChild>
|
|
69
|
-
<Trigger
|
|
70
|
-
className={cn(
|
|
71
|
-
'flex flex-row web:flex-1 items-center justify-between py-4 web:transition-all group web:focus-visible:outline-none web:focus-visible:ring-1 web:focus-visible:ring-muted-foreground',
|
|
72
|
-
className
|
|
73
|
-
)}
|
|
74
|
-
>
|
|
75
|
-
<>{children}</>
|
|
76
|
-
<Animated.View style={chevronStyle}>
|
|
77
|
-
<ChevronDown size={18} className={'text-foreground shrink-0'} />
|
|
78
|
-
</Animated.View>
|
|
79
|
-
</Trigger>
|
|
80
|
-
</AccordionPrimitive.Trigger>
|
|
81
|
-
</AccordionPrimitive.Header>
|
|
82
|
-
</TextClassContext.Provider>
|
|
83
|
-
);
|
|
84
|
-
});
|
|
85
|
-
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
86
|
-
|
|
87
|
-
const AccordionContent = React.forwardRef<
|
|
88
|
-
AccordionPrimitive.ContentRef,
|
|
89
|
-
AccordionPrimitive.ContentProps
|
|
90
|
-
>(({ className, children, ...props }, ref) => {
|
|
91
|
-
const { isExpanded } = AccordionPrimitive.useItemContext();
|
|
92
|
-
return (
|
|
93
|
-
<TextClassContext.Provider value='native:text-lg'>
|
|
94
|
-
<AccordionPrimitive.Content
|
|
95
|
-
className={cn(
|
|
96
|
-
'overflow-hidden text-sm web:transition-all',
|
|
97
|
-
isExpanded ? 'web:animate-accordion-down' : 'web:animate-accordion-up'
|
|
98
|
-
)}
|
|
99
|
-
ref={ref}
|
|
100
|
-
{...props}
|
|
101
|
-
>
|
|
102
|
-
<InnerContent className={cn('pb-4', className)}>{children}</InnerContent>
|
|
103
|
-
</AccordionPrimitive.Content>
|
|
104
|
-
</TextClassContext.Provider>
|
|
105
|
-
);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
function InnerContent({ children, className }: { children: React.ReactNode; className?: string }) {
|
|
109
|
-
if (Platform.OS === 'web') {
|
|
110
|
-
return <View className={cn('pb-4', className)}>{children}</View>;
|
|
111
|
-
}
|
|
112
|
-
return (
|
|
113
|
-
<Animated.View
|
|
114
|
-
entering={FadeIn}
|
|
115
|
-
exiting={FadeOutUp.duration(200)}
|
|
116
|
-
className={cn('pb-4', className)}
|
|
117
|
-
>
|
|
118
|
-
{children}
|
|
119
|
-
</Animated.View>
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
124
|
-
|
|
125
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import * as AlertDialogPrimitive from '@rn-primitives/alert-dialog';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Platform, StyleSheet, View, type ViewProps } from 'react-native';
|
|
4
|
-
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
5
|
-
import { buttonTextVariants, buttonVariants } from '../../components/ui/button';
|
|
6
|
-
import { cn } from '../../lib/utils';
|
|
7
|
-
import { TextClassContext } from './text';
|
|
8
|
-
|
|
9
|
-
const AlertDialog = AlertDialogPrimitive.Root;
|
|
10
|
-
|
|
11
|
-
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
12
|
-
|
|
13
|
-
const AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
14
|
-
|
|
15
|
-
const AlertDialogOverlayWeb = React.forwardRef<
|
|
16
|
-
AlertDialogPrimitive.OverlayRef,
|
|
17
|
-
AlertDialogPrimitive.OverlayProps
|
|
18
|
-
>(({ className, ...props }, ref) => {
|
|
19
|
-
const { open } = AlertDialogPrimitive.useRootContext();
|
|
20
|
-
return (
|
|
21
|
-
<AlertDialogPrimitive.Overlay
|
|
22
|
-
className={cn(
|
|
23
|
-
'z-50 bg-black/80 flex justify-center items-center p-2 absolute top-0 right-0 bottom-0 left-0',
|
|
24
|
-
open ? 'web:animate-in web:fade-in-0' : 'web:animate-out web:fade-out-0',
|
|
25
|
-
className
|
|
26
|
-
)}
|
|
27
|
-
{...props}
|
|
28
|
-
ref={ref}
|
|
29
|
-
/>
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
AlertDialogOverlayWeb.displayName = 'AlertDialogOverlayWeb';
|
|
34
|
-
|
|
35
|
-
const AlertDialogOverlayNative = React.forwardRef<
|
|
36
|
-
AlertDialogPrimitive.OverlayRef,
|
|
37
|
-
AlertDialogPrimitive.OverlayProps
|
|
38
|
-
>(({ className, children, ...props }, ref) => {
|
|
39
|
-
return (
|
|
40
|
-
<AlertDialogPrimitive.Overlay
|
|
41
|
-
style={StyleSheet.absoluteFill}
|
|
42
|
-
className={cn('z-50 bg-black/80 flex justify-center items-center p-2', className)}
|
|
43
|
-
{...props}
|
|
44
|
-
ref={ref}
|
|
45
|
-
asChild
|
|
46
|
-
>
|
|
47
|
-
<Animated.View entering={FadeIn.duration(150)} exiting={FadeOut.duration(150)}>
|
|
48
|
-
{children}
|
|
49
|
-
</Animated.View>
|
|
50
|
-
</AlertDialogPrimitive.Overlay>
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
AlertDialogOverlayNative.displayName = 'AlertDialogOverlayNative';
|
|
55
|
-
|
|
56
|
-
const AlertDialogOverlay = Platform.select({
|
|
57
|
-
web: AlertDialogOverlayWeb,
|
|
58
|
-
default: AlertDialogOverlayNative,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const AlertDialogContent = React.forwardRef<
|
|
62
|
-
AlertDialogPrimitive.ContentRef,
|
|
63
|
-
AlertDialogPrimitive.ContentProps & { portalHost?: string }
|
|
64
|
-
>(({ className, portalHost, ...props }, ref) => {
|
|
65
|
-
const { open } = AlertDialogPrimitive.useRootContext();
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<AlertDialogPortal hostName={portalHost}>
|
|
69
|
-
<AlertDialogOverlay>
|
|
70
|
-
<AlertDialogPrimitive.Content
|
|
71
|
-
ref={ref}
|
|
72
|
-
className={cn(
|
|
73
|
-
'z-50 max-w-lg gap-4 border border-border bg-background p-6 shadow-lg shadow-foreground/10 web:duration-200 rounded-lg',
|
|
74
|
-
open
|
|
75
|
-
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
76
|
-
: 'web:animate-out web:fade-out-0 web:zoom-out-95',
|
|
77
|
-
className
|
|
78
|
-
)}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
</AlertDialogOverlay>
|
|
82
|
-
</AlertDialogPortal>
|
|
83
|
-
);
|
|
84
|
-
});
|
|
85
|
-
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
86
|
-
|
|
87
|
-
const AlertDialogHeader = ({ className, ...props }: ViewProps) => (
|
|
88
|
-
<View className={cn('flex flex-col gap-2', className)} {...props} />
|
|
89
|
-
);
|
|
90
|
-
AlertDialogHeader.displayName = 'AlertDialogHeader';
|
|
91
|
-
|
|
92
|
-
const AlertDialogFooter = ({ className, ...props }: ViewProps) => (
|
|
93
|
-
<View
|
|
94
|
-
className={cn('flex flex-col-reverse sm:flex-row sm:justify-end gap-2', className)}
|
|
95
|
-
{...props}
|
|
96
|
-
/>
|
|
97
|
-
);
|
|
98
|
-
AlertDialogFooter.displayName = 'AlertDialogFooter';
|
|
99
|
-
|
|
100
|
-
const AlertDialogTitle = React.forwardRef<
|
|
101
|
-
AlertDialogPrimitive.TitleRef,
|
|
102
|
-
AlertDialogPrimitive.TitleProps
|
|
103
|
-
>(({ className, ...props }, ref) => (
|
|
104
|
-
<AlertDialogPrimitive.Title
|
|
105
|
-
ref={ref}
|
|
106
|
-
className={cn('text-lg native:text-xl text-foreground font-semibold', className)}
|
|
107
|
-
{...props}
|
|
108
|
-
/>
|
|
109
|
-
));
|
|
110
|
-
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
111
|
-
|
|
112
|
-
const AlertDialogDescription = React.forwardRef<
|
|
113
|
-
AlertDialogPrimitive.DescriptionRef,
|
|
114
|
-
AlertDialogPrimitive.DescriptionProps
|
|
115
|
-
>(({ className, ...props }, ref) => (
|
|
116
|
-
<AlertDialogPrimitive.Description
|
|
117
|
-
ref={ref}
|
|
118
|
-
className={cn('text-sm native:text-base text-muted-foreground', className)}
|
|
119
|
-
{...props}
|
|
120
|
-
/>
|
|
121
|
-
));
|
|
122
|
-
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
123
|
-
|
|
124
|
-
const AlertDialogAction = React.forwardRef<
|
|
125
|
-
AlertDialogPrimitive.ActionRef,
|
|
126
|
-
AlertDialogPrimitive.ActionProps
|
|
127
|
-
>(({ className, ...props }, ref) => (
|
|
128
|
-
<TextClassContext.Provider value={buttonTextVariants({ className })}>
|
|
129
|
-
<AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
|
|
130
|
-
</TextClassContext.Provider>
|
|
131
|
-
));
|
|
132
|
-
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
133
|
-
|
|
134
|
-
const AlertDialogCancel = React.forwardRef<
|
|
135
|
-
AlertDialogPrimitive.CancelRef,
|
|
136
|
-
AlertDialogPrimitive.CancelProps
|
|
137
|
-
>(({ className, ...props }, ref) => (
|
|
138
|
-
<TextClassContext.Provider value={buttonTextVariants({ className, variant: 'outline' })}>
|
|
139
|
-
<AlertDialogPrimitive.Cancel
|
|
140
|
-
ref={ref}
|
|
141
|
-
className={cn(buttonVariants({ variant: 'outline', className }))}
|
|
142
|
-
{...props}
|
|
143
|
-
/>
|
|
144
|
-
</TextClassContext.Provider>
|
|
145
|
-
));
|
|
146
|
-
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
147
|
-
|
|
148
|
-
export {
|
|
149
|
-
AlertDialog,
|
|
150
|
-
AlertDialogAction,
|
|
151
|
-
AlertDialogCancel,
|
|
152
|
-
AlertDialogContent,
|
|
153
|
-
AlertDialogDescription,
|
|
154
|
-
AlertDialogFooter,
|
|
155
|
-
AlertDialogHeader,
|
|
156
|
-
AlertDialogOverlay,
|
|
157
|
-
AlertDialogPortal,
|
|
158
|
-
AlertDialogTitle,
|
|
159
|
-
AlertDialogTrigger,
|
|
160
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { useTheme } from '@react-navigation/native';
|
|
2
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import type { LucideIcon } from 'lucide-react-native';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { View, type ViewProps } from 'react-native';
|
|
6
|
-
import { cn } from '../../lib/utils';
|
|
7
|
-
import { Text } from './text';
|
|
8
|
-
|
|
9
|
-
const alertVariants = cva(
|
|
10
|
-
'relative bg-background w-full rounded-lg border border-border p-4 shadow shadow-foreground/10',
|
|
11
|
-
{
|
|
12
|
-
variants: {
|
|
13
|
-
variant: {
|
|
14
|
-
default: '',
|
|
15
|
-
destructive: 'border-destructive',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
defaultVariants: {
|
|
19
|
-
variant: 'default',
|
|
20
|
-
},
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
const Alert = React.forwardRef<
|
|
25
|
-
React.ElementRef<typeof View>,
|
|
26
|
-
ViewProps &
|
|
27
|
-
VariantProps<typeof alertVariants> & {
|
|
28
|
-
icon: LucideIcon;
|
|
29
|
-
iconSize?: number;
|
|
30
|
-
iconClassName?: string;
|
|
31
|
-
}
|
|
32
|
-
>(({ className, variant, children, icon: Icon, iconSize = 16, iconClassName, ...props }, ref) => {
|
|
33
|
-
const { colors } = useTheme();
|
|
34
|
-
return (
|
|
35
|
-
<View ref={ref} role='alert' className={alertVariants({ variant, className })} {...props}>
|
|
36
|
-
<View className='absolute left-3.5 top-4 -translate-y-0.5'>
|
|
37
|
-
<Icon
|
|
38
|
-
size={iconSize}
|
|
39
|
-
color={variant === 'destructive' ? colors.notification : colors.text}
|
|
40
|
-
/>
|
|
41
|
-
</View>
|
|
42
|
-
{children}
|
|
43
|
-
</View>
|
|
44
|
-
);
|
|
45
|
-
});
|
|
46
|
-
Alert.displayName = 'Alert';
|
|
47
|
-
|
|
48
|
-
const AlertTitle = React.forwardRef<
|
|
49
|
-
React.ElementRef<typeof Text>,
|
|
50
|
-
React.ComponentPropsWithoutRef<typeof Text>
|
|
51
|
-
>(({ className, ...props }, ref) => (
|
|
52
|
-
<Text
|
|
53
|
-
ref={ref}
|
|
54
|
-
className={cn(
|
|
55
|
-
'pl-7 mb-1 font-medium text-base leading-none tracking-tight text-foreground',
|
|
56
|
-
className
|
|
57
|
-
)}
|
|
58
|
-
{...props}
|
|
59
|
-
/>
|
|
60
|
-
));
|
|
61
|
-
AlertTitle.displayName = 'AlertTitle';
|
|
62
|
-
|
|
63
|
-
const AlertDescription = React.forwardRef<
|
|
64
|
-
React.ElementRef<typeof Text>,
|
|
65
|
-
React.ComponentPropsWithoutRef<typeof Text>
|
|
66
|
-
>(({ className, ...props }, ref) => (
|
|
67
|
-
<Text
|
|
68
|
-
ref={ref}
|
|
69
|
-
className={cn('pl-7 text-sm leading-relaxed text-foreground', className)}
|
|
70
|
-
{...props}
|
|
71
|
-
/>
|
|
72
|
-
));
|
|
73
|
-
AlertDescription.displayName = 'AlertDescription';
|
|
74
|
-
|
|
75
|
-
export { Alert, AlertDescription, AlertTitle };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as AvatarPrimitive from '@rn-primitives/avatar';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
4
|
-
|
|
5
|
-
const Avatar = React.forwardRef<AvatarPrimitive.RootRef, AvatarPrimitive.RootProps>(
|
|
6
|
-
({ className, ...props }, ref) => (
|
|
7
|
-
<AvatarPrimitive.Root
|
|
8
|
-
ref={ref}
|
|
9
|
-
className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
|
|
10
|
-
{...props}
|
|
11
|
-
/>
|
|
12
|
-
)
|
|
13
|
-
);
|
|
14
|
-
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
15
|
-
|
|
16
|
-
const AvatarImage = React.forwardRef<AvatarPrimitive.ImageRef, AvatarPrimitive.ImageProps>(
|
|
17
|
-
({ className, ...props }, ref) => (
|
|
18
|
-
<AvatarPrimitive.Image
|
|
19
|
-
ref={ref}
|
|
20
|
-
className={cn('aspect-square h-full w-full', className)}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
)
|
|
24
|
-
);
|
|
25
|
-
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
26
|
-
|
|
27
|
-
const AvatarFallback = React.forwardRef<AvatarPrimitive.FallbackRef, AvatarPrimitive.FallbackProps>(
|
|
28
|
-
({ className, ...props }, ref) => (
|
|
29
|
-
<AvatarPrimitive.Fallback
|
|
30
|
-
ref={ref}
|
|
31
|
-
className={cn(
|
|
32
|
-
'flex h-full w-full items-center justify-center rounded-full bg-muted',
|
|
33
|
-
className
|
|
34
|
-
)}
|
|
35
|
-
{...props}
|
|
36
|
-
/>
|
|
37
|
-
)
|
|
38
|
-
);
|
|
39
|
-
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
40
|
-
|
|
41
|
-
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import * as Slot from '@rn-primitives/slot';
|
|
2
|
-
import type { SlottableViewProps } from '@rn-primitives/types';
|
|
3
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
-
import { View } from 'react-native';
|
|
5
|
-
import { cn } from '../../lib/utils';
|
|
6
|
-
import { TextClassContext } from './text';
|
|
7
|
-
|
|
8
|
-
const badgeVariants = cva(
|
|
9
|
-
'web:inline-flex items-center rounded-full border border-border px-2.5 py-0.5 web:transition-colors web:focus:outline-none web:focus:ring-2 web:focus:ring-ring web:focus:ring-offset-2',
|
|
10
|
-
{
|
|
11
|
-
variants: {
|
|
12
|
-
variant: {
|
|
13
|
-
default: 'border-transparent bg-primary web:hover:opacity-80 active:opacity-80',
|
|
14
|
-
secondary: 'border-transparent bg-secondary web:hover:opacity-80 active:opacity-80',
|
|
15
|
-
destructive: 'border-transparent bg-destructive web:hover:opacity-80 active:opacity-80',
|
|
16
|
-
outline: 'text-foreground',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
defaultVariants: {
|
|
20
|
-
variant: 'default',
|
|
21
|
-
},
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const badgeTextVariants = cva('text-xs font-semibold ', {
|
|
26
|
-
variants: {
|
|
27
|
-
variant: {
|
|
28
|
-
default: 'text-primary-foreground',
|
|
29
|
-
secondary: 'text-secondary-foreground',
|
|
30
|
-
destructive: 'text-destructive-foreground',
|
|
31
|
-
outline: 'text-foreground',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
defaultVariants: {
|
|
35
|
-
variant: 'default',
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
type BadgeProps = SlottableViewProps & VariantProps<typeof badgeVariants>;
|
|
40
|
-
|
|
41
|
-
function Badge({ className, variant, asChild, ...props }: BadgeProps) {
|
|
42
|
-
const Component = asChild ? Slot.View : View;
|
|
43
|
-
return (
|
|
44
|
-
<TextClassContext.Provider value={badgeTextVariants({ variant })}>
|
|
45
|
-
<Component className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
46
|
-
</TextClassContext.Provider>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export { Badge, badgeTextVariants, badgeVariants };
|
|
51
|
-
export type { BadgeProps };
|