@gv-tech/ui-native 2.25.4 → 2.26.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/dist/dialog.d.ts.map +1 -1
- package/dist/drawer.d.ts +3 -1
- package/dist/drawer.d.ts.map +1 -1
- package/dist/item.d.ts +2 -2
- package/dist/item.d.ts.map +1 -1
- package/dist/select.d.ts +1 -8
- package/dist/select.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 +992 -973
- 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/item.tsx +4 -4
- package/src/select.tsx +14 -4
- 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/item.tsx
CHANGED
|
@@ -10,9 +10,9 @@ import type {
|
|
|
10
10
|
ItemSeparatorBaseProps,
|
|
11
11
|
ItemTitleBaseProps,
|
|
12
12
|
} from '@gv-tech/ui-core';
|
|
13
|
-
import
|
|
14
|
-
import { Text, View } from 'react-native';
|
|
13
|
+
import { View } from 'react-native';
|
|
15
14
|
import { cn } from './lib/utils';
|
|
15
|
+
import { Text } from './text';
|
|
16
16
|
|
|
17
17
|
function Item({ className, variant, size, ...props }: React.ComponentProps<typeof View> & ItemBaseProps) {
|
|
18
18
|
return (
|
|
@@ -29,7 +29,7 @@ function ItemContent({ className, ...props }: React.ComponentProps<typeof View>
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function ItemDescription({ className, ...props }: React.ComponentProps<typeof Text> & ItemDescriptionBaseProps) {
|
|
32
|
-
return <Text className={cn('text-muted-foreground
|
|
32
|
+
return <Text variant="bodySmall" className={cn('text-muted-foreground', className)} {...props} />;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function ItemFooter({ className, ...props }: React.ComponentProps<typeof View> & ItemFooterBaseProps) {
|
|
@@ -57,7 +57,7 @@ function ItemSeparator({
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function ItemTitle({ className, ...props }: React.ComponentProps<typeof Text> & ItemTitleBaseProps) {
|
|
60
|
-
return <Text className={cn('
|
|
60
|
+
return <Text variant="bodySmall" className={cn('font-medium', className)} {...props} />;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export {
|
package/src/select.tsx
CHANGED
|
@@ -36,7 +36,17 @@ const SelectGroup = SelectPrimitive.Group;
|
|
|
36
36
|
export interface SelectValueProps
|
|
37
37
|
extends Omit<React.ComponentPropsWithoutRef<typeof SelectPrimitive.Value>, 'placeholder'>, SelectValueBaseProps {}
|
|
38
38
|
|
|
39
|
-
const SelectValue = SelectPrimitive.Value
|
|
39
|
+
const SelectValue = React.forwardRef<React.ComponentRef<typeof SelectPrimitive.Value>, SelectValueProps>(
|
|
40
|
+
({ className, placeholder, ...props }, ref) => (
|
|
41
|
+
<SelectPrimitive.Value
|
|
42
|
+
ref={ref}
|
|
43
|
+
className={cn('text-foreground native:text-base text-sm', className)}
|
|
44
|
+
placeholder={typeof placeholder === 'string' ? placeholder : ''}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
SelectValue.displayName = SelectPrimitive.Value?.displayName || 'SelectValue';
|
|
40
50
|
|
|
41
51
|
export interface SelectTriggerProps
|
|
42
52
|
extends
|
|
@@ -155,7 +165,7 @@ const SelectLabel = React.forwardRef<React.ComponentRef<typeof SelectPrimitive.L
|
|
|
155
165
|
({ className, ...props }, ref) => (
|
|
156
166
|
<SelectPrimitive.Label
|
|
157
167
|
ref={ref}
|
|
158
|
-
className={cn('text-
|
|
168
|
+
className={cn('text-foreground py-1.5 pr-2 pl-8 text-sm font-semibold', className)}
|
|
159
169
|
{...props}
|
|
160
170
|
/>
|
|
161
171
|
),
|
|
@@ -188,11 +198,11 @@ const SelectItem = React.forwardRef<React.ComponentRef<typeof SelectPrimitive.It
|
|
|
188
198
|
{...({} as Record<string, unknown>)}
|
|
189
199
|
>
|
|
190
200
|
<SelectPrimitive.ItemIndicator>
|
|
191
|
-
<Check size={14} strokeWidth={3} className="text-
|
|
201
|
+
<Check size={14} strokeWidth={3} className="text-foreground" {...({} as Record<string, unknown>)} />
|
|
192
202
|
</SelectPrimitive.ItemIndicator>
|
|
193
203
|
</View>
|
|
194
204
|
{/* @ts-expect-error TODO: fix type */}
|
|
195
|
-
<SelectPrimitive.ItemText className="text-
|
|
205
|
+
<SelectPrimitive.ItemText className="text-foreground native:text-base text-sm">
|
|
196
206
|
{children}
|
|
197
207
|
</SelectPrimitive.ItemText>
|
|
198
208
|
</SelectPrimitive.Item>
|
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
|
}
|