linked-data-browser 0.0.6 → 0.0.8-alpha.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/.env +2 -0
- package/.eslintrc.js +1 -0
- package/.ldo/profile.shapeTypes.ts +18 -18
- package/.ldo/profile.typings.ts +17 -17
- package/app/index.tsx +3 -0
- package/babel.config.js +9 -1
- package/components/DataBrowser.tsx +9 -19
- package/components/DataBrowserContext.ts +24 -0
- package/components/TargetResourceProvider.tsx +1 -1
- package/components/ThemeProvider.tsx +2 -4
- package/components/common/LoadingBar.tsx +11 -1
- package/components/common/ProfileAvatar.tsx +6 -9
- package/components/nav/Layout.tsx +20 -4
- package/components/nav/header/AddressBox.tsx +104 -48
- package/components/nav/header/AvatarMenu.tsx +44 -12
- package/components/nav/header/Header.tsx +26 -19
- package/components/nav/header/SignInMenu.tsx +63 -36
- package/components/nav/header/ThemeToggleMenu.tsx +21 -9
- package/components/nav/header/ViewMenu.tsx +79 -71
- package/components/sharing/AccessDropdown.tsx +18 -7
- package/components/sharing/CopyLink.tsx +15 -3
- package/components/sharing/PermissionRow.tsx +17 -2
- package/components/sharing/SharingModal.tsx +30 -3
- package/components/sharing/WacRuleForm.tsx +12 -3
- package/components/sharing/agentPermissions/AgentInformation.tsx +18 -6
- package/components/sharing/agentPermissions/AgentInput.tsx +21 -6
- package/components/sharing/agentPermissions/AgentPermissionRow.tsx +24 -6
- package/components/ui/accordion.tsx +1 -1
- package/components/ui/alert.tsx +62 -46
- package/components/ui/avatar.tsx +38 -13
- package/components/ui/badge.tsx +63 -48
- package/components/ui/button.tsx +226 -108
- package/components/ui/card.tsx +53 -38
- package/components/ui/checkbox.tsx +53 -16
- package/components/ui/context-menu.tsx +4 -4
- package/components/ui/dialog.tsx +116 -65
- package/components/ui/dropdown-menu.tsx +304 -105
- package/components/ui/icon.tsx +23 -0
- package/components/ui/input-dropdown.tsx +42 -5
- package/components/ui/input.tsx +85 -22
- package/components/ui/label.tsx +16 -7
- package/components/ui/menubar.tsx +4 -4
- package/components/ui/navigation-menu.tsx +157 -90
- package/components/ui/progress.tsx +38 -24
- package/components/ui/select.tsx +139 -67
- package/components/ui/separator.tsx +22 -7
- package/components/ui/skeleton.tsx +14 -11
- package/components/ui/switch.tsx +82 -37
- package/components/ui/table.tsx +57 -35
- package/components/ui/tabs.tsx +66 -35
- package/components/ui/text.tsx +221 -30
- package/components/ui/textarea.tsx +34 -10
- package/components/ui/typography.tsx +94 -65
- package/components/useViewContext.tsx +8 -8
- package/global.css +93 -3
- package/metro.config.js +21 -3
- package/package.json +6 -9
- package/resourceViews/Container/ContainerConfig.tsx +1 -1
- package/resourceViews/Container/ContainerView.tsx +63 -25
- package/resourceViews/Profile/ProfileConfig.tsx +3 -3
- package/resourceViews/Profile/ProfileKnows.tsx +20 -11
- package/resourceViews/Profile/ProfileView.tsx +23 -6
- package/resourceViews/RawCode/RawCodeConfig.tsx +1 -1
- package/resourceViews/RawCode/RawCodeView.tsx +20 -6
- package/components.json +0 -7
- package/lib/icons/ArrowRight.tsx +0 -4
- package/lib/icons/Check.tsx +0 -4
- package/lib/icons/ChevronDown.tsx +0 -4
- package/lib/icons/ChevronRight.tsx +0 -4
- package/lib/icons/ChevronUp.tsx +0 -4
- package/lib/icons/ChevronsRight.tsx +0 -4
- package/lib/icons/CircleSlash.tsx +0 -4
- package/lib/icons/CircleX.tsx +0 -4
- package/lib/icons/Code.tsx +0 -4
- package/lib/icons/EllipsisVertical.tsx +0 -4
- package/lib/icons/EyeOff.tsx +0 -4
- package/lib/icons/File.tsx +0 -4
- package/lib/icons/Fingerprint.tsx +0 -4
- package/lib/icons/Folder.tsx +0 -4
- package/lib/icons/Folders.tsx +0 -4
- package/lib/icons/Info.tsx +0 -4
- package/lib/icons/Link.tsx +0 -4
- package/lib/icons/Loader.tsx +0 -4
- package/lib/icons/LogOut.tsx +0 -4
- package/lib/icons/MonitorSmartphone.tsx +0 -4
- package/lib/icons/MoonStar.tsx +0 -4
- package/lib/icons/OctagonX.tsx +0 -4
- package/lib/icons/Plus.tsx +0 -4
- package/lib/icons/RefreshCw.tsx +0 -4
- package/lib/icons/Save.tsx +0 -4
- package/lib/icons/ShieldX.tsx +0 -4
- package/lib/icons/Sun.tsx +0 -4
- package/lib/icons/TextCursorInput.tsx +0 -4
- package/lib/icons/Trash.tsx +0 -4
- package/lib/icons/User.tsx +0 -4
- package/lib/icons/UserPlus.tsx +0 -4
- package/lib/icons/Users.tsx +0 -4
- package/lib/icons/ViewIcon.tsx +0 -4
- package/lib/icons/X.tsx +0 -4
- package/lib/icons/iconWithClassName.ts +0 -14
- package/lib/utils.ts +0 -6
- package/nativewind-env.d.ts +0 -1
- package/tailwind.config.js +0 -69
package/components/ui/input.tsx
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
TextInput,
|
|
4
|
+
View,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Platform,
|
|
7
|
+
type TextInputProps,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import { useTheme } from '@react-navigation/native';
|
|
4
10
|
import { Text } from './text';
|
|
5
11
|
import { Button, ButtonProps } from './button';
|
|
6
12
|
|
|
7
|
-
function Input({
|
|
8
|
-
|
|
9
|
-
placeholderClassName,
|
|
13
|
+
export function Input({
|
|
14
|
+
style,
|
|
10
15
|
label,
|
|
11
16
|
buttonRight,
|
|
12
17
|
...props
|
|
@@ -15,37 +20,50 @@ function Input({
|
|
|
15
20
|
label?: string;
|
|
16
21
|
buttonRight?: ButtonProps;
|
|
17
22
|
}) {
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
|
|
25
|
+
// Apply theme colors to base styles
|
|
26
|
+
const inputStyles = {
|
|
27
|
+
base: {
|
|
28
|
+
...inputBaseStyles.base,
|
|
29
|
+
borderColor: theme.colors.border,
|
|
30
|
+
backgroundColor: theme.colors.background,
|
|
31
|
+
color: theme.colors.text,
|
|
32
|
+
},
|
|
33
|
+
disabled: inputBaseStyles.disabled,
|
|
34
|
+
withButton: inputBaseStyles.withButton,
|
|
35
|
+
container: inputBaseStyles.container,
|
|
36
|
+
labelContainer: inputBaseStyles.labelContainer,
|
|
37
|
+
buttonRadius: inputBaseStyles.buttonRadius,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const inputStyle = [
|
|
41
|
+
inputStyles.base,
|
|
42
|
+
props.editable === false && inputStyles.disabled,
|
|
43
|
+
buttonRight && inputStyles.withButton,
|
|
44
|
+
style,
|
|
45
|
+
];
|
|
46
|
+
|
|
18
47
|
let textInput = (
|
|
19
48
|
<TextInput
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
props.editable === false && 'opacity-50 web:cursor-not-allowed',
|
|
23
|
-
buttonRight ? 'rounded-br-none rounded-tr-none' : '',
|
|
24
|
-
className,
|
|
25
|
-
)}
|
|
26
|
-
placeholderClassName={cn('text-muted-foreground', placeholderClassName)}
|
|
49
|
+
style={inputStyle}
|
|
50
|
+
placeholderTextColor={theme.colors.text.replace(')', ' / 0.6)')} // Higher contrast than border, with opacity
|
|
27
51
|
{...props}
|
|
28
52
|
/>
|
|
29
53
|
);
|
|
30
54
|
|
|
31
55
|
if (buttonRight) {
|
|
32
56
|
textInput = (
|
|
33
|
-
<View
|
|
57
|
+
<View style={inputStyles.container}>
|
|
34
58
|
{textInput}
|
|
35
|
-
<Button
|
|
36
|
-
{...buttonRight}
|
|
37
|
-
className={cn(
|
|
38
|
-
'rounded-tl-none rounded-bl-none',
|
|
39
|
-
buttonRight.className,
|
|
40
|
-
)}
|
|
41
|
-
/>
|
|
59
|
+
<Button {...buttonRight} style={[inputStyles.buttonRadius]} />
|
|
42
60
|
</View>
|
|
43
61
|
);
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
if (label) {
|
|
47
65
|
textInput = (
|
|
48
|
-
<View
|
|
66
|
+
<View style={inputStyles.labelContainer}>
|
|
49
67
|
<Text variant="label">{label}</Text>
|
|
50
68
|
{textInput}
|
|
51
69
|
</View>
|
|
@@ -54,4 +72,49 @@ function Input({
|
|
|
54
72
|
return textInput;
|
|
55
73
|
}
|
|
56
74
|
|
|
57
|
-
|
|
75
|
+
// Global base styles for input component
|
|
76
|
+
const inputBaseStyles = StyleSheet.create({
|
|
77
|
+
base: {
|
|
78
|
+
height: 40, // h-10 equivalent
|
|
79
|
+
borderRadius: 6, // rounded-md
|
|
80
|
+
borderWidth: 1,
|
|
81
|
+
paddingHorizontal: 12, // px-3
|
|
82
|
+
paddingVertical: 8, // py-2
|
|
83
|
+
fontSize: 16, // text-base
|
|
84
|
+
// Platform specific adjustments
|
|
85
|
+
...(Platform.OS === 'web' && {
|
|
86
|
+
width: '100%',
|
|
87
|
+
}),
|
|
88
|
+
...(Platform.OS !== 'web' && {
|
|
89
|
+
height: 48, // native:h-12
|
|
90
|
+
fontSize: 18, // native:text-lg
|
|
91
|
+
lineHeight: 22.5, // native:leading-[1.25]
|
|
92
|
+
}),
|
|
93
|
+
},
|
|
94
|
+
disabled: {
|
|
95
|
+
opacity: 0.5,
|
|
96
|
+
...(Platform.OS === 'web' && {
|
|
97
|
+
cursor: 'not-allowed',
|
|
98
|
+
}),
|
|
99
|
+
},
|
|
100
|
+
withButton: {
|
|
101
|
+
borderRadius: 'none',
|
|
102
|
+
borderTopRightRadius: 0,
|
|
103
|
+
borderBottomRightRadius: 0,
|
|
104
|
+
borderTopLeftRadius: 6,
|
|
105
|
+
borderBottomLeftRadius: 6,
|
|
106
|
+
},
|
|
107
|
+
container: {
|
|
108
|
+
flexDirection: 'row',
|
|
109
|
+
},
|
|
110
|
+
labelContainer: {
|
|
111
|
+
gap: 4, // gap-1
|
|
112
|
+
},
|
|
113
|
+
buttonRadius: {
|
|
114
|
+
borderRadius: 'none',
|
|
115
|
+
borderTopRightRadius: 6,
|
|
116
|
+
borderBottomRightRadius: 6,
|
|
117
|
+
borderTopLeftRadius: 0,
|
|
118
|
+
borderBottomLeftRadius: 0,
|
|
119
|
+
},
|
|
120
|
+
});
|
package/components/ui/label.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as LabelPrimitive from '@rn-primitives/label';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
4
|
|
|
5
5
|
function Label({
|
|
6
|
-
|
|
6
|
+
style,
|
|
7
7
|
onPress,
|
|
8
8
|
onLongPress,
|
|
9
9
|
onPressIn,
|
|
@@ -14,21 +14,30 @@ function Label({
|
|
|
14
14
|
}) {
|
|
15
15
|
return (
|
|
16
16
|
<LabelPrimitive.Root
|
|
17
|
-
|
|
17
|
+
style={styles.root}
|
|
18
18
|
onPress={onPress}
|
|
19
19
|
onLongPress={onLongPress}
|
|
20
20
|
onPressIn={onPressIn}
|
|
21
21
|
onPressOut={onPressOut}
|
|
22
22
|
>
|
|
23
23
|
<LabelPrimitive.Text
|
|
24
|
-
|
|
25
|
-
'text-sm text-foreground native:text-base font-medium leading-none web:peer-disabled:cursor-not-allowed web:peer-disabled:opacity-70',
|
|
26
|
-
className,
|
|
27
|
-
)}
|
|
24
|
+
style={StyleSheet.flatten([styles.text, style])}
|
|
28
25
|
{...props}
|
|
29
26
|
/>
|
|
30
27
|
</LabelPrimitive.Root>
|
|
31
28
|
);
|
|
32
29
|
}
|
|
33
30
|
|
|
31
|
+
const styles = StyleSheet.create({
|
|
32
|
+
root: {
|
|
33
|
+
// web:cursor-default - handled by platform
|
|
34
|
+
},
|
|
35
|
+
text: {
|
|
36
|
+
fontSize: 14, // text-sm
|
|
37
|
+
color: 'hsl(var(--foreground))',
|
|
38
|
+
fontWeight: '500',
|
|
39
|
+
lineHeight: 14, // leading-none
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
34
43
|
export { Label };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as MenubarPrimitive from '@rn-primitives/menubar';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Platform, Text, type TextProps, View } from 'react-native';
|
|
4
|
-
import { Check } from '
|
|
5
|
-
import { ChevronDown } from '
|
|
6
|
-
import { ChevronRight } from '
|
|
7
|
-
import { ChevronUp } from '
|
|
4
|
+
import { Check } from 'lucide-react-native';
|
|
5
|
+
import { ChevronDown } from 'lucide-react-native';
|
|
6
|
+
import { ChevronRight } from 'lucide-react-native';
|
|
7
|
+
import { ChevronUp } from 'lucide-react-native';
|
|
8
8
|
import { cn } from '../../lib/utils';
|
|
9
9
|
import { TextClassContext } from '../../components/ui/text';
|
|
10
10
|
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import * as NavigationMenuPrimitive from '@rn-primitives/navigation-menu';
|
|
2
|
-
import { cva } from 'class-variance-authority';
|
|
3
2
|
import * as React from 'react';
|
|
4
|
-
import { Platform, View } from 'react-native';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
FadeInLeft,
|
|
8
|
-
FadeOutLeft,
|
|
9
|
-
interpolate,
|
|
10
|
-
useAnimatedStyle,
|
|
11
|
-
useDerivedValue,
|
|
12
|
-
withTiming,
|
|
13
|
-
} from 'react-native-reanimated';
|
|
14
|
-
import { ChevronDown } from '../../lib/icons/ChevronDown';
|
|
15
|
-
import { cn } from '../../lib/utils';
|
|
3
|
+
import { Platform, View, StyleSheet, Pressable } from 'react-native';
|
|
4
|
+
import { ChevronDown } from 'lucide-react-native';
|
|
5
|
+
import { useTheme } from '@react-navigation/native';
|
|
16
6
|
|
|
17
7
|
function NavigationMenu({
|
|
18
|
-
|
|
8
|
+
style,
|
|
19
9
|
children,
|
|
20
10
|
...props
|
|
21
11
|
}: NavigationMenuPrimitive.RootProps & {
|
|
@@ -23,10 +13,7 @@ function NavigationMenu({
|
|
|
23
13
|
}) {
|
|
24
14
|
return (
|
|
25
15
|
<NavigationMenuPrimitive.Root
|
|
26
|
-
|
|
27
|
-
'relative z-10 flex flex-row max-w-max items-center justify-center',
|
|
28
|
-
className,
|
|
29
|
-
)}
|
|
16
|
+
style={StyleSheet.flatten([styles.navigationMenu, style])}
|
|
30
17
|
{...props}
|
|
31
18
|
>
|
|
32
19
|
{children}
|
|
@@ -36,17 +23,14 @@ function NavigationMenu({
|
|
|
36
23
|
}
|
|
37
24
|
|
|
38
25
|
function NavigationMenuList({
|
|
39
|
-
|
|
26
|
+
style,
|
|
40
27
|
...props
|
|
41
28
|
}: NavigationMenuPrimitive.ListProps & {
|
|
42
29
|
ref?: React.RefObject<NavigationMenuPrimitive.ListRef>;
|
|
43
30
|
}) {
|
|
44
31
|
return (
|
|
45
32
|
<NavigationMenuPrimitive.List
|
|
46
|
-
|
|
47
|
-
'web:group flex flex-1 flex-row web:list-none items-center justify-center gap-1',
|
|
48
|
-
className,
|
|
49
|
-
)}
|
|
33
|
+
style={StyleSheet.flatten([styles.navigationMenuList, style])}
|
|
50
34
|
{...props}
|
|
51
35
|
/>
|
|
52
36
|
);
|
|
@@ -54,57 +38,45 @@ function NavigationMenuList({
|
|
|
54
38
|
|
|
55
39
|
const NavigationMenuItem = NavigationMenuPrimitive.Item;
|
|
56
40
|
|
|
57
|
-
const navigationMenuTriggerStyle = cva(
|
|
58
|
-
'web:group web:inline-flex flex-row h-10 native:h-12 native:px-3 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium web:transition-colors web:hover:bg-accent active:bg-accent web:hover:text-accent-foreground web:focus:bg-accent web:focus:text-accent-foreground web:focus:outline-none web:disabled:pointer-events-none disabled:opacity-50 web:data-[active]:bg-accent/50 web:data-[state=open]:bg-accent/50',
|
|
59
|
-
);
|
|
60
|
-
|
|
61
41
|
function NavigationMenuTrigger({
|
|
62
|
-
|
|
42
|
+
style,
|
|
63
43
|
children,
|
|
64
44
|
...props
|
|
65
45
|
}: Omit<NavigationMenuPrimitive.TriggerProps, 'children'> & {
|
|
66
46
|
children?: React.ReactNode;
|
|
67
47
|
ref?: React.RefObject<NavigationMenuPrimitive.TriggerRef>;
|
|
68
48
|
}) {
|
|
49
|
+
const { colors } = useTheme();
|
|
69
50
|
const { value } = NavigationMenuPrimitive.useRootContext();
|
|
70
51
|
const { value: itemValue } = NavigationMenuPrimitive.useItemContext();
|
|
71
52
|
|
|
72
|
-
const
|
|
73
|
-
value === itemValue
|
|
74
|
-
? withTiming(1, { duration: 250 })
|
|
75
|
-
: withTiming(0, { duration: 200 }),
|
|
76
|
-
);
|
|
77
|
-
const chevronStyle = useAnimatedStyle(() => ({
|
|
78
|
-
transform: [{ rotate: `${progress.value * 180}deg` }],
|
|
79
|
-
opacity: interpolate(progress.value, [0, 1], [1, 0.8], Extrapolation.CLAMP),
|
|
80
|
-
}));
|
|
53
|
+
const isActive = value === itemValue;
|
|
81
54
|
|
|
82
55
|
return (
|
|
83
|
-
<NavigationMenuPrimitive.Trigger
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</Animated.View>
|
|
56
|
+
<NavigationMenuPrimitive.Trigger asChild>
|
|
57
|
+
<Pressable
|
|
58
|
+
style={({ hovered }) => ({
|
|
59
|
+
...styles.trigger,
|
|
60
|
+
backgroundColor: isActive
|
|
61
|
+
? colors.card
|
|
62
|
+
: hovered
|
|
63
|
+
? colors.border
|
|
64
|
+
: colors.background,
|
|
65
|
+
...(style as any),
|
|
66
|
+
})}
|
|
67
|
+
{...props}
|
|
68
|
+
>
|
|
69
|
+
{children}
|
|
70
|
+
<View style={styles.chevronContainer}>
|
|
71
|
+
<ChevronDown size={12} color={colors.text} aria-hidden={true} />
|
|
72
|
+
</View>
|
|
73
|
+
</Pressable>
|
|
102
74
|
</NavigationMenuPrimitive.Trigger>
|
|
103
75
|
);
|
|
104
76
|
}
|
|
105
77
|
|
|
106
78
|
function NavigationMenuContent({
|
|
107
|
-
|
|
79
|
+
style,
|
|
108
80
|
children,
|
|
109
81
|
portalHost,
|
|
110
82
|
...props
|
|
@@ -112,26 +84,22 @@ function NavigationMenuContent({
|
|
|
112
84
|
portalHost?: string;
|
|
113
85
|
ref?: React.RefObject<NavigationMenuPrimitive.ContentRef>;
|
|
114
86
|
}) {
|
|
115
|
-
const {
|
|
116
|
-
|
|
87
|
+
const { colors } = useTheme();
|
|
88
|
+
|
|
117
89
|
return (
|
|
118
90
|
<NavigationMenuPrimitive.Portal hostName={portalHost}>
|
|
119
91
|
<NavigationMenuPrimitive.Content
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
:
|
|
125
|
-
|
|
126
|
-
|
|
92
|
+
style={StyleSheet.flatten([
|
|
93
|
+
styles.content,
|
|
94
|
+
{
|
|
95
|
+
backgroundColor: colors.background,
|
|
96
|
+
borderColor: colors.border,
|
|
97
|
+
},
|
|
98
|
+
style,
|
|
99
|
+
])}
|
|
127
100
|
{...props}
|
|
128
101
|
>
|
|
129
|
-
<
|
|
130
|
-
entering={Platform.OS !== 'web' ? FadeInLeft : undefined}
|
|
131
|
-
exiting={Platform.OS !== 'web' ? FadeOutLeft : undefined}
|
|
132
|
-
>
|
|
133
|
-
{children}
|
|
134
|
-
</Animated.View>
|
|
102
|
+
<View>{children}</View>
|
|
135
103
|
</NavigationMenuPrimitive.Content>
|
|
136
104
|
</NavigationMenuPrimitive.Portal>
|
|
137
105
|
);
|
|
@@ -140,18 +108,24 @@ function NavigationMenuContent({
|
|
|
140
108
|
const NavigationMenuLink = NavigationMenuPrimitive.Link;
|
|
141
109
|
|
|
142
110
|
function NavigationMenuViewport({
|
|
143
|
-
|
|
111
|
+
style,
|
|
144
112
|
...props
|
|
145
113
|
}: NavigationMenuPrimitive.ViewportProps & {
|
|
146
114
|
ref?: React.RefObject<NavigationMenuPrimitive.ViewportRef>;
|
|
147
115
|
}) {
|
|
116
|
+
const { colors } = useTheme();
|
|
117
|
+
|
|
148
118
|
return (
|
|
149
|
-
<View
|
|
119
|
+
<View style={styles.viewportContainer}>
|
|
150
120
|
<View
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
121
|
+
style={StyleSheet.flatten([
|
|
122
|
+
styles.viewport,
|
|
123
|
+
{
|
|
124
|
+
backgroundColor: colors.background,
|
|
125
|
+
borderColor: colors.border,
|
|
126
|
+
},
|
|
127
|
+
style,
|
|
128
|
+
])}
|
|
155
129
|
{...props}
|
|
156
130
|
>
|
|
157
131
|
<NavigationMenuPrimitive.Viewport />
|
|
@@ -162,27 +136,25 @@ function NavigationMenuViewport({
|
|
|
162
136
|
|
|
163
137
|
function NavigationMenuIndicator({
|
|
164
138
|
ref,
|
|
165
|
-
|
|
139
|
+
style,
|
|
166
140
|
...props
|
|
167
141
|
}: NavigationMenuPrimitive.IndicatorProps & {
|
|
168
142
|
ref?: React.RefObject<NavigationMenuPrimitive.IndicatorRef>;
|
|
169
143
|
}) {
|
|
170
|
-
const {
|
|
171
|
-
const { value: itemValue } = NavigationMenuPrimitive.useItemContext();
|
|
144
|
+
const { colors } = useTheme();
|
|
172
145
|
|
|
173
146
|
return (
|
|
174
147
|
<NavigationMenuPrimitive.Indicator
|
|
175
148
|
ref={ref}
|
|
176
|
-
|
|
177
|
-
'top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden',
|
|
178
|
-
value === itemValue
|
|
179
|
-
? 'web:animate-in web:fade-in'
|
|
180
|
-
: 'web:animate-out web:fade-out',
|
|
181
|
-
className,
|
|
182
|
-
)}
|
|
149
|
+
style={StyleSheet.flatten([styles.indicator, style])}
|
|
183
150
|
{...props}
|
|
184
151
|
>
|
|
185
|
-
<View
|
|
152
|
+
<View
|
|
153
|
+
style={StyleSheet.flatten([
|
|
154
|
+
styles.indicatorArrow,
|
|
155
|
+
{ backgroundColor: colors.border },
|
|
156
|
+
])}
|
|
157
|
+
/>
|
|
186
158
|
</NavigationMenuPrimitive.Indicator>
|
|
187
159
|
);
|
|
188
160
|
}
|
|
@@ -195,6 +167,101 @@ export {
|
|
|
195
167
|
NavigationMenuLink,
|
|
196
168
|
NavigationMenuList,
|
|
197
169
|
NavigationMenuTrigger,
|
|
198
|
-
navigationMenuTriggerStyle,
|
|
199
170
|
NavigationMenuViewport,
|
|
200
171
|
};
|
|
172
|
+
|
|
173
|
+
const styles = StyleSheet.create({
|
|
174
|
+
navigationMenu: {
|
|
175
|
+
position: 'relative',
|
|
176
|
+
zIndex: 10,
|
|
177
|
+
flexDirection: 'row',
|
|
178
|
+
maxWidth: '100%',
|
|
179
|
+
alignItems: 'center',
|
|
180
|
+
justifyContent: 'center',
|
|
181
|
+
},
|
|
182
|
+
navigationMenuList: {
|
|
183
|
+
flex: 1,
|
|
184
|
+
flexDirection: 'row',
|
|
185
|
+
alignItems: 'center',
|
|
186
|
+
justifyContent: 'center',
|
|
187
|
+
gap: 4,
|
|
188
|
+
...(Platform.OS === 'web' && {
|
|
189
|
+
listStyle: 'none',
|
|
190
|
+
}),
|
|
191
|
+
},
|
|
192
|
+
trigger: {
|
|
193
|
+
flexDirection: 'row',
|
|
194
|
+
height: Platform.OS === 'web' ? 40 : 48,
|
|
195
|
+
paddingHorizontal: Platform.OS === 'web' ? 16 : 12,
|
|
196
|
+
paddingVertical: 8,
|
|
197
|
+
alignItems: 'center',
|
|
198
|
+
justifyContent: 'center',
|
|
199
|
+
borderRadius: 6,
|
|
200
|
+
minWidth: 'auto',
|
|
201
|
+
gap: 6,
|
|
202
|
+
},
|
|
203
|
+
chevronContainer: {
|
|
204
|
+
// Container for chevron icon
|
|
205
|
+
},
|
|
206
|
+
content: {
|
|
207
|
+
width: '100%',
|
|
208
|
+
...(Platform.OS !== 'web' && {
|
|
209
|
+
borderWidth: 1,
|
|
210
|
+
borderRadius: 8,
|
|
211
|
+
shadowColor: '#000',
|
|
212
|
+
shadowOffset: { width: 0, height: 2 },
|
|
213
|
+
shadowOpacity: 0.1,
|
|
214
|
+
shadowRadius: 4,
|
|
215
|
+
elevation: 3,
|
|
216
|
+
overflow: 'hidden',
|
|
217
|
+
}),
|
|
218
|
+
},
|
|
219
|
+
viewportContainer: {
|
|
220
|
+
...(Platform.OS === 'web' && {
|
|
221
|
+
position: 'fixed',
|
|
222
|
+
right: 0,
|
|
223
|
+
top: 48, // top-12 equivalent
|
|
224
|
+
marginHorizontal: 8,
|
|
225
|
+
flex: 1,
|
|
226
|
+
justifyContent: 'center',
|
|
227
|
+
}),
|
|
228
|
+
},
|
|
229
|
+
viewport: {
|
|
230
|
+
...(Platform.OS === 'web' && {
|
|
231
|
+
position: 'relative',
|
|
232
|
+
marginTop: 6,
|
|
233
|
+
width: '100%',
|
|
234
|
+
overflow: 'hidden',
|
|
235
|
+
borderRadius: 6,
|
|
236
|
+
borderWidth: 1,
|
|
237
|
+
shadowColor: '#000',
|
|
238
|
+
shadowOffset: { width: 0, height: 2 },
|
|
239
|
+
shadowOpacity: 0.1,
|
|
240
|
+
shadowRadius: 4,
|
|
241
|
+
elevation: 3,
|
|
242
|
+
}),
|
|
243
|
+
},
|
|
244
|
+
indicator: {
|
|
245
|
+
position: 'absolute',
|
|
246
|
+
top: '100%',
|
|
247
|
+
zIndex: 1,
|
|
248
|
+
flex: 1,
|
|
249
|
+
height: 6,
|
|
250
|
+
alignItems: 'flex-end',
|
|
251
|
+
justifyContent: 'center',
|
|
252
|
+
overflow: 'hidden',
|
|
253
|
+
},
|
|
254
|
+
indicatorArrow: {
|
|
255
|
+
position: 'relative',
|
|
256
|
+
top: '60%',
|
|
257
|
+
height: 8,
|
|
258
|
+
width: 8,
|
|
259
|
+
transform: [{ rotate: '45deg' }],
|
|
260
|
+
borderTopLeftRadius: 2,
|
|
261
|
+
shadowColor: '#000',
|
|
262
|
+
shadowOffset: { width: 0, height: 1 },
|
|
263
|
+
shadowOpacity: 0.05,
|
|
264
|
+
shadowRadius: 2,
|
|
265
|
+
elevation: 1,
|
|
266
|
+
},
|
|
267
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ProgressPrimitive from '@rn-primitives/progress';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Platform, View } from 'react-native';
|
|
3
|
+
import { Platform, View, StyleSheet } from 'react-native';
|
|
4
4
|
import Animated, {
|
|
5
5
|
Extrapolation,
|
|
6
6
|
interpolate,
|
|
@@ -8,38 +8,32 @@ import Animated, {
|
|
|
8
8
|
useDerivedValue,
|
|
9
9
|
withSpring,
|
|
10
10
|
} from 'react-native-reanimated';
|
|
11
|
-
import { cn } from '../../lib/utils';
|
|
12
11
|
|
|
13
12
|
function Progress({
|
|
14
|
-
|
|
13
|
+
style,
|
|
15
14
|
value,
|
|
16
|
-
|
|
15
|
+
indicatorStyle,
|
|
17
16
|
...props
|
|
18
17
|
}: ProgressPrimitive.RootProps & {
|
|
19
18
|
ref?: React.RefObject<ProgressPrimitive.RootRef>;
|
|
20
|
-
|
|
19
|
+
indicatorStyle?: any;
|
|
21
20
|
}) {
|
|
22
21
|
return (
|
|
23
22
|
<ProgressPrimitive.Root
|
|
24
|
-
|
|
25
|
-
'relative h-4 w-full overflow-hidden rounded-full bg-secondary',
|
|
26
|
-
className,
|
|
27
|
-
)}
|
|
23
|
+
style={StyleSheet.flatten([styles.progress, style])}
|
|
28
24
|
{...props}
|
|
29
25
|
>
|
|
30
|
-
<Indicator value={value}
|
|
26
|
+
<Indicator value={value} style={indicatorStyle} />
|
|
31
27
|
</ProgressPrimitive.Root>
|
|
32
28
|
);
|
|
33
29
|
}
|
|
34
30
|
|
|
35
|
-
export { Progress };
|
|
36
|
-
|
|
37
31
|
function Indicator({
|
|
38
32
|
value,
|
|
39
|
-
|
|
33
|
+
style,
|
|
40
34
|
}: {
|
|
41
35
|
value: number | undefined | null;
|
|
42
|
-
|
|
36
|
+
style?: any;
|
|
43
37
|
}) {
|
|
44
38
|
const progress = useDerivedValue(() => value ?? 0);
|
|
45
39
|
|
|
@@ -55,15 +49,13 @@ function Indicator({
|
|
|
55
49
|
if (Platform.OS === 'web') {
|
|
56
50
|
return (
|
|
57
51
|
<View
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
style={StyleSheet.flatten([
|
|
53
|
+
styles.indicatorWeb,
|
|
54
|
+
{ transform: `translateX(-${100 - (value ?? 0)}%)` },
|
|
55
|
+
style,
|
|
56
|
+
])}
|
|
63
57
|
>
|
|
64
|
-
<ProgressPrimitive.Indicator
|
|
65
|
-
className={cn('h-full w-full', className)}
|
|
66
|
-
/>
|
|
58
|
+
<ProgressPrimitive.Indicator />
|
|
67
59
|
</View>
|
|
68
60
|
);
|
|
69
61
|
}
|
|
@@ -71,9 +63,31 @@ function Indicator({
|
|
|
71
63
|
return (
|
|
72
64
|
<ProgressPrimitive.Indicator asChild>
|
|
73
65
|
<Animated.View
|
|
74
|
-
style={indicator}
|
|
75
|
-
className={cn('h-full bg-foreground', className)}
|
|
66
|
+
style={StyleSheet.flatten([indicator, styles.indicator, style])}
|
|
76
67
|
/>
|
|
77
68
|
</ProgressPrimitive.Indicator>
|
|
78
69
|
);
|
|
79
70
|
}
|
|
71
|
+
|
|
72
|
+
const styles = StyleSheet.create({
|
|
73
|
+
progress: {
|
|
74
|
+
position: 'relative',
|
|
75
|
+
height: 16,
|
|
76
|
+
width: '100%',
|
|
77
|
+
overflow: 'hidden',
|
|
78
|
+
borderRadius: 8,
|
|
79
|
+
backgroundColor: 'hsl(var(--secondary))',
|
|
80
|
+
},
|
|
81
|
+
indicator: {
|
|
82
|
+
height: '100%',
|
|
83
|
+
backgroundColor: 'hsl(var(--primary))',
|
|
84
|
+
},
|
|
85
|
+
indicatorWeb: {
|
|
86
|
+
height: '100%',
|
|
87
|
+
width: '100%',
|
|
88
|
+
flex: 1,
|
|
89
|
+
backgroundColor: 'hsl(var(--primary))',
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export { Progress };
|