@react-native-reusables/cli 0.0.18 → 0.1.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/README.md +2 -37
- package/__generated/components/ui/accordion.tsx +30 -32
- package/__generated/components/ui/alert-dialog.tsx +19 -26
- package/__generated/components/ui/aspect-ratio.tsx +1 -1
- package/__generated/components/ui/avatar.tsx +31 -34
- package/__generated/components/ui/badge.tsx +2 -2
- package/__generated/components/ui/button.tsx +2 -5
- package/__generated/components/ui/card.tsx +39 -51
- package/__generated/components/ui/checkbox.tsx +25 -27
- package/__generated/components/ui/collapsible.tsx +1 -1
- package/__generated/components/ui/context-menu.tsx +28 -31
- package/__generated/components/ui/dialog.tsx +40 -43
- package/__generated/components/ui/dropdown-menu.tsx +27 -22
- package/__generated/components/ui/hover-card.tsx +3 -3
- package/__generated/components/ui/input.tsx +17 -18
- package/__generated/components/ui/label.tsx +21 -22
- package/__generated/components/ui/menubar.tsx +45 -47
- package/__generated/components/ui/navigation-menu.tsx +19 -17
- package/__generated/components/ui/popover.tsx +4 -4
- package/__generated/components/ui/progress.tsx +15 -11
- package/__generated/components/ui/radio-group.tsx +27 -29
- package/__generated/components/ui/select.tsx +55 -65
- package/__generated/components/ui/separator.tsx +16 -17
- package/__generated/components/ui/switch.tsx +59 -61
- package/__generated/components/ui/table.tsx +69 -76
- package/__generated/components/ui/tabs.tsx +49 -52
- package/__generated/components/ui/text.tsx +2 -2
- package/__generated/components/ui/textarea.tsx +20 -21
- package/__generated/components/ui/toggle-group.tsx +5 -7
- package/__generated/components/ui/toggle.tsx +4 -4
- package/__generated/components/ui/tooltip.tsx +4 -5
- 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
|
@@ -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,33 +7,30 @@ 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
|
-
const SwitchWeb = React.forwardRef<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
>(({ className, ...props }, ref) => (
|
|
18
|
-
<SwitchPrimitives.Root
|
|
19
|
-
className={cn(
|
|
20
|
-
'peer flex-row h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed',
|
|
21
|
-
props.checked ? 'bg-primary' : 'bg-input',
|
|
22
|
-
props.disabled && 'opacity-50',
|
|
23
|
-
className
|
|
24
|
-
)}
|
|
25
|
-
{...props}
|
|
26
|
-
ref={ref}
|
|
27
|
-
>
|
|
28
|
-
<SwitchPrimitives.Thumb
|
|
13
|
+
const SwitchWeb = React.forwardRef<SwitchPrimitives.RootRef, SwitchPrimitives.RootProps>(
|
|
14
|
+
({ className, ...props }, ref) => (
|
|
15
|
+
<SwitchPrimitives.Root
|
|
29
16
|
className={cn(
|
|
30
|
-
'
|
|
31
|
-
props.checked ? '
|
|
17
|
+
'peer flex-row h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed',
|
|
18
|
+
props.checked ? 'bg-primary' : 'bg-input',
|
|
19
|
+
props.disabled && 'opacity-50',
|
|
20
|
+
className
|
|
32
21
|
)}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
{...props}
|
|
23
|
+
ref={ref}
|
|
24
|
+
>
|
|
25
|
+
<SwitchPrimitives.Thumb
|
|
26
|
+
className={cn(
|
|
27
|
+
'pointer-events-none block h-5 w-5 rounded-full bg-background shadow-md shadow-foreground/5 ring-0 transition-transform',
|
|
28
|
+
props.checked ? 'translate-x-5' : 'translate-x-0'
|
|
29
|
+
)}
|
|
30
|
+
/>
|
|
31
|
+
</SwitchPrimitives.Root>
|
|
32
|
+
)
|
|
33
|
+
);
|
|
36
34
|
|
|
37
35
|
SwitchWeb.displayName = 'SwitchWeb';
|
|
38
36
|
|
|
@@ -47,46 +45,46 @@ const RGB_COLORS = {
|
|
|
47
45
|
},
|
|
48
46
|
} as const;
|
|
49
47
|
|
|
50
|
-
const SwitchNative = React.forwardRef<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
style={animatedRootStyle}
|
|
71
|
-
className={cn('h-8 w-[46px] rounded-full', props.disabled && 'opacity-50')}
|
|
72
|
-
>
|
|
73
|
-
<SwitchPrimitives.Root
|
|
74
|
-
className={cn(
|
|
75
|
-
'flex-row h-8 w-[46px] shrink-0 items-center rounded-full border-2 border-transparent',
|
|
76
|
-
className
|
|
77
|
-
)}
|
|
78
|
-
{...props}
|
|
79
|
-
ref={ref}
|
|
48
|
+
const SwitchNative = React.forwardRef<SwitchPrimitives.RootRef, SwitchPrimitives.RootProps>(
|
|
49
|
+
({ className, ...props }, ref) => {
|
|
50
|
+
const { colorScheme } = useColorScheme();
|
|
51
|
+
const translateX = useDerivedValue(() => (props.checked ? 18 : 0));
|
|
52
|
+
const animatedRootStyle = useAnimatedStyle(() => {
|
|
53
|
+
return {
|
|
54
|
+
backgroundColor: interpolateColor(
|
|
55
|
+
translateX.value,
|
|
56
|
+
[0, 18],
|
|
57
|
+
[RGB_COLORS[colorScheme].input, RGB_COLORS[colorScheme].primary]
|
|
58
|
+
),
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
const animatedThumbStyle = useAnimatedStyle(() => ({
|
|
62
|
+
transform: [{ translateX: withTiming(translateX.value, { duration: 200 }) }],
|
|
63
|
+
}));
|
|
64
|
+
return (
|
|
65
|
+
<Animated.View
|
|
66
|
+
style={animatedRootStyle}
|
|
67
|
+
className={cn('h-8 w-[46px] rounded-full', props.disabled && 'opacity-50')}
|
|
80
68
|
>
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
69
|
+
<SwitchPrimitives.Root
|
|
70
|
+
className={cn(
|
|
71
|
+
'flex-row h-8 w-[46px] shrink-0 items-center rounded-full border-2 border-transparent',
|
|
72
|
+
props.checked ? 'bg-primary' : 'bg-input',
|
|
73
|
+
className
|
|
74
|
+
)}
|
|
75
|
+
{...props}
|
|
76
|
+
ref={ref}
|
|
77
|
+
>
|
|
78
|
+
<Animated.View style={animatedThumbStyle}>
|
|
79
|
+
<SwitchPrimitives.Thumb
|
|
80
|
+
className={'h-7 w-7 rounded-full bg-background shadow-md shadow-foreground/25 ring-0'}
|
|
81
|
+
/>
|
|
82
|
+
</Animated.View>
|
|
83
|
+
</SwitchPrimitives.Root>
|
|
84
|
+
</Animated.View>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
90
88
|
SwitchNative.displayName = 'SwitchNative';
|
|
91
89
|
|
|
92
90
|
const Switch = Platform.select({
|
|
@@ -1,99 +1,92 @@
|
|
|
1
|
+
import * as TablePrimitive from '@rn-primitives/table';
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import * as TablePrimitive from '@rnr/table';
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
4
|
import { TextClassContext } from './text';
|
|
5
5
|
|
|
6
|
-
const Table = React.forwardRef<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
));
|
|
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
|
+
);
|
|
16
15
|
Table.displayName = 'Table';
|
|
17
16
|
|
|
18
|
-
const TableHeader = React.forwardRef<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
));
|
|
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
|
+
);
|
|
28
26
|
TableHeader.displayName = 'TableHeader';
|
|
29
27
|
|
|
30
|
-
const TableBody = React.forwardRef<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
));
|
|
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
|
+
);
|
|
41
38
|
TableBody.displayName = 'TableBody';
|
|
42
39
|
|
|
43
|
-
const TableFooter = React.forwardRef<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
));
|
|
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
|
+
);
|
|
53
49
|
TableFooter.displayName = 'TableFooter';
|
|
54
50
|
|
|
55
|
-
const TableRow = React.forwardRef<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
>(({ className, ...props }, ref) => (
|
|
59
|
-
<TablePrimitive.Row
|
|
60
|
-
ref={ref}
|
|
61
|
-
className={cn(
|
|
62
|
-
'flex-row border-border border-b web:transition-colors web:hover:bg-muted/50 web:data-[state=selected]:bg-muted',
|
|
63
|
-
className
|
|
64
|
-
)}
|
|
65
|
-
{...props}
|
|
66
|
-
/>
|
|
67
|
-
));
|
|
68
|
-
TableRow.displayName = 'TableRow';
|
|
69
|
-
|
|
70
|
-
const TableHead = React.forwardRef<
|
|
71
|
-
React.ElementRef<typeof TablePrimitive.Head>,
|
|
72
|
-
React.ComponentPropsWithoutRef<typeof TablePrimitive.Head>
|
|
73
|
-
>(({ className, ...props }, ref) => (
|
|
74
|
-
<TextClassContext.Provider value='text-muted-foreground'>
|
|
75
|
-
<TablePrimitive.Head
|
|
51
|
+
const TableRow = React.forwardRef<TablePrimitive.RowRef, TablePrimitive.RowProps>(
|
|
52
|
+
({ className, ...props }, ref) => (
|
|
53
|
+
<TablePrimitive.Row
|
|
76
54
|
ref={ref}
|
|
77
55
|
className={cn(
|
|
78
|
-
'
|
|
56
|
+
'flex-row border-border border-b web:transition-colors web:hover:bg-muted/50 web:data-[state=selected]:bg-muted',
|
|
79
57
|
className
|
|
80
58
|
)}
|
|
81
59
|
{...props}
|
|
82
60
|
/>
|
|
83
|
-
|
|
84
|
-
)
|
|
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
|
+
);
|
|
85
79
|
TableHead.displayName = 'TableHead';
|
|
86
80
|
|
|
87
|
-
const TableCell = React.forwardRef<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
));
|
|
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
|
+
);
|
|
97
90
|
TableCell.displayName = 'TableCell';
|
|
98
91
|
|
|
99
92
|
export { Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -1,65 +1,62 @@
|
|
|
1
|
+
import * as TabsPrimitive from '@rn-primitives/tabs';
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import { TextClassContext } from './text';
|
|
3
|
-
import * as TabsPrimitive from '@rnr/tabs';
|
|
4
3
|
import { cn } from '../../lib/utils';
|
|
4
|
+
import { TextClassContext } from './text';
|
|
5
5
|
|
|
6
6
|
const Tabs = TabsPrimitive.Root;
|
|
7
7
|
|
|
8
|
-
const TabsList = React.forwardRef<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
));
|
|
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
|
+
);
|
|
21
20
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
22
21
|
|
|
23
|
-
const TabsTrigger = React.forwardRef<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'text-sm native:text-base font-medium text-muted-foreground web:transition-all',
|
|
32
|
-
value === props.value && 'text-foreground'
|
|
33
|
-
)}
|
|
34
|
-
>
|
|
35
|
-
<TabsPrimitive.Trigger
|
|
36
|
-
ref={ref}
|
|
37
|
-
className={cn(
|
|
38
|
-
'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',
|
|
39
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
40
|
-
props.value === value && 'bg-background shadow-lg shadow-foreground/10',
|
|
41
|
-
className
|
|
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'
|
|
42
30
|
)}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
+
);
|
|
48
46
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
49
47
|
|
|
50
|
-
const TabsContent = React.forwardRef<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
));
|
|
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
|
+
);
|
|
63
60
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
64
61
|
|
|
65
62
|
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
|
@@ -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';
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { TextInput } from 'react-native';
|
|
2
|
+
import { TextInput, type TextInputProps } from 'react-native';
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
4
|
|
|
5
|
-
const Textarea = React.forwardRef<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
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
|
+
);
|
|
25
24
|
|
|
26
25
|
Textarea.displayName = 'Textarea';
|
|
27
26
|
|
|
@@ -3,15 +3,14 @@ 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);
|
|
10
10
|
|
|
11
11
|
const ToggleGroup = React.forwardRef<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
VariantProps<typeof toggleVariants>
|
|
12
|
+
ToggleGroupPrimitive.RootRef,
|
|
13
|
+
ToggleGroupPrimitive.RootProps & VariantProps<typeof toggleVariants>
|
|
15
14
|
>(({ className, variant, size, children, ...props }, ref) => (
|
|
16
15
|
<ToggleGroupPrimitive.Root
|
|
17
16
|
ref={ref}
|
|
@@ -35,9 +34,8 @@ function useToggleGroupContext() {
|
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
const ToggleGroupItem = React.forwardRef<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
VariantProps<typeof toggleVariants>
|
|
37
|
+
ToggleGroupPrimitive.ItemRef,
|
|
38
|
+
ToggleGroupPrimitive.ItemProps & VariantProps<typeof toggleVariants>
|
|
41
39
|
>(({ className, children, variant, size, ...props }, ref) => {
|
|
42
40
|
const context = useToggleGroupContext();
|
|
43
41
|
const { value } = ToggleGroupPrimitive.useRootContext();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import * as TogglePrimitive from '@rn-primitives/toggle';
|
|
1
2
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
3
|
import type { LucideIcon } from 'lucide-react-native';
|
|
3
4
|
import * as React from 'react';
|
|
4
|
-
import { TextClassContext } from './text';
|
|
5
|
-
import * as TogglePrimitive from '@rnr/toggle';
|
|
6
5
|
import { cn } from '../../lib/utils';
|
|
6
|
+
import { TextClassContext } from './text';
|
|
7
7
|
|
|
8
8
|
const toggleVariants = cva(
|
|
9
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',
|
|
@@ -46,8 +46,8 @@ const toggleTextVariants = cva('text-sm native:text-base text-foreground font-me
|
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
const Toggle = React.forwardRef<
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
TogglePrimitive.RootRef,
|
|
50
|
+
TogglePrimitive.RootProps & VariantProps<typeof toggleVariants>
|
|
51
51
|
>(({ className, variant, size, ...props }, ref) => (
|
|
52
52
|
<TextClassContext.Provider
|
|
53
53
|
value={cn(
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
+
import * as TooltipPrimitive from '@rn-primitives/tooltip';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { Platform, StyleSheet } from 'react-native';
|
|
3
4
|
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
4
|
-
import { TextClassContext } from './text';
|
|
5
|
-
import * as TooltipPrimitive from '@rnr/tooltip';
|
|
6
5
|
import { cn } from '../../lib/utils';
|
|
6
|
+
import { TextClassContext } from './text';
|
|
7
7
|
|
|
8
8
|
const Tooltip = TooltipPrimitive.Root;
|
|
9
|
-
|
|
10
9
|
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
11
10
|
|
|
12
11
|
const TooltipContent = React.forwardRef<
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
TooltipPrimitive.ContentRef,
|
|
13
|
+
TooltipPrimitive.ContentProps & { portalHost?: string }
|
|
15
14
|
>(({ className, sideOffset = 4, portalHost, ...props }, ref) => (
|
|
16
15
|
<TooltipPrimitive.Portal hostName={portalHost}>
|
|
17
16
|
<TooltipPrimitive.Overlay style={Platform.OS !== 'web' ? StyleSheet.absoluteFill : undefined}>
|
|
@@ -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';
|