@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.
- 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 -134
- package/__generated/components/ui/alert-dialog.tsx +0 -172
- package/__generated/components/ui/alert.tsx +0 -71
- package/__generated/components/ui/aspect-ratio.tsx +0 -5
- package/__generated/components/ui/avatar.tsx +0 -47
- package/__generated/components/ui/badge.tsx +0 -52
- package/__generated/components/ui/button.tsx +0 -81
- package/__generated/components/ui/card.tsx +0 -82
- package/__generated/components/ui/checkbox.tsx +0 -33
- package/__generated/components/ui/collapsible.tsx +0 -9
- package/__generated/components/ui/context-menu.tsx +0 -264
- package/__generated/components/ui/dialog.tsx +0 -159
- package/__generated/components/ui/dropdown-menu.tsx +0 -274
- package/__generated/components/ui/hover-card.tsx +0 -47
- package/__generated/components/ui/input.tsx +0 -25
- package/__generated/components/ui/label.tsx +0 -34
- package/__generated/components/ui/menubar.tsx +0 -284
- package/__generated/components/ui/navigation-menu.tsx +0 -191
- package/__generated/components/ui/popover.tsx +0 -42
- package/__generated/components/ui/progress.tsx +0 -62
- package/__generated/components/ui/radio-group.tsx +0 -36
- package/__generated/components/ui/select.tsx +0 -191
- package/__generated/components/ui/separator.tsx +0 -27
- package/__generated/components/ui/skeleton.tsx +0 -39
- package/__generated/components/ui/switch.tsx +0 -98
- package/__generated/components/ui/table.tsx +0 -108
- package/__generated/components/ui/tabs.tsx +0 -69
- package/__generated/components/ui/text.tsx +0 -26
- package/__generated/components/ui/textarea.tsx +0 -30
- package/__generated/components/ui/toggle-group.tsx +0 -94
- package/__generated/components/ui/toggle.tsx +0 -90
- package/__generated/components/ui/tooltip.tsx +0 -43
- package/__generated/components/ui/typography.tsx +0 -148
- 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 -71
- 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 -30
- package/__generated/starter-base/components/ui/avatar.tsx +0 -47
- package/__generated/starter-base/components/ui/button.tsx +0 -81
- package/__generated/starter-base/components/ui/card.tsx +0 -82
- package/__generated/starter-base/components/ui/progress.tsx +0 -62
- package/__generated/starter-base/components/ui/text.tsx +0 -26
- package/__generated/starter-base/components/ui/tooltip.tsx +0 -44
- 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 -51
- 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
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import * as TablePrimitive from '@rn-primitives/table';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
4
|
-
import { TextClassContext } from './text';
|
|
5
|
-
|
|
6
|
-
function Table({
|
|
7
|
-
className,
|
|
8
|
-
...props
|
|
9
|
-
}: TablePrimitive.RootProps & {
|
|
10
|
-
ref?: React.RefObject<TablePrimitive.RootRef>;
|
|
11
|
-
}) {
|
|
12
|
-
return (
|
|
13
|
-
<TablePrimitive.Root className={cn('w-full caption-bottom text-sm', className)} {...props} />
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function TableHeader({
|
|
18
|
-
className,
|
|
19
|
-
...props
|
|
20
|
-
}: TablePrimitive.HeaderProps & {
|
|
21
|
-
ref?: React.RefObject<TablePrimitive.HeaderRef>;
|
|
22
|
-
}) {
|
|
23
|
-
return (
|
|
24
|
-
<TablePrimitive.Header className={cn('border-border [&_tr]:border-b', className)} {...props} />
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function TableBody({
|
|
29
|
-
className,
|
|
30
|
-
style,
|
|
31
|
-
...props
|
|
32
|
-
}: TablePrimitive.BodyProps & {
|
|
33
|
-
ref?: React.RefObject<TablePrimitive.BodyRef>;
|
|
34
|
-
}) {
|
|
35
|
-
return (
|
|
36
|
-
<TablePrimitive.Body
|
|
37
|
-
className={cn('flex-1 border-border [&_tr:last-child]:border-0', className)}
|
|
38
|
-
style={[{ minHeight: 2 }, style]}
|
|
39
|
-
{...props}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function TableFooter({
|
|
45
|
-
className,
|
|
46
|
-
...props
|
|
47
|
-
}: TablePrimitive.FooterProps & {
|
|
48
|
-
ref?: React.RefObject<TablePrimitive.FooterRef>;
|
|
49
|
-
}) {
|
|
50
|
-
return (
|
|
51
|
-
<TablePrimitive.Footer
|
|
52
|
-
className={cn('bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}
|
|
53
|
-
{...props}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function TableRow({
|
|
59
|
-
className,
|
|
60
|
-
...props
|
|
61
|
-
}: TablePrimitive.RowProps & {
|
|
62
|
-
ref?: React.RefObject<TablePrimitive.RowRef>;
|
|
63
|
-
}) {
|
|
64
|
-
return (
|
|
65
|
-
<TablePrimitive.Row
|
|
66
|
-
className={cn(
|
|
67
|
-
'flex-row border-border border-b web:transition-colors web:hover:bg-muted/50 web:data-[state=selected]:bg-muted',
|
|
68
|
-
className
|
|
69
|
-
)}
|
|
70
|
-
{...props}
|
|
71
|
-
/>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function TableHead({
|
|
76
|
-
className,
|
|
77
|
-
...props
|
|
78
|
-
}: TablePrimitive.HeadProps & {
|
|
79
|
-
ref?: React.RefObject<TablePrimitive.HeadRef>;
|
|
80
|
-
}) {
|
|
81
|
-
return (
|
|
82
|
-
<TextClassContext.Provider value='text-muted-foreground'>
|
|
83
|
-
<TablePrimitive.Head
|
|
84
|
-
className={cn(
|
|
85
|
-
'h-12 px-4 text-left justify-center font-medium [&:has([role=checkbox])]:pr-0',
|
|
86
|
-
className
|
|
87
|
-
)}
|
|
88
|
-
{...props}
|
|
89
|
-
/>
|
|
90
|
-
</TextClassContext.Provider>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function TableCell({
|
|
95
|
-
className,
|
|
96
|
-
...props
|
|
97
|
-
}: TablePrimitive.CellProps & {
|
|
98
|
-
ref?: React.RefObject<TablePrimitive.CellRef>;
|
|
99
|
-
}) {
|
|
100
|
-
return (
|
|
101
|
-
<TablePrimitive.Cell
|
|
102
|
-
className={cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export { Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import * as TabsPrimitive from '@rn-primitives/tabs';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
4
|
-
import { TextClassContext } from './text';
|
|
5
|
-
|
|
6
|
-
const Tabs = TabsPrimitive.Root;
|
|
7
|
-
|
|
8
|
-
function TabsList({
|
|
9
|
-
className,
|
|
10
|
-
...props
|
|
11
|
-
}: TabsPrimitive.ListProps & {
|
|
12
|
-
ref?: React.RefObject<TabsPrimitive.ListRef>;
|
|
13
|
-
}) {
|
|
14
|
-
return (
|
|
15
|
-
<TabsPrimitive.List
|
|
16
|
-
className={cn(
|
|
17
|
-
'web:inline-flex h-10 native:h-12 items-center justify-center rounded-md bg-muted p-1 native:px-1.5',
|
|
18
|
-
className
|
|
19
|
-
)}
|
|
20
|
-
{...props}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function TabsTrigger({
|
|
26
|
-
className,
|
|
27
|
-
...props
|
|
28
|
-
}: TabsPrimitive.TriggerProps & {
|
|
29
|
-
ref?: React.RefObject<TabsPrimitive.TriggerRef>;
|
|
30
|
-
}) {
|
|
31
|
-
const { value } = TabsPrimitive.useRootContext();
|
|
32
|
-
return (
|
|
33
|
-
<TextClassContext.Provider
|
|
34
|
-
value={cn(
|
|
35
|
-
'text-sm native:text-base font-medium text-muted-foreground web:transition-all',
|
|
36
|
-
value === props.value && 'text-foreground'
|
|
37
|
-
)}
|
|
38
|
-
>
|
|
39
|
-
<TabsPrimitive.Trigger
|
|
40
|
-
className={cn(
|
|
41
|
-
'inline-flex items-center justify-center shadow-none web:whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium web:ring-offset-background web:transition-all web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
|
|
42
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
43
|
-
props.value === value && 'bg-background shadow-lg shadow-foreground/10',
|
|
44
|
-
className
|
|
45
|
-
)}
|
|
46
|
-
{...props}
|
|
47
|
-
/>
|
|
48
|
-
</TextClassContext.Provider>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function TabsContent({
|
|
53
|
-
className,
|
|
54
|
-
...props
|
|
55
|
-
}: TabsPrimitive.ContentProps & {
|
|
56
|
-
ref?: React.RefObject<TabsPrimitive.ContentRef>;
|
|
57
|
-
}) {
|
|
58
|
-
return (
|
|
59
|
-
<TabsPrimitive.Content
|
|
60
|
-
className={cn(
|
|
61
|
-
'web:ring-offset-background web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
|
|
62
|
-
className
|
|
63
|
-
)}
|
|
64
|
-
{...props}
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as Slot from '@rn-primitives/slot';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Text as RNText } from 'react-native';
|
|
4
|
-
import { cn } from '../../lib/utils';
|
|
5
|
-
|
|
6
|
-
const TextClassContext = React.createContext<string | undefined>(undefined);
|
|
7
|
-
|
|
8
|
-
function Text({
|
|
9
|
-
className,
|
|
10
|
-
asChild = false,
|
|
11
|
-
...props
|
|
12
|
-
}: React.ComponentProps<typeof RNText> & {
|
|
13
|
-
ref?: React.RefObject<RNText>;
|
|
14
|
-
asChild?: boolean;
|
|
15
|
-
}) {
|
|
16
|
-
const textClass = React.useContext(TextClassContext);
|
|
17
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
18
|
-
return (
|
|
19
|
-
<Component
|
|
20
|
-
className={cn('text-base text-foreground web:select-text', textClass, className)}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { Text, TextClassContext };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { TextInput, type TextInputProps } from 'react-native';
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
4
|
-
|
|
5
|
-
function Textarea({
|
|
6
|
-
className,
|
|
7
|
-
multiline = true,
|
|
8
|
-
numberOfLines = 4,
|
|
9
|
-
placeholderClassName,
|
|
10
|
-
...props
|
|
11
|
-
}: TextInputProps & {
|
|
12
|
-
ref?: React.RefObject<TextInput>;
|
|
13
|
-
}) {
|
|
14
|
-
return (
|
|
15
|
-
<TextInput
|
|
16
|
-
className={cn(
|
|
17
|
-
'web:flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base lg:text-sm native:text-lg native:leading-[1.25] text-foreground web:ring-offset-background placeholder:text-muted-foreground web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
|
|
18
|
-
props.editable === false && 'opacity-50 web:cursor-not-allowed',
|
|
19
|
-
className
|
|
20
|
-
)}
|
|
21
|
-
placeholderClassName={cn('text-muted-foreground', placeholderClassName)}
|
|
22
|
-
multiline={multiline}
|
|
23
|
-
numberOfLines={numberOfLines}
|
|
24
|
-
textAlignVertical='top'
|
|
25
|
-
{...props}
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { Textarea };
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import type { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import type { LucideIcon } from 'lucide-react-native';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { toggleTextVariants, toggleVariants } from '../../components/ui/toggle';
|
|
5
|
-
import { TextClassContext } from './text';
|
|
6
|
-
import * as ToggleGroupPrimitive from '@rn-primitives/toggle-group';
|
|
7
|
-
import { cn } from '../../lib/utils';
|
|
8
|
-
|
|
9
|
-
const ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariants> | null>(null);
|
|
10
|
-
|
|
11
|
-
function ToggleGroup({
|
|
12
|
-
className,
|
|
13
|
-
variant,
|
|
14
|
-
size,
|
|
15
|
-
children,
|
|
16
|
-
...props
|
|
17
|
-
}: ToggleGroupPrimitive.RootProps &
|
|
18
|
-
VariantProps<typeof toggleVariants> & {
|
|
19
|
-
ref?: React.RefObject<ToggleGroupPrimitive.RootRef>;
|
|
20
|
-
}) {
|
|
21
|
-
return (
|
|
22
|
-
<ToggleGroupPrimitive.Root
|
|
23
|
-
className={cn('flex flex-row items-center justify-center gap-1', className)}
|
|
24
|
-
{...props}
|
|
25
|
-
>
|
|
26
|
-
<ToggleGroupContext.Provider value={{ variant, size }}>
|
|
27
|
-
{children}
|
|
28
|
-
</ToggleGroupContext.Provider>
|
|
29
|
-
</ToggleGroupPrimitive.Root>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function useToggleGroupContext() {
|
|
34
|
-
const context = React.useContext(ToggleGroupContext);
|
|
35
|
-
if (context === null) {
|
|
36
|
-
throw new Error(
|
|
37
|
-
'ToggleGroup compound components cannot be rendered outside the ToggleGroup component'
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
return context;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function ToggleGroupItem({
|
|
44
|
-
className,
|
|
45
|
-
children,
|
|
46
|
-
variant,
|
|
47
|
-
size,
|
|
48
|
-
...props
|
|
49
|
-
}: ToggleGroupPrimitive.ItemProps &
|
|
50
|
-
VariantProps<typeof toggleVariants> & {
|
|
51
|
-
ref?: React.RefObject<ToggleGroupPrimitive.ItemRef>;
|
|
52
|
-
}) {
|
|
53
|
-
const context = useToggleGroupContext();
|
|
54
|
-
const { value } = ToggleGroupPrimitive.useRootContext();
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<TextClassContext.Provider
|
|
58
|
-
value={cn(
|
|
59
|
-
toggleTextVariants({ variant, size }),
|
|
60
|
-
ToggleGroupPrimitive.utils.getIsSelected(value, props.value)
|
|
61
|
-
? 'text-accent-foreground'
|
|
62
|
-
: 'web:group-hover:text-muted-foreground'
|
|
63
|
-
)}
|
|
64
|
-
>
|
|
65
|
-
<ToggleGroupPrimitive.Item
|
|
66
|
-
className={cn(
|
|
67
|
-
toggleVariants({
|
|
68
|
-
variant: context.variant || variant,
|
|
69
|
-
size: context.size || size,
|
|
70
|
-
}),
|
|
71
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
72
|
-
ToggleGroupPrimitive.utils.getIsSelected(value, props.value) && 'bg-accent',
|
|
73
|
-
className
|
|
74
|
-
)}
|
|
75
|
-
{...props}
|
|
76
|
-
>
|
|
77
|
-
{children}
|
|
78
|
-
</ToggleGroupPrimitive.Item>
|
|
79
|
-
</TextClassContext.Provider>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function ToggleGroupIcon({
|
|
84
|
-
className,
|
|
85
|
-
icon: Icon,
|
|
86
|
-
...props
|
|
87
|
-
}: React.ComponentPropsWithoutRef<LucideIcon> & {
|
|
88
|
-
icon: LucideIcon;
|
|
89
|
-
}) {
|
|
90
|
-
const textClass = React.useContext(TextClassContext);
|
|
91
|
-
return <Icon className={cn(textClass, className)} {...props} />;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export { ToggleGroup, ToggleGroupIcon, ToggleGroupItem };
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import * as TogglePrimitive from '@rn-primitives/toggle';
|
|
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 { cn } from '../../lib/utils';
|
|
6
|
-
import { TextClassContext } from './text';
|
|
7
|
-
|
|
8
|
-
const toggleVariants = cva(
|
|
9
|
-
'web:group web:inline-flex items-center justify-center rounded-md web:ring-offset-background web:transition-colors web:hover:bg-muted active:bg-muted web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
|
|
10
|
-
{
|
|
11
|
-
variants: {
|
|
12
|
-
variant: {
|
|
13
|
-
default: 'bg-transparent',
|
|
14
|
-
outline:
|
|
15
|
-
'border border-input bg-transparent web:hover:bg-accent active:bg-accent active:bg-accent',
|
|
16
|
-
},
|
|
17
|
-
size: {
|
|
18
|
-
default: 'h-10 px-3 native:h-12 native:px-[12]',
|
|
19
|
-
sm: 'h-9 px-2.5 native:h-10 native:px-[9]',
|
|
20
|
-
lg: 'h-11 px-5 native:h-14 native:px-6',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
defaultVariants: {
|
|
24
|
-
variant: 'default',
|
|
25
|
-
size: 'default',
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
const toggleTextVariants = cva('text-sm native:text-base text-foreground font-medium', {
|
|
31
|
-
variants: {
|
|
32
|
-
variant: {
|
|
33
|
-
default: '',
|
|
34
|
-
outline: 'web:group-hover:text-accent-foreground web:group-active:text-accent-foreground',
|
|
35
|
-
},
|
|
36
|
-
size: {
|
|
37
|
-
default: '',
|
|
38
|
-
sm: '',
|
|
39
|
-
lg: '',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
defaultVariants: {
|
|
43
|
-
variant: 'default',
|
|
44
|
-
size: 'default',
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
function Toggle({
|
|
49
|
-
className,
|
|
50
|
-
variant,
|
|
51
|
-
size,
|
|
52
|
-
...props
|
|
53
|
-
}: TogglePrimitive.RootProps &
|
|
54
|
-
VariantProps<typeof toggleVariants> &
|
|
55
|
-
VariantProps<typeof toggleVariants> & {
|
|
56
|
-
ref?: React.RefObject<TogglePrimitive.RootRef>;
|
|
57
|
-
}) {
|
|
58
|
-
return (
|
|
59
|
-
<TextClassContext.Provider
|
|
60
|
-
value={cn(
|
|
61
|
-
toggleTextVariants({ variant, size }),
|
|
62
|
-
props.pressed ? 'text-accent-foreground' : 'web:group-hover:text-muted-foreground',
|
|
63
|
-
className
|
|
64
|
-
)}
|
|
65
|
-
>
|
|
66
|
-
<TogglePrimitive.Root
|
|
67
|
-
className={cn(
|
|
68
|
-
toggleVariants({ variant, size }),
|
|
69
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
70
|
-
props.pressed && 'bg-accent',
|
|
71
|
-
className
|
|
72
|
-
)}
|
|
73
|
-
{...props}
|
|
74
|
-
/>
|
|
75
|
-
</TextClassContext.Provider>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function ToggleIcon({
|
|
80
|
-
className,
|
|
81
|
-
icon: Icon,
|
|
82
|
-
...props
|
|
83
|
-
}: React.ComponentPropsWithoutRef<LucideIcon> & {
|
|
84
|
-
icon: LucideIcon;
|
|
85
|
-
}) {
|
|
86
|
-
const textClass = React.useContext(TextClassContext);
|
|
87
|
-
return <Icon className={cn(textClass, className)} {...props} />;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export { Toggle, ToggleIcon, toggleTextVariants, toggleVariants };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as TooltipPrimitive from '@rn-primitives/tooltip';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Platform, StyleSheet } from 'react-native';
|
|
4
|
-
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
5
|
-
import { cn } from '../../lib/utils';
|
|
6
|
-
import { TextClassContext } from './text';
|
|
7
|
-
|
|
8
|
-
const Tooltip = TooltipPrimitive.Root;
|
|
9
|
-
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
10
|
-
|
|
11
|
-
function TooltipContent({
|
|
12
|
-
className,
|
|
13
|
-
sideOffset = 4,
|
|
14
|
-
portalHost,
|
|
15
|
-
...props
|
|
16
|
-
}: TooltipPrimitive.ContentProps & {
|
|
17
|
-
ref?: React.RefObject<TooltipPrimitive.ContentRef>;
|
|
18
|
-
portalHost?: string;
|
|
19
|
-
}) {
|
|
20
|
-
return (
|
|
21
|
-
<TooltipPrimitive.Portal hostName={portalHost}>
|
|
22
|
-
<TooltipPrimitive.Overlay style={Platform.OS !== 'web' ? StyleSheet.absoluteFill : undefined}>
|
|
23
|
-
<Animated.View
|
|
24
|
-
entering={Platform.select({ web: undefined, default: FadeIn })}
|
|
25
|
-
exiting={Platform.select({ web: undefined, default: FadeOut })}
|
|
26
|
-
>
|
|
27
|
-
<TextClassContext.Provider value='text-sm native:text-base text-popover-foreground'>
|
|
28
|
-
<TooltipPrimitive.Content
|
|
29
|
-
sideOffset={sideOffset}
|
|
30
|
-
className={cn(
|
|
31
|
-
'z-50 overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 shadow-md shadow-foreground/5 web:animate-in web:fade-in-0 web:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
32
|
-
className
|
|
33
|
-
)}
|
|
34
|
-
{...props}
|
|
35
|
-
/>
|
|
36
|
-
</TextClassContext.Provider>
|
|
37
|
-
</Animated.View>
|
|
38
|
-
</TooltipPrimitive.Overlay>
|
|
39
|
-
</TooltipPrimitive.Portal>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { Tooltip, TooltipContent, TooltipTrigger };
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import * as Slot from '@rn-primitives/slot';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Platform, Text as RNText } from 'react-native';
|
|
4
|
-
import { cn } from '../../lib/utils';
|
|
5
|
-
|
|
6
|
-
type TypographyProps = React.ComponentProps<typeof RNText> & {
|
|
7
|
-
ref?: React.RefObject<RNText>;
|
|
8
|
-
asChild?: boolean;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
function H1({ className, asChild = false, ...props }: TypographyProps) {
|
|
12
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
13
|
-
return (
|
|
14
|
-
<Component
|
|
15
|
-
role='heading'
|
|
16
|
-
aria-level='1'
|
|
17
|
-
className={cn(
|
|
18
|
-
'web:scroll-m-20 text-4xl text-foreground font-extrabold tracking-tight lg:text-5xl web:select-text',
|
|
19
|
-
className
|
|
20
|
-
)}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function H2({ className, asChild = false, ...props }: TypographyProps) {
|
|
27
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
28
|
-
return (
|
|
29
|
-
<Component
|
|
30
|
-
role='heading'
|
|
31
|
-
aria-level='2'
|
|
32
|
-
className={cn(
|
|
33
|
-
'web:scroll-m-20 border-b border-border pb-2 text-3xl text-foreground font-semibold tracking-tight first:mt-0 web:select-text',
|
|
34
|
-
className
|
|
35
|
-
)}
|
|
36
|
-
{...props}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function H3({ className, asChild = false, ...props }: TypographyProps) {
|
|
42
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
43
|
-
return (
|
|
44
|
-
<Component
|
|
45
|
-
role='heading'
|
|
46
|
-
aria-level='3'
|
|
47
|
-
className={cn(
|
|
48
|
-
'web:scroll-m-20 text-2xl text-foreground font-semibold tracking-tight web:select-text',
|
|
49
|
-
className
|
|
50
|
-
)}
|
|
51
|
-
{...props}
|
|
52
|
-
/>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function H4({ className, asChild = false, ...props }: TypographyProps) {
|
|
57
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
58
|
-
return (
|
|
59
|
-
<Component
|
|
60
|
-
role='heading'
|
|
61
|
-
aria-level='4'
|
|
62
|
-
className={cn(
|
|
63
|
-
'web:scroll-m-20 text-xl text-foreground font-semibold tracking-tight web:select-text',
|
|
64
|
-
className
|
|
65
|
-
)}
|
|
66
|
-
{...props}
|
|
67
|
-
/>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function P({ className, asChild = false, ...props }: TypographyProps) {
|
|
72
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
73
|
-
return (
|
|
74
|
-
<Component className={cn('text-base text-foreground web:select-text', className)} {...props} />
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function BlockQuote({ className, asChild = false, ...props }: TypographyProps) {
|
|
79
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
80
|
-
return (
|
|
81
|
-
<Component
|
|
82
|
-
// @ts-ignore - role of blockquote renders blockquote element on the web
|
|
83
|
-
role={Platform.OS === 'web' ? 'blockquote' : undefined}
|
|
84
|
-
className={cn(
|
|
85
|
-
'mt-6 native:mt-4 border-l-2 border-border pl-6 native:pl-3 text-base text-foreground italic web:select-text',
|
|
86
|
-
className
|
|
87
|
-
)}
|
|
88
|
-
{...props}
|
|
89
|
-
/>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function Code({ className, asChild = false, ...props }: TypographyProps) {
|
|
94
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
95
|
-
return (
|
|
96
|
-
<Component
|
|
97
|
-
// @ts-ignore - role of code renders code element on the web
|
|
98
|
-
role={Platform.OS === 'web' ? 'code' : undefined}
|
|
99
|
-
className={cn(
|
|
100
|
-
'relative rounded-md bg-muted px-[0.3rem] py-[0.2rem] text-sm text-foreground font-semibold web:select-text',
|
|
101
|
-
className
|
|
102
|
-
)}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function Lead({ className, asChild = false, ...props }: TypographyProps) {
|
|
109
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
110
|
-
return (
|
|
111
|
-
<Component
|
|
112
|
-
className={cn('text-xl text-muted-foreground web:select-text', className)}
|
|
113
|
-
{...props}
|
|
114
|
-
/>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function Large({ className, asChild = false, ...props }: TypographyProps) {
|
|
119
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
120
|
-
return (
|
|
121
|
-
<Component
|
|
122
|
-
className={cn('text-xl text-foreground font-semibold web:select-text', className)}
|
|
123
|
-
{...props}
|
|
124
|
-
/>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function Small({ className, asChild = false, ...props }: TypographyProps) {
|
|
129
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
130
|
-
return (
|
|
131
|
-
<Component
|
|
132
|
-
className={cn('text-sm text-foreground font-medium leading-none web:select-text', className)}
|
|
133
|
-
{...props}
|
|
134
|
-
/>
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function Muted({ className, asChild = false, ...props }: TypographyProps) {
|
|
139
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
140
|
-
return (
|
|
141
|
-
<Component
|
|
142
|
-
className={cn('text-sm text-muted-foreground web:select-text', className)}
|
|
143
|
-
{...props}
|
|
144
|
-
/>
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export { BlockQuote, Code, H1, H2, H3, H4, Large, Lead, Muted, P, Small };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Starter base
|
|
2
|
-
|
|
3
|
-
A starting point to help you set up your project quickly and use the common components provided by `react-native-reusables`. The idea is to make it easier for you to get started.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- NativeWind v4
|
|
8
|
-
- Dark and light mode
|
|
9
|
-
- Android Navigation Bar matches mode
|
|
10
|
-
- Persistent mode
|
|
11
|
-
- Common components
|
|
12
|
-
- ThemeToggle, Avatar, Button, Card, Progress, Text, Tooltip
|
|
13
|
-
|
|
14
|
-
<img src="https://github.com/mrzachnugent/react-native-reusables/assets/63797719/42c94108-38a7-498b-9c70-18640420f1bc"
|
|
15
|
-
alt="starter-base-template"
|
|
16
|
-
style="width:270px;" />
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Link, Stack } from 'expo-router';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { Text } from '~/components/ui/text';
|
|
4
|
-
|
|
5
|
-
export default function NotFoundScreen() {
|
|
6
|
-
return (
|
|
7
|
-
<>
|
|
8
|
-
<Stack.Screen options={{ title: 'Oops!' }} />
|
|
9
|
-
<View>
|
|
10
|
-
<Text>This screen doesn't exist.</Text>
|
|
11
|
-
|
|
12
|
-
<Link href='/'>
|
|
13
|
-
<Text>Go to home screen!</Text>
|
|
14
|
-
</Link>
|
|
15
|
-
</View>
|
|
16
|
-
</>
|
|
17
|
-
);
|
|
18
|
-
}
|