@gv-tech/ui-native 2.25.4 → 2.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dialog.d.ts.map +1 -1
- package/dist/drawer.d.ts +3 -1
- package/dist/drawer.d.ts.map +1 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/theme-toggle.d.ts.map +1 -1
- package/dist/ui-native.cjs +2 -2
- package/dist/ui-native.esm.js +979 -969
- package/package.json +1 -1
- package/src/accordion.tsx +1 -1
- package/src/alert-dialog.tsx +1 -1
- package/src/dialog.tsx +3 -4
- package/src/drawer.tsx +25 -7
- package/src/dropdown-menu.tsx +1 -1
- package/src/sheet.tsx +33 -4
- package/src/theme-toggle.tsx +1 -2
package/package.json
CHANGED
package/src/accordion.tsx
CHANGED
|
@@ -55,7 +55,7 @@ const AccordionTrigger: React.ForwardRefExoticComponent<
|
|
|
55
55
|
isExpanded ? withTiming(1, { duration: 250 }) : withTiming(0, { duration: 200 }),
|
|
56
56
|
);
|
|
57
57
|
const chevronStyle = useAnimatedStyle(() => ({
|
|
58
|
-
transform: [{ rotate: `${progress.value * 180}deg` }],
|
|
58
|
+
transform: [{ rotate: `${progress.value * -180}deg` }],
|
|
59
59
|
opacity: interpolate(progress.value, [0, 1], [1, 0.8], Extrapolation.CLAMP),
|
|
60
60
|
}));
|
|
61
61
|
|
package/src/alert-dialog.tsx
CHANGED
|
@@ -23,7 +23,7 @@ const AlertDialogOverlay: React.ForwardRefExoticComponent<
|
|
|
23
23
|
<Animated.View
|
|
24
24
|
entering={FadeIn.duration(150)}
|
|
25
25
|
exiting={FadeOut.duration(150)}
|
|
26
|
-
className={cn('z-50 flex items-center justify-center bg-black/
|
|
26
|
+
className={cn('z-50 flex items-center justify-center bg-black/60 p-2 backdrop-blur-md', className)}
|
|
27
27
|
/>
|
|
28
28
|
</AlertDialogPrimitive.Overlay>
|
|
29
29
|
);
|
package/src/dialog.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import { Platform, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
|
6
6
|
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
7
7
|
|
|
8
8
|
import { cn } from './lib/utils';
|
|
9
|
+
import { Text } from './text';
|
|
9
10
|
|
|
10
11
|
const Dialog = DialogPrimitive.Root;
|
|
11
12
|
|
|
@@ -49,7 +50,7 @@ const DialogOverlay: React.ForwardRefExoticComponent<DialogOverlayProps & React.
|
|
|
49
50
|
<Animated.View
|
|
50
51
|
entering={FadeIn.duration(150)}
|
|
51
52
|
exiting={FadeOut.duration(150)}
|
|
52
|
-
className={cn('flex items-center justify-center bg-black/
|
|
53
|
+
className={cn('flex items-center justify-center bg-black/60 p-2 backdrop-blur-md', className)}
|
|
53
54
|
/>
|
|
54
55
|
</DialogPrimitive.Overlay>
|
|
55
56
|
);
|
|
@@ -87,9 +88,7 @@ const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.
|
|
|
87
88
|
}
|
|
88
89
|
>
|
|
89
90
|
<X size={18} className="text-muted-foreground" />
|
|
90
|
-
<
|
|
91
|
-
<DialogPrimitive.Title>Close</DialogPrimitive.Title>
|
|
92
|
-
</View>
|
|
91
|
+
<Text className="sr-only">Close</Text>
|
|
93
92
|
</DialogPrimitive.Close>
|
|
94
93
|
</Animated.View>
|
|
95
94
|
</DialogPrimitive.Content>
|
package/src/drawer.tsx
CHANGED
|
@@ -10,13 +10,15 @@ import type {
|
|
|
10
10
|
} from '@gv-tech/ui-core';
|
|
11
11
|
import * as DialogPrimitive from '@rn-primitives/dialog';
|
|
12
12
|
import * as React from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import { Platform, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
14
14
|
import Animated, { FadeIn, FadeOut, SlideInDown, SlideOutDown } from 'react-native-reanimated';
|
|
15
15
|
import { wrapTextChildren } from './lib/render-native';
|
|
16
16
|
import { cn } from './lib/utils';
|
|
17
17
|
|
|
18
|
-
export
|
|
19
|
-
|
|
18
|
+
export interface DrawerProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>, DrawerBaseProps {}
|
|
19
|
+
|
|
20
|
+
export const Drawer: React.FC<DrawerProps> = ({ children, ...props }) => {
|
|
21
|
+
return <DialogPrimitive.Root {...props}>{children}</DialogPrimitive.Root>;
|
|
20
22
|
};
|
|
21
23
|
Drawer.displayName = 'Drawer';
|
|
22
24
|
|
|
@@ -39,13 +41,28 @@ export type DrawerOverlayRef = React.ComponentRef<typeof DialogPrimitive.Overlay
|
|
|
39
41
|
|
|
40
42
|
export const DrawerOverlay: React.ForwardRefExoticComponent<
|
|
41
43
|
DrawerOverlayProps & React.RefAttributes<DrawerOverlayRef>
|
|
42
|
-
> = React.forwardRef<DrawerOverlayRef, DrawerOverlayProps>(({ className, ...props }, ref) => {
|
|
44
|
+
> = React.forwardRef<DrawerOverlayRef, DrawerOverlayProps>(({ className, style, ...props }, ref) => {
|
|
43
45
|
return (
|
|
44
|
-
<DialogPrimitive.Overlay
|
|
46
|
+
<DialogPrimitive.Overlay
|
|
47
|
+
style={[
|
|
48
|
+
{
|
|
49
|
+
position: Platform.OS === 'web' ? 'fixed' : 'absolute',
|
|
50
|
+
top: 0,
|
|
51
|
+
right: 0,
|
|
52
|
+
bottom: 0,
|
|
53
|
+
left: 0,
|
|
54
|
+
zIndex: 50,
|
|
55
|
+
} as unknown as ViewStyle,
|
|
56
|
+
style as StyleProp<ViewStyle>,
|
|
57
|
+
]}
|
|
58
|
+
asChild
|
|
59
|
+
ref={ref}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
45
62
|
<Animated.View
|
|
46
63
|
entering={FadeIn.duration(150)}
|
|
47
64
|
exiting={FadeOut.duration(150)}
|
|
48
|
-
className={cn('
|
|
65
|
+
className={cn('bg-black/80', className)}
|
|
49
66
|
/>
|
|
50
67
|
</DialogPrimitive.Overlay>
|
|
51
68
|
);
|
|
@@ -68,7 +85,8 @@ export const DrawerContent = React.forwardRef<
|
|
|
68
85
|
entering={SlideInDown.duration(200)}
|
|
69
86
|
exiting={SlideOutDown.duration(200)}
|
|
70
87
|
className={cn(
|
|
71
|
-
'border-border bg-background
|
|
88
|
+
'border-border bg-background z-50 flex h-auto flex-col rounded-t-xl border p-6 pb-10 shadow-lg',
|
|
89
|
+
Platform.OS === 'web' ? 'fixed inset-x-0 bottom-0' : 'absolute inset-x-0 bottom-0',
|
|
72
90
|
className,
|
|
73
91
|
)}
|
|
74
92
|
>
|
package/src/dropdown-menu.tsx
CHANGED
|
@@ -44,7 +44,7 @@ const DropdownMenuOverlay = React.forwardRef<
|
|
|
44
44
|
<Animated.View
|
|
45
45
|
entering={FadeIn.duration(100)}
|
|
46
46
|
exiting={FadeOut.duration(100)}
|
|
47
|
-
className={cn('absolute inset-0 z-50 bg-black/30', className)}
|
|
47
|
+
className={cn('absolute inset-0 z-50 bg-black/30 backdrop-blur-md', className)}
|
|
48
48
|
/>
|
|
49
49
|
</DropdownMenuPrimitive.Overlay>
|
|
50
50
|
);
|
package/src/sheet.tsx
CHANGED
|
@@ -2,7 +2,18 @@ import * as DialogPrimitive from '@rn-primitives/dialog';
|
|
|
2
2
|
import { X } from 'lucide-react-native';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Platform, StyleSheet, View, type ViewStyle } from 'react-native';
|
|
5
|
-
import Animated, {
|
|
5
|
+
import Animated, {
|
|
6
|
+
FadeIn,
|
|
7
|
+
FadeOut,
|
|
8
|
+
SlideInDown,
|
|
9
|
+
SlideInLeft,
|
|
10
|
+
SlideInRight,
|
|
11
|
+
SlideInUp,
|
|
12
|
+
SlideOutDown,
|
|
13
|
+
SlideOutLeft,
|
|
14
|
+
SlideOutRight,
|
|
15
|
+
SlideOutUp,
|
|
16
|
+
} from 'react-native-reanimated';
|
|
6
17
|
|
|
7
18
|
import { type DialogContentProps } from './dialog';
|
|
8
19
|
import { cn } from './lib/utils';
|
|
@@ -30,7 +41,7 @@ const SheetOverlay: React.ForwardRefExoticComponent<SheetOverlayProps & React.Re
|
|
|
30
41
|
<Animated.View
|
|
31
42
|
entering={FadeIn.duration(150)}
|
|
32
43
|
exiting={FadeOut.duration(150)}
|
|
33
|
-
className={cn('web:cursor-default absolute inset-0 z-50 bg-black/
|
|
44
|
+
className={cn('web:cursor-default absolute inset-0 z-50 bg-black/60 backdrop-blur-md', className)}
|
|
34
45
|
/>
|
|
35
46
|
</DialogPrimitive.Overlay>
|
|
36
47
|
);
|
|
@@ -48,8 +59,26 @@ const SheetContent: React.ForwardRefExoticComponent<SheetContentProps & React.Re
|
|
|
48
59
|
({ className, children, side = 'right', overlayClassName, overlayStyle, ...props }, ref) => {
|
|
49
60
|
const isWeb = Platform.OS === 'web';
|
|
50
61
|
// TODO: Add support for other sides
|
|
51
|
-
|
|
52
|
-
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
|
+
let entering: any = undefined;
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
|
+
let exiting: any = undefined;
|
|
66
|
+
|
|
67
|
+
if (!isWeb) {
|
|
68
|
+
if (side === 'bottom') {
|
|
69
|
+
entering = SlideInDown;
|
|
70
|
+
exiting = SlideOutDown;
|
|
71
|
+
} else if (side === 'top') {
|
|
72
|
+
entering = SlideInUp;
|
|
73
|
+
exiting = SlideOutUp;
|
|
74
|
+
} else if (side === 'left') {
|
|
75
|
+
entering = SlideInLeft;
|
|
76
|
+
exiting = SlideOutLeft;
|
|
77
|
+
} else {
|
|
78
|
+
entering = SlideInRight;
|
|
79
|
+
exiting = SlideOutRight;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
53
82
|
|
|
54
83
|
return (
|
|
55
84
|
<SheetPortal>
|
package/src/theme-toggle.tsx
CHANGED
|
@@ -29,8 +29,7 @@ export function ThemeToggle({ variant = 'binary', onThemeChange, customTheme, cl
|
|
|
29
29
|
onThemeChange(newTheme);
|
|
30
30
|
} else {
|
|
31
31
|
if (newTheme === 'system') {
|
|
32
|
-
|
|
33
|
-
Appearance.setColorScheme(null);
|
|
32
|
+
Appearance.setColorScheme('unspecified');
|
|
34
33
|
} else {
|
|
35
34
|
Appearance.setColorScheme(newTheme);
|
|
36
35
|
}
|