@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
|
@@ -1,92 +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
|
-
const Table = React.forwardRef<TablePrimitive.RootRef, TablePrimitive.RootProps>(
|
|
7
|
-
({ className, ...props }, ref) => (
|
|
8
|
-
<TablePrimitive.Root
|
|
9
|
-
ref={ref}
|
|
10
|
-
className={cn('w-full caption-bottom text-sm', className)}
|
|
11
|
-
{...props}
|
|
12
|
-
/>
|
|
13
|
-
)
|
|
14
|
-
);
|
|
15
|
-
Table.displayName = 'Table';
|
|
16
|
-
|
|
17
|
-
const TableHeader = React.forwardRef<TablePrimitive.HeaderRef, TablePrimitive.HeaderProps>(
|
|
18
|
-
({ className, ...props }, ref) => (
|
|
19
|
-
<TablePrimitive.Header
|
|
20
|
-
ref={ref}
|
|
21
|
-
className={cn('border-border [&_tr]:border-b', className)}
|
|
22
|
-
{...props}
|
|
23
|
-
/>
|
|
24
|
-
)
|
|
25
|
-
);
|
|
26
|
-
TableHeader.displayName = 'TableHeader';
|
|
27
|
-
|
|
28
|
-
const TableBody = React.forwardRef<TablePrimitive.BodyRef, TablePrimitive.BodyProps>(
|
|
29
|
-
({ className, style, ...props }, ref) => (
|
|
30
|
-
<TablePrimitive.Body
|
|
31
|
-
ref={ref}
|
|
32
|
-
className={cn('flex-1 border-border [&_tr:last-child]:border-0', className)}
|
|
33
|
-
style={[{ minHeight: 2 }, style]}
|
|
34
|
-
{...props}
|
|
35
|
-
/>
|
|
36
|
-
)
|
|
37
|
-
);
|
|
38
|
-
TableBody.displayName = 'TableBody';
|
|
39
|
-
|
|
40
|
-
const TableFooter = React.forwardRef<TablePrimitive.FooterRef, TablePrimitive.FooterProps>(
|
|
41
|
-
({ className, ...props }, ref) => (
|
|
42
|
-
<TablePrimitive.Footer
|
|
43
|
-
ref={ref}
|
|
44
|
-
className={cn('bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}
|
|
45
|
-
{...props}
|
|
46
|
-
/>
|
|
47
|
-
)
|
|
48
|
-
);
|
|
49
|
-
TableFooter.displayName = 'TableFooter';
|
|
50
|
-
|
|
51
|
-
const TableRow = React.forwardRef<TablePrimitive.RowRef, TablePrimitive.RowProps>(
|
|
52
|
-
({ className, ...props }, ref) => (
|
|
53
|
-
<TablePrimitive.Row
|
|
54
|
-
ref={ref}
|
|
55
|
-
className={cn(
|
|
56
|
-
'flex-row border-border border-b web:transition-colors web:hover:bg-muted/50 web:data-[state=selected]:bg-muted',
|
|
57
|
-
className
|
|
58
|
-
)}
|
|
59
|
-
{...props}
|
|
60
|
-
/>
|
|
61
|
-
)
|
|
62
|
-
);
|
|
63
|
-
TableRow.displayName = 'TableRow';
|
|
64
|
-
|
|
65
|
-
const TableHead = React.forwardRef<TablePrimitive.HeadRef, TablePrimitive.HeadProps>(
|
|
66
|
-
({ className, ...props }, ref) => (
|
|
67
|
-
<TextClassContext.Provider value='text-muted-foreground'>
|
|
68
|
-
<TablePrimitive.Head
|
|
69
|
-
ref={ref}
|
|
70
|
-
className={cn(
|
|
71
|
-
'h-12 px-4 text-left justify-center font-medium [&:has([role=checkbox])]:pr-0',
|
|
72
|
-
className
|
|
73
|
-
)}
|
|
74
|
-
{...props}
|
|
75
|
-
/>
|
|
76
|
-
</TextClassContext.Provider>
|
|
77
|
-
)
|
|
78
|
-
);
|
|
79
|
-
TableHead.displayName = 'TableHead';
|
|
80
|
-
|
|
81
|
-
const TableCell = React.forwardRef<TablePrimitive.CellRef, TablePrimitive.CellProps>(
|
|
82
|
-
({ className, ...props }, ref) => (
|
|
83
|
-
<TablePrimitive.Cell
|
|
84
|
-
ref={ref}
|
|
85
|
-
className={cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)}
|
|
86
|
-
{...props}
|
|
87
|
-
/>
|
|
88
|
-
)
|
|
89
|
-
);
|
|
90
|
-
TableCell.displayName = 'TableCell';
|
|
91
|
-
|
|
92
|
-
export { Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -1,62 +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
|
-
const TabsList = React.forwardRef<TabsPrimitive.ListRef, TabsPrimitive.ListProps>(
|
|
9
|
-
({ className, ...props }, ref) => (
|
|
10
|
-
<TabsPrimitive.List
|
|
11
|
-
ref={ref}
|
|
12
|
-
className={cn(
|
|
13
|
-
'web:inline-flex h-10 native:h-12 items-center justify-center rounded-md bg-muted p-1 native:px-1.5',
|
|
14
|
-
className
|
|
15
|
-
)}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
)
|
|
19
|
-
);
|
|
20
|
-
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
21
|
-
|
|
22
|
-
const TabsTrigger = React.forwardRef<TabsPrimitive.TriggerRef, TabsPrimitive.TriggerProps>(
|
|
23
|
-
({ className, ...props }, ref) => {
|
|
24
|
-
const { value } = TabsPrimitive.useRootContext();
|
|
25
|
-
return (
|
|
26
|
-
<TextClassContext.Provider
|
|
27
|
-
value={cn(
|
|
28
|
-
'text-sm native:text-base font-medium text-muted-foreground web:transition-all',
|
|
29
|
-
value === props.value && 'text-foreground'
|
|
30
|
-
)}
|
|
31
|
-
>
|
|
32
|
-
<TabsPrimitive.Trigger
|
|
33
|
-
ref={ref}
|
|
34
|
-
className={cn(
|
|
35
|
-
'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',
|
|
36
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
37
|
-
props.value === value && 'bg-background shadow-lg shadow-foreground/10',
|
|
38
|
-
className
|
|
39
|
-
)}
|
|
40
|
-
{...props}
|
|
41
|
-
/>
|
|
42
|
-
</TextClassContext.Provider>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
47
|
-
|
|
48
|
-
const TabsContent = React.forwardRef<TabsPrimitive.ContentRef, TabsPrimitive.ContentProps>(
|
|
49
|
-
({ className, ...props }, ref) => (
|
|
50
|
-
<TabsPrimitive.Content
|
|
51
|
-
ref={ref}
|
|
52
|
-
className={cn(
|
|
53
|
-
'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',
|
|
54
|
-
className
|
|
55
|
-
)}
|
|
56
|
-
{...props}
|
|
57
|
-
/>
|
|
58
|
-
)
|
|
59
|
-
);
|
|
60
|
-
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
61
|
-
|
|
62
|
-
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as Slot from '@rn-primitives/slot';
|
|
2
|
-
import type { SlottableTextProps, TextRef } from '@rn-primitives/types';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Text as RNText } from 'react-native';
|
|
5
|
-
import { cn } from '../../lib/utils';
|
|
6
|
-
|
|
7
|
-
const TextClassContext = React.createContext<string | undefined>(undefined);
|
|
8
|
-
|
|
9
|
-
const Text = React.forwardRef<TextRef, SlottableTextProps>(
|
|
10
|
-
({ className, asChild = false, ...props }, ref) => {
|
|
11
|
-
const textClass = React.useContext(TextClassContext);
|
|
12
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
13
|
-
return (
|
|
14
|
-
<Component
|
|
15
|
-
className={cn('text-base text-foreground web:select-text', textClass, className)}
|
|
16
|
-
ref={ref}
|
|
17
|
-
{...props}
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
Text.displayName = 'Text';
|
|
23
|
-
|
|
24
|
-
export { Text, TextClassContext };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { TextInput, type TextInputProps } from 'react-native';
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
4
|
-
|
|
5
|
-
const Textarea = React.forwardRef<React.ElementRef<typeof TextInput>, TextInputProps>(
|
|
6
|
-
({ className, multiline = true, numberOfLines = 4, placeholderClassName, ...props }, ref) => {
|
|
7
|
-
return (
|
|
8
|
-
<TextInput
|
|
9
|
-
ref={ref}
|
|
10
|
-
className={cn(
|
|
11
|
-
'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',
|
|
12
|
-
props.editable === false && 'opacity-50 web:cursor-not-allowed',
|
|
13
|
-
className
|
|
14
|
-
)}
|
|
15
|
-
placeholderClassName={cn('text-muted-foreground', placeholderClassName)}
|
|
16
|
-
multiline={multiline}
|
|
17
|
-
numberOfLines={numberOfLines}
|
|
18
|
-
textAlignVertical='top'
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
Textarea.displayName = 'Textarea';
|
|
26
|
-
|
|
27
|
-
export { Textarea };
|
|
@@ -1,84 +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
|
-
const ToggleGroup = React.forwardRef<
|
|
12
|
-
ToggleGroupPrimitive.RootRef,
|
|
13
|
-
ToggleGroupPrimitive.RootProps & VariantProps<typeof toggleVariants>
|
|
14
|
-
>(({ className, variant, size, children, ...props }, ref) => (
|
|
15
|
-
<ToggleGroupPrimitive.Root
|
|
16
|
-
ref={ref}
|
|
17
|
-
className={cn('flex flex-row items-center justify-center gap-1', className)}
|
|
18
|
-
{...props}
|
|
19
|
-
>
|
|
20
|
-
<ToggleGroupContext.Provider value={{ variant, size }}>{children}</ToggleGroupContext.Provider>
|
|
21
|
-
</ToggleGroupPrimitive.Root>
|
|
22
|
-
));
|
|
23
|
-
|
|
24
|
-
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
25
|
-
|
|
26
|
-
function useToggleGroupContext() {
|
|
27
|
-
const context = React.useContext(ToggleGroupContext);
|
|
28
|
-
if (context === null) {
|
|
29
|
-
throw new Error(
|
|
30
|
-
'ToggleGroup compound components cannot be rendered outside the ToggleGroup component'
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
return context;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const ToggleGroupItem = React.forwardRef<
|
|
37
|
-
ToggleGroupPrimitive.ItemRef,
|
|
38
|
-
ToggleGroupPrimitive.ItemProps & VariantProps<typeof toggleVariants>
|
|
39
|
-
>(({ className, children, variant, size, ...props }, ref) => {
|
|
40
|
-
const context = useToggleGroupContext();
|
|
41
|
-
const { value } = ToggleGroupPrimitive.useRootContext();
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<TextClassContext.Provider
|
|
45
|
-
value={cn(
|
|
46
|
-
toggleTextVariants({ variant, size }),
|
|
47
|
-
ToggleGroupPrimitive.utils.getIsSelected(value, props.value)
|
|
48
|
-
? 'text-accent-foreground'
|
|
49
|
-
: 'web:group-hover:text-muted-foreground'
|
|
50
|
-
)}
|
|
51
|
-
>
|
|
52
|
-
<ToggleGroupPrimitive.Item
|
|
53
|
-
ref={ref}
|
|
54
|
-
className={cn(
|
|
55
|
-
toggleVariants({
|
|
56
|
-
variant: context.variant || variant,
|
|
57
|
-
size: context.size || size,
|
|
58
|
-
}),
|
|
59
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
60
|
-
ToggleGroupPrimitive.utils.getIsSelected(value, props.value) && 'bg-accent',
|
|
61
|
-
className
|
|
62
|
-
)}
|
|
63
|
-
{...props}
|
|
64
|
-
>
|
|
65
|
-
{children}
|
|
66
|
-
</ToggleGroupPrimitive.Item>
|
|
67
|
-
</TextClassContext.Provider>
|
|
68
|
-
);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
72
|
-
|
|
73
|
-
function ToggleGroupIcon({
|
|
74
|
-
className,
|
|
75
|
-
icon: Icon,
|
|
76
|
-
...props
|
|
77
|
-
}: React.ComponentPropsWithoutRef<LucideIcon> & {
|
|
78
|
-
icon: LucideIcon;
|
|
79
|
-
}) {
|
|
80
|
-
const textClass = React.useContext(TextClassContext);
|
|
81
|
-
return <Icon className={cn(textClass, className)} {...props} />;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export { ToggleGroup, ToggleGroupIcon, ToggleGroupItem };
|
|
@@ -1,85 +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
|
-
const Toggle = React.forwardRef<
|
|
49
|
-
TogglePrimitive.RootRef,
|
|
50
|
-
TogglePrimitive.RootProps & VariantProps<typeof toggleVariants>
|
|
51
|
-
>(({ className, variant, size, ...props }, ref) => (
|
|
52
|
-
<TextClassContext.Provider
|
|
53
|
-
value={cn(
|
|
54
|
-
toggleTextVariants({ variant, size }),
|
|
55
|
-
props.pressed ? 'text-accent-foreground' : 'web:group-hover:text-muted-foreground',
|
|
56
|
-
className
|
|
57
|
-
)}
|
|
58
|
-
>
|
|
59
|
-
<TogglePrimitive.Root
|
|
60
|
-
ref={ref}
|
|
61
|
-
className={cn(
|
|
62
|
-
toggleVariants({ variant, size }),
|
|
63
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
64
|
-
props.pressed && 'bg-accent',
|
|
65
|
-
className
|
|
66
|
-
)}
|
|
67
|
-
{...props}
|
|
68
|
-
/>
|
|
69
|
-
</TextClassContext.Provider>
|
|
70
|
-
));
|
|
71
|
-
|
|
72
|
-
Toggle.displayName = TogglePrimitive.Root.displayName;
|
|
73
|
-
|
|
74
|
-
function ToggleIcon({
|
|
75
|
-
className,
|
|
76
|
-
icon: Icon,
|
|
77
|
-
...props
|
|
78
|
-
}: React.ComponentPropsWithoutRef<LucideIcon> & {
|
|
79
|
-
icon: LucideIcon;
|
|
80
|
-
}) {
|
|
81
|
-
const textClass = React.useContext(TextClassContext);
|
|
82
|
-
return <Icon className={cn(textClass, className)} {...props} />;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export { Toggle, ToggleIcon, toggleTextVariants, toggleVariants };
|
|
@@ -1,38 +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
|
-
const TooltipContent = React.forwardRef<
|
|
12
|
-
TooltipPrimitive.ContentRef,
|
|
13
|
-
TooltipPrimitive.ContentProps & { portalHost?: string }
|
|
14
|
-
>(({ className, sideOffset = 4, portalHost, ...props }, ref) => (
|
|
15
|
-
<TooltipPrimitive.Portal hostName={portalHost}>
|
|
16
|
-
<TooltipPrimitive.Overlay style={Platform.OS !== 'web' ? StyleSheet.absoluteFill : undefined}>
|
|
17
|
-
<Animated.View
|
|
18
|
-
entering={Platform.select({ web: undefined, default: FadeIn })}
|
|
19
|
-
exiting={Platform.select({ web: undefined, default: FadeOut })}
|
|
20
|
-
>
|
|
21
|
-
<TextClassContext.Provider value='text-sm native:text-base text-popover-foreground'>
|
|
22
|
-
<TooltipPrimitive.Content
|
|
23
|
-
ref={ref}
|
|
24
|
-
sideOffset={sideOffset}
|
|
25
|
-
className={cn(
|
|
26
|
-
'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',
|
|
27
|
-
className
|
|
28
|
-
)}
|
|
29
|
-
{...props}
|
|
30
|
-
/>
|
|
31
|
-
</TextClassContext.Provider>
|
|
32
|
-
</Animated.View>
|
|
33
|
-
</TooltipPrimitive.Overlay>
|
|
34
|
-
</TooltipPrimitive.Portal>
|
|
35
|
-
));
|
|
36
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
37
|
-
|
|
38
|
-
export { Tooltip, TooltipContent, TooltipTrigger };
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import * as Slot from '@rn-primitives/slot';
|
|
2
|
-
import type { SlottableTextProps, TextRef } from '@rn-primitives/types';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Platform, Text as RNText } from 'react-native';
|
|
5
|
-
import { cn } from '../../lib/utils';
|
|
6
|
-
|
|
7
|
-
const H1 = React.forwardRef<TextRef, SlottableTextProps>(
|
|
8
|
-
({ className, asChild = false, ...props }, ref) => {
|
|
9
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
10
|
-
return (
|
|
11
|
-
<Component
|
|
12
|
-
role='heading'
|
|
13
|
-
aria-level='1'
|
|
14
|
-
className={cn(
|
|
15
|
-
'web:scroll-m-20 text-4xl text-foreground font-extrabold tracking-tight lg:text-5xl web:select-text',
|
|
16
|
-
className
|
|
17
|
-
)}
|
|
18
|
-
ref={ref}
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
H1.displayName = 'H1';
|
|
26
|
-
|
|
27
|
-
const H2 = React.forwardRef<TextRef, SlottableTextProps>(
|
|
28
|
-
({ className, asChild = false, ...props }, ref) => {
|
|
29
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
30
|
-
return (
|
|
31
|
-
<Component
|
|
32
|
-
role='heading'
|
|
33
|
-
aria-level='2'
|
|
34
|
-
className={cn(
|
|
35
|
-
'web:scroll-m-20 border-b border-border pb-2 text-3xl text-foreground font-semibold tracking-tight first:mt-0 web:select-text',
|
|
36
|
-
className
|
|
37
|
-
)}
|
|
38
|
-
ref={ref}
|
|
39
|
-
{...props}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
H2.displayName = 'H2';
|
|
46
|
-
|
|
47
|
-
const H3 = React.forwardRef<TextRef, SlottableTextProps>(
|
|
48
|
-
({ className, asChild = false, ...props }, ref) => {
|
|
49
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
50
|
-
return (
|
|
51
|
-
<Component
|
|
52
|
-
role='heading'
|
|
53
|
-
aria-level='3'
|
|
54
|
-
className={cn(
|
|
55
|
-
'web:scroll-m-20 text-2xl text-foreground font-semibold tracking-tight web:select-text',
|
|
56
|
-
className
|
|
57
|
-
)}
|
|
58
|
-
ref={ref}
|
|
59
|
-
{...props}
|
|
60
|
-
/>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
H3.displayName = 'H3';
|
|
66
|
-
|
|
67
|
-
const H4 = React.forwardRef<TextRef, SlottableTextProps>(
|
|
68
|
-
({ className, asChild = false, ...props }, ref) => {
|
|
69
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
70
|
-
return (
|
|
71
|
-
<Component
|
|
72
|
-
role='heading'
|
|
73
|
-
aria-level='4'
|
|
74
|
-
className={cn(
|
|
75
|
-
'web:scroll-m-20 text-xl text-foreground font-semibold tracking-tight web:select-text',
|
|
76
|
-
className
|
|
77
|
-
)}
|
|
78
|
-
ref={ref}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
H4.displayName = 'H4';
|
|
86
|
-
|
|
87
|
-
const P = React.forwardRef<TextRef, SlottableTextProps>(
|
|
88
|
-
({ className, asChild = false, ...props }, ref) => {
|
|
89
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
90
|
-
return (
|
|
91
|
-
<Component
|
|
92
|
-
className={cn('text-base text-foreground web:select-text', className)}
|
|
93
|
-
ref={ref}
|
|
94
|
-
{...props}
|
|
95
|
-
/>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
P.displayName = 'P';
|
|
101
|
-
|
|
102
|
-
const BlockQuote = React.forwardRef<TextRef, SlottableTextProps>(
|
|
103
|
-
({ className, asChild = false, ...props }, ref) => {
|
|
104
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
105
|
-
return (
|
|
106
|
-
<Component
|
|
107
|
-
// @ts-ignore - role of blockquote renders blockquote element on the web
|
|
108
|
-
role={Platform.OS === 'web' ? 'blockquote' : undefined}
|
|
109
|
-
className={cn(
|
|
110
|
-
'mt-6 native:mt-4 border-l-2 border-border pl-6 native:pl-3 text-base text-foreground italic web:select-text',
|
|
111
|
-
className
|
|
112
|
-
)}
|
|
113
|
-
ref={ref}
|
|
114
|
-
{...props}
|
|
115
|
-
/>
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
BlockQuote.displayName = 'BlockQuote';
|
|
121
|
-
|
|
122
|
-
const Code = React.forwardRef<TextRef, SlottableTextProps>(
|
|
123
|
-
({ className, asChild = false, ...props }, ref) => {
|
|
124
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
125
|
-
return (
|
|
126
|
-
<Component
|
|
127
|
-
// @ts-ignore - role of code renders code element on the web
|
|
128
|
-
role={Platform.OS === 'web' ? 'code' : undefined}
|
|
129
|
-
className={cn(
|
|
130
|
-
'relative rounded-md bg-muted px-[0.3rem] py-[0.2rem] text-sm text-foreground font-semibold web:select-text',
|
|
131
|
-
className
|
|
132
|
-
)}
|
|
133
|
-
ref={ref}
|
|
134
|
-
{...props}
|
|
135
|
-
/>
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
Code.displayName = 'Code';
|
|
141
|
-
|
|
142
|
-
const Lead = React.forwardRef<TextRef, SlottableTextProps>(
|
|
143
|
-
({ className, asChild = false, ...props }, ref) => {
|
|
144
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
145
|
-
return (
|
|
146
|
-
<Component
|
|
147
|
-
className={cn('text-xl text-muted-foreground web:select-text', className)}
|
|
148
|
-
ref={ref}
|
|
149
|
-
{...props}
|
|
150
|
-
/>
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
Lead.displayName = 'Lead';
|
|
156
|
-
|
|
157
|
-
const Large = React.forwardRef<TextRef, SlottableTextProps>(
|
|
158
|
-
({ className, asChild = false, ...props }, ref) => {
|
|
159
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
160
|
-
return (
|
|
161
|
-
<Component
|
|
162
|
-
className={cn('text-xl text-foreground font-semibold web:select-text', className)}
|
|
163
|
-
ref={ref}
|
|
164
|
-
{...props}
|
|
165
|
-
/>
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
Large.displayName = 'Large';
|
|
171
|
-
|
|
172
|
-
const Small = React.forwardRef<TextRef, SlottableTextProps>(
|
|
173
|
-
({ className, asChild = false, ...props }, ref) => {
|
|
174
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
175
|
-
return (
|
|
176
|
-
<Component
|
|
177
|
-
className={cn(
|
|
178
|
-
'text-sm text-foreground font-medium leading-none web:select-text',
|
|
179
|
-
className
|
|
180
|
-
)}
|
|
181
|
-
ref={ref}
|
|
182
|
-
{...props}
|
|
183
|
-
/>
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
Small.displayName = 'Small';
|
|
189
|
-
|
|
190
|
-
const Muted = React.forwardRef<TextRef, SlottableTextProps>(
|
|
191
|
-
({ className, asChild = false, ...props }, ref) => {
|
|
192
|
-
const Component = asChild ? Slot.Text : RNText;
|
|
193
|
-
return (
|
|
194
|
-
<Component
|
|
195
|
-
className={cn('text-sm text-muted-foreground web:select-text', className)}
|
|
196
|
-
ref={ref}
|
|
197
|
-
{...props}
|
|
198
|
-
/>
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
Muted.displayName = 'Muted';
|
|
204
|
-
|
|
205
|
-
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
|
-
}
|