linked-data-browser 0.0.0 → 0.0.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/app/index.tsx +4 -4
- package/components/DataBrowser.tsx +1 -1
- package/components/ThemeProvider.tsx +3 -3
- package/components/nav/DialogProvider.tsx +2 -2
- package/components/nav/Layout.tsx +5 -5
- package/components/nav/header/AddressBox.tsx +7 -7
- package/components/nav/header/Header.tsx +1 -1
- package/components/nav/header/SignInMenu.tsx +3 -3
- package/components/nav/header/ThemeToggleMenu.tsx +2 -2
- package/components/nav/header/ViewMenu.tsx +4 -4
- package/components/nav/useValidView.tsx +1 -1
- package/components/ui/accordion.tsx +151 -0
- package/components/ui/alert.tsx +83 -0
- package/components/ui/aspect-ratio.tsx +5 -0
- package/components/ui/avatar.tsx +1 -1
- package/components/ui/badge.tsx +59 -0
- package/components/ui/button.tsx +2 -2
- package/components/ui/card.tsx +2 -2
- package/components/ui/checkbox.tsx +35 -0
- package/components/ui/collapsible.tsx +9 -0
- package/components/ui/context-menu.tsx +265 -0
- package/components/ui/dialog.tsx +35 -12
- package/components/ui/dropdown-menu.tsx +6 -6
- package/components/ui/hover-card.tsx +47 -0
- package/components/ui/input.tsx +1 -1
- package/components/ui/label.tsx +1 -1
- package/components/ui/menubar.tsx +288 -0
- package/components/ui/navigation-menu.tsx +2 -2
- package/components/ui/popover.tsx +2 -2
- package/components/ui/progress.tsx +1 -1
- package/components/ui/radio-group.tsx +1 -1
- package/components/ui/select.tsx +215 -0
- package/components/ui/separator.tsx +2 -2
- package/components/ui/skeleton.tsx +40 -0
- package/components/ui/switch.tsx +1 -1
- package/components/ui/table.tsx +132 -0
- package/components/ui/tabs.tsx +70 -0
- package/components/ui/text.tsx +1 -1
- package/components/ui/textarea.tsx +30 -0
- package/components/ui/toggle-group.tsx +100 -0
- package/components/ui/toggle.tsx +96 -0
- package/components/ui/tooltip.tsx +2 -2
- package/components/ui/typography.tsx +157 -0
- package/components.json +3 -3
- package/lib/android-navigation-bar.ts +1 -1
- package/lib/icons/Check.tsx +1 -1
- package/lib/icons/ChevronDown.tsx +1 -1
- package/lib/icons/ChevronUp.tsx +1 -1
- package/lib/icons/X.tsx +1 -1
- package/package.json +13 -1
- package/resourceViews/Container/ContainerConfig.tsx +2 -2
- package/resourceViews/Container/ContainerView.tsx +12 -12
- package/resourceViews/RawCode/RawCodeConfig.tsx +2 -2
- package/resourceViews/RawCode/RawCodeEditor.tsx +1 -2
- package/resourceViews/RawCode/RawCodeView.tsx +3 -3
- package/tsconfig.json +1 -6
package/app/index.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DataBrowser } from '
|
|
3
|
-
import { Text } from '
|
|
4
|
-
import { RawCodeConfig } from '
|
|
5
|
-
import { ContainerConfig } from '
|
|
2
|
+
import { DataBrowser } from '../components/DataBrowser';
|
|
3
|
+
import { Text } from '../components/ui/text';
|
|
4
|
+
import { RawCodeConfig } from '../resourceViews/RawCode/RawCodeConfig';
|
|
5
|
+
import { ContainerConfig } from '../resourceViews/Container/ContainerConfig';
|
|
6
6
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
7
7
|
import { StatusBar } from 'react-native';
|
|
8
8
|
|
|
@@ -7,7 +7,7 @@ import { TargetResourceProvider } from './TargetResourceProvider';
|
|
|
7
7
|
import { ResourceViewConfig } from './ResourceView';
|
|
8
8
|
import { NotifierWrapper } from 'react-native-notifier';
|
|
9
9
|
import { Platform } from 'react-native';
|
|
10
|
-
import { ThemeProvider } from '
|
|
10
|
+
import { ThemeProvider } from './ThemeProvider';
|
|
11
11
|
|
|
12
12
|
export interface DataBrowserConfig {
|
|
13
13
|
views: ResourceViewConfig[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import '
|
|
2
|
+
import '../global.css';
|
|
3
3
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
4
4
|
import {
|
|
5
5
|
FunctionComponent,
|
|
@@ -16,9 +16,9 @@ import {
|
|
|
16
16
|
DefaultTheme,
|
|
17
17
|
Theme,
|
|
18
18
|
} from '@react-navigation/native';
|
|
19
|
-
import { NAV_THEME } from '
|
|
19
|
+
import { NAV_THEME } from '../lib/constants';
|
|
20
20
|
import { useColorScheme } from 'nativewind';
|
|
21
|
-
import { setAndroidNavigationBar } from '
|
|
21
|
+
import { setAndroidNavigationBar } from '../lib/android-navigation-bar';
|
|
22
22
|
|
|
23
23
|
const COLOR_SCHEME_KEY = 'colorScheme';
|
|
24
24
|
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
DialogTitle,
|
|
15
15
|
DialogDescription,
|
|
16
16
|
DialogClose,
|
|
17
|
-
} from '
|
|
17
|
+
} from '../ui/dialog';
|
|
18
18
|
import { TextInput, View } from 'react-native';
|
|
19
|
-
import { Button } from '
|
|
19
|
+
import { Button } from '../ui/button';
|
|
20
20
|
import { Text } from '../ui/text';
|
|
21
21
|
|
|
22
22
|
type DialogOptions =
|
|
@@ -7,11 +7,11 @@ import React, {
|
|
|
7
7
|
import { useTargetResource } from '../TargetResourceProvider';
|
|
8
8
|
import { ResourceViewConfig } from '../ResourceView';
|
|
9
9
|
import { ErrorMessageResourceView } from './utilityResourceViews/ErrorMessageResourceView';
|
|
10
|
-
import { TextCursorInput } from '
|
|
11
|
-
import { CircleSlash } from '
|
|
12
|
-
import { OctagonX } from '
|
|
13
|
-
import { ShieldX } from '
|
|
14
|
-
import { CircleX } from '
|
|
10
|
+
import { TextCursorInput } from '../../lib/icons/TextCursorInput';
|
|
11
|
+
import { CircleSlash } from '../../lib/icons/CircleSlash';
|
|
12
|
+
import { OctagonX } from '../../lib/icons/OctagonX';
|
|
13
|
+
import { ShieldX } from '../../lib/icons/ShieldX';
|
|
14
|
+
import { CircleX } from '../../lib/icons/CircleX';
|
|
15
15
|
import { Header } from './header/Header';
|
|
16
16
|
import { View } from 'react-native';
|
|
17
17
|
import { useValidView, ValidViewProvider } from './useValidView';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { useEffect, useMemo } from 'react';
|
|
2
2
|
import { FunctionComponent, useState } from 'react';
|
|
3
3
|
import { TouchableOpacity, View } from 'react-native';
|
|
4
|
-
import { Input } from '
|
|
5
|
-
import { ChevronRight } from '
|
|
6
|
-
import { ChevronsRight } from '
|
|
7
|
-
import { TextCursorInput } from '
|
|
8
|
-
import { RefreshCw } from '
|
|
9
|
-
import { ArrowRight } from '
|
|
10
|
-
import { Button } from '
|
|
4
|
+
import { Input } from '../../ui/input';
|
|
5
|
+
import { ChevronRight } from '../../../lib/icons/ChevronRight';
|
|
6
|
+
import { ChevronsRight } from '../../../lib/icons/ChevronsRight';
|
|
7
|
+
import { TextCursorInput } from '../../../lib/icons/TextCursorInput';
|
|
8
|
+
import { RefreshCw } from '../../../lib/icons/RefreshCw';
|
|
9
|
+
import { ArrowRight } from '../../../lib/icons/ArrowRight';
|
|
10
|
+
import { Button } from '../../../components/ui/button';
|
|
11
11
|
import { Text } from '../../ui/text';
|
|
12
12
|
import { useTargetResource } from '../../TargetResourceProvider';
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@ import { AddressBox } from './AddressBox';
|
|
|
7
7
|
import { AvatarMenu } from './AvatarMenu';
|
|
8
8
|
import { SignInMenu } from './SignInMenu';
|
|
9
9
|
import { ViewMenu } from './ViewMenu';
|
|
10
|
-
import { Card } from '
|
|
10
|
+
import { Card } from '../../../components/ui/card';
|
|
11
11
|
|
|
12
12
|
export const Header: FunctionComponent = () => {
|
|
13
13
|
const { session } = useSolidAuth();
|
|
@@ -4,7 +4,7 @@ import { View } from 'react-native';
|
|
|
4
4
|
|
|
5
5
|
import { Button } from '../../ui/button';
|
|
6
6
|
import { Text } from '../../ui/text';
|
|
7
|
-
import { EllipsisVertical } from '
|
|
7
|
+
import { EllipsisVertical } from '../../../lib/icons/EllipsisVertical';
|
|
8
8
|
import {
|
|
9
9
|
DropdownMenu,
|
|
10
10
|
DropdownMenuContent,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
DropdownMenuItem,
|
|
13
13
|
DropdownMenuSeparator,
|
|
14
14
|
DropdownMenuTrigger,
|
|
15
|
-
} from '
|
|
15
|
+
} from '../../ui/dropdown-menu';
|
|
16
16
|
import { ThemeToggleMenu } from './ThemeToggleMenu';
|
|
17
17
|
import {
|
|
18
18
|
Dialog,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
DialogHeader,
|
|
24
24
|
DialogTitle,
|
|
25
25
|
DialogTrigger,
|
|
26
|
-
} from '
|
|
26
|
+
} from '../../ui/dialog';
|
|
27
27
|
import { Input } from '../../ui/input';
|
|
28
28
|
|
|
29
29
|
const DEFAULT_ISSUER = 'http://localhost:3000';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FunctionComponent } from 'react';
|
|
3
|
-
import { MoonStar } from '
|
|
4
|
-
import { Sun } from '
|
|
3
|
+
import { MoonStar } from '../../../lib/icons/MoonStar';
|
|
4
|
+
import { Sun } from '../../../lib/icons/Sun';
|
|
5
5
|
import { Text } from '../../ui/text';
|
|
6
6
|
import { Switch } from '../../ui/switch';
|
|
7
7
|
import { DropdownMenuItem } from '../../ui/dropdown-menu';
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
NavigationMenuLink,
|
|
8
8
|
NavigationMenuList,
|
|
9
9
|
NavigationMenuTrigger,
|
|
10
|
-
} from '
|
|
10
|
+
} from '../../ui/navigation-menu';
|
|
11
11
|
import { Text } from '../../ui/text';
|
|
12
12
|
import { View } from 'react-native';
|
|
13
13
|
import type { ViewRef } from '@rn-primitives/types';
|
|
14
|
-
import { cn } from '
|
|
15
|
-
import { ViewIcon } from '
|
|
14
|
+
import { cn } from '../../../lib/utils';
|
|
15
|
+
import { ViewIcon } from '../../../lib/icons/ViewIcon';
|
|
16
16
|
import { useValidView } from '../useValidView';
|
|
17
|
-
import { ResourceViewConfig } from '
|
|
17
|
+
import { ResourceViewConfig } from '../../../components/ResourceView';
|
|
18
18
|
|
|
19
19
|
export const ViewMenu: FunctionComponent = () => {
|
|
20
20
|
const insets = useSafeAreaInsets();
|
|
@@ -3,7 +3,7 @@ import React, { useEffect, useMemo, useState } from 'react';
|
|
|
3
3
|
import { useDataBrowserConfig } from '../DataBrowser';
|
|
4
4
|
import { useTargetResource } from '../TargetResourceProvider';
|
|
5
5
|
import { ResourceViewConfig } from '../ResourceView';
|
|
6
|
-
import { EyeOff } from '
|
|
6
|
+
import { EyeOff } from '../../lib/icons/EyeOff';
|
|
7
7
|
import { ErrorMessageResourceView } from './utilityResourceViews/ErrorMessageResourceView';
|
|
8
8
|
|
|
9
9
|
export const [ValidViewProvider, useValidView] = createContainer(() => {
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import * as AccordionPrimitive from '@rn-primitives/accordion';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Platform, Pressable, View } from 'react-native';
|
|
4
|
+
import Animated, {
|
|
5
|
+
Extrapolation,
|
|
6
|
+
FadeIn,
|
|
7
|
+
FadeOutUp,
|
|
8
|
+
LayoutAnimationConfig,
|
|
9
|
+
LinearTransition,
|
|
10
|
+
interpolate,
|
|
11
|
+
useAnimatedStyle,
|
|
12
|
+
useDerivedValue,
|
|
13
|
+
withTiming,
|
|
14
|
+
} from 'react-native-reanimated';
|
|
15
|
+
import { ChevronDown } from '../../lib/icons/ChevronDown';
|
|
16
|
+
import { cn } from '../../lib/utils';
|
|
17
|
+
import { TextClassContext } from '../../components/ui/text';
|
|
18
|
+
|
|
19
|
+
function Accordion({
|
|
20
|
+
children,
|
|
21
|
+
...props
|
|
22
|
+
}: Omit<AccordionPrimitive.RootProps, 'asChild'> & {
|
|
23
|
+
ref?: React.RefObject<AccordionPrimitive.RootRef>;
|
|
24
|
+
}) {
|
|
25
|
+
return (
|
|
26
|
+
<LayoutAnimationConfig skipEntering>
|
|
27
|
+
<AccordionPrimitive.Root
|
|
28
|
+
{...(props as AccordionPrimitive.RootProps)}
|
|
29
|
+
asChild={Platform.OS !== 'web'}
|
|
30
|
+
>
|
|
31
|
+
<Animated.View layout={LinearTransition.duration(200)}>
|
|
32
|
+
{children}
|
|
33
|
+
</Animated.View>
|
|
34
|
+
</AccordionPrimitive.Root>
|
|
35
|
+
</LayoutAnimationConfig>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function AccordionItem({
|
|
40
|
+
className,
|
|
41
|
+
value,
|
|
42
|
+
...props
|
|
43
|
+
}: AccordionPrimitive.ItemProps & {
|
|
44
|
+
ref?: React.RefObject<AccordionPrimitive.ItemRef>;
|
|
45
|
+
}) {
|
|
46
|
+
return (
|
|
47
|
+
<Animated.View
|
|
48
|
+
className={'overflow-hidden'}
|
|
49
|
+
layout={LinearTransition.duration(200)}
|
|
50
|
+
>
|
|
51
|
+
<AccordionPrimitive.Item
|
|
52
|
+
className={cn('border-b border-border', className)}
|
|
53
|
+
value={value}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
</Animated.View>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const Trigger = Platform.OS === 'web' ? View : Pressable;
|
|
61
|
+
|
|
62
|
+
function AccordionTrigger({
|
|
63
|
+
className,
|
|
64
|
+
children,
|
|
65
|
+
...props
|
|
66
|
+
}: AccordionPrimitive.TriggerProps & {
|
|
67
|
+
children?: React.ReactNode;
|
|
68
|
+
ref?: React.RefObject<AccordionPrimitive.TriggerRef>;
|
|
69
|
+
}) {
|
|
70
|
+
const { isExpanded } = AccordionPrimitive.useItemContext();
|
|
71
|
+
|
|
72
|
+
const progress = useDerivedValue(() =>
|
|
73
|
+
isExpanded
|
|
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
|
+
}));
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<TextClassContext.Provider value="native:text-lg font-medium web:group-hover:underline">
|
|
84
|
+
<AccordionPrimitive.Header className="flex">
|
|
85
|
+
<AccordionPrimitive.Trigger {...props} asChild>
|
|
86
|
+
<Trigger
|
|
87
|
+
className={cn(
|
|
88
|
+
'flex flex-row web:flex-1 items-center justify-between py-4 web:transition-all group web:focus-visible:outline-none web:focus-visible:ring-1 web:focus-visible:ring-muted-foreground',
|
|
89
|
+
className,
|
|
90
|
+
)}
|
|
91
|
+
>
|
|
92
|
+
{children}
|
|
93
|
+
<Animated.View style={chevronStyle}>
|
|
94
|
+
<ChevronDown size={18} className={'text-foreground shrink-0'} />
|
|
95
|
+
</Animated.View>
|
|
96
|
+
</Trigger>
|
|
97
|
+
</AccordionPrimitive.Trigger>
|
|
98
|
+
</AccordionPrimitive.Header>
|
|
99
|
+
</TextClassContext.Provider>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function AccordionContent({
|
|
104
|
+
className,
|
|
105
|
+
children,
|
|
106
|
+
...props
|
|
107
|
+
}: AccordionPrimitive.ContentProps & {
|
|
108
|
+
ref?: React.RefObject<AccordionPrimitive.ContentRef>;
|
|
109
|
+
}) {
|
|
110
|
+
const { isExpanded } = AccordionPrimitive.useItemContext();
|
|
111
|
+
return (
|
|
112
|
+
<TextClassContext.Provider value="native:text-lg">
|
|
113
|
+
<AccordionPrimitive.Content
|
|
114
|
+
className={cn(
|
|
115
|
+
'overflow-hidden text-sm web:transition-all',
|
|
116
|
+
isExpanded
|
|
117
|
+
? 'web:animate-accordion-down'
|
|
118
|
+
: 'web:animate-accordion-up',
|
|
119
|
+
)}
|
|
120
|
+
{...props}
|
|
121
|
+
>
|
|
122
|
+
<InnerContent className={cn('pb-4', className)}>
|
|
123
|
+
{children}
|
|
124
|
+
</InnerContent>
|
|
125
|
+
</AccordionPrimitive.Content>
|
|
126
|
+
</TextClassContext.Provider>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function InnerContent({
|
|
131
|
+
children,
|
|
132
|
+
className,
|
|
133
|
+
}: {
|
|
134
|
+
children: React.ReactNode;
|
|
135
|
+
className?: string;
|
|
136
|
+
}) {
|
|
137
|
+
if (Platform.OS === 'web') {
|
|
138
|
+
return <View className={cn('pb-4', className)}>{children}</View>;
|
|
139
|
+
}
|
|
140
|
+
return (
|
|
141
|
+
<Animated.View
|
|
142
|
+
entering={FadeIn}
|
|
143
|
+
exiting={FadeOutUp.duration(200)}
|
|
144
|
+
className={cn('pb-4', className)}
|
|
145
|
+
>
|
|
146
|
+
{children}
|
|
147
|
+
</Animated.View>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useTheme } from '@react-navigation/native';
|
|
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 { View, type ViewProps } from 'react-native';
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
|
+
import { Text } from '../../components/ui/text';
|
|
8
|
+
|
|
9
|
+
const alertVariants = cva(
|
|
10
|
+
'relative bg-background w-full rounded-lg border border-border p-4 shadow shadow-foreground/10',
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
variant: {
|
|
14
|
+
default: '',
|
|
15
|
+
destructive: 'border-destructive',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: 'default',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
function Alert({
|
|
25
|
+
className,
|
|
26
|
+
variant,
|
|
27
|
+
children,
|
|
28
|
+
icon: Icon,
|
|
29
|
+
iconSize = 16,
|
|
30
|
+
...props
|
|
31
|
+
}: ViewProps &
|
|
32
|
+
VariantProps<typeof alertVariants> & {
|
|
33
|
+
ref?: React.RefObject<View>;
|
|
34
|
+
icon: LucideIcon;
|
|
35
|
+
iconSize?: number;
|
|
36
|
+
iconClassName?: string;
|
|
37
|
+
}) {
|
|
38
|
+
const { colors } = useTheme();
|
|
39
|
+
return (
|
|
40
|
+
<View
|
|
41
|
+
role="alert"
|
|
42
|
+
className={alertVariants({ variant, className })}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
<View className="absolute left-3.5 top-4 -translate-y-0.5">
|
|
46
|
+
<Icon
|
|
47
|
+
size={iconSize}
|
|
48
|
+
color={variant === 'destructive' ? colors.notification : colors.text}
|
|
49
|
+
/>
|
|
50
|
+
</View>
|
|
51
|
+
{children}
|
|
52
|
+
</View>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function AlertTitle({
|
|
57
|
+
className,
|
|
58
|
+
...props
|
|
59
|
+
}: React.ComponentProps<typeof Text>) {
|
|
60
|
+
return (
|
|
61
|
+
<Text
|
|
62
|
+
className={cn(
|
|
63
|
+
'pl-7 mb-1 font-medium text-base leading-none tracking-tight text-foreground',
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function AlertDescription({
|
|
72
|
+
className,
|
|
73
|
+
...props
|
|
74
|
+
}: React.ComponentProps<typeof Text>) {
|
|
75
|
+
return (
|
|
76
|
+
<Text
|
|
77
|
+
className={cn('pl-7 text-sm leading-relaxed text-foreground', className)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { Alert, AlertDescription, AlertTitle };
|
package/components/ui/avatar.tsx
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as Slot from '@rn-primitives/slot';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { View, ViewProps } from 'react-native';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { TextClassContext } from '../ui/text';
|
|
7
|
+
|
|
8
|
+
const badgeVariants = cva(
|
|
9
|
+
'web:inline-flex items-center rounded-full border border-border px-2.5 py-0.5 web:transition-colors web:focus:outline-none web:focus:ring-2 web:focus:ring-ring web:focus:ring-offset-2',
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default:
|
|
14
|
+
'border-transparent bg-primary web:hover:opacity-80 active:opacity-80',
|
|
15
|
+
secondary:
|
|
16
|
+
'border-transparent bg-secondary web:hover:opacity-80 active:opacity-80',
|
|
17
|
+
destructive:
|
|
18
|
+
'border-transparent bg-destructive web:hover:opacity-80 active:opacity-80',
|
|
19
|
+
outline: 'text-foreground',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: 'default',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const badgeTextVariants = cva('text-xs font-semibold ', {
|
|
29
|
+
variants: {
|
|
30
|
+
variant: {
|
|
31
|
+
default: 'text-primary-foreground',
|
|
32
|
+
secondary: 'text-secondary-foreground',
|
|
33
|
+
destructive: 'text-destructive-foreground',
|
|
34
|
+
outline: 'text-foreground',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
variant: 'default',
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
type BadgeProps = ViewProps & {
|
|
43
|
+
asChild?: boolean;
|
|
44
|
+
} & VariantProps<typeof badgeVariants>;
|
|
45
|
+
|
|
46
|
+
function Badge({ className, variant, asChild, ...props }: BadgeProps) {
|
|
47
|
+
const Component = asChild ? Slot.View : View;
|
|
48
|
+
return (
|
|
49
|
+
<TextClassContext.Provider value={badgeTextVariants({ variant })}>
|
|
50
|
+
<Component
|
|
51
|
+
className={cn(badgeVariants({ variant }), className)}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
</TextClassContext.Provider>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { Badge, badgeTextVariants, badgeVariants };
|
|
59
|
+
export type { BadgeProps };
|
package/components/ui/button.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Pressable } from 'react-native';
|
|
4
|
-
import { TextClassContext } from '
|
|
5
|
-
import { cn } from '
|
|
4
|
+
import { TextClassContext } from '../ui/text';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
6
|
|
|
7
7
|
const buttonVariants = cva(
|
|
8
8
|
'group flex items-center justify-center rounded-md web:ring-offset-background web:transition-colors web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
|
package/components/ui/card.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Text, TextProps, View, ViewProps } from 'react-native';
|
|
3
|
-
import { TextClassContext } from '
|
|
4
|
-
import { cn } from '
|
|
3
|
+
import { TextClassContext } from '../ui/text';
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
5
|
|
|
6
6
|
function Card({
|
|
7
7
|
className,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as CheckboxPrimitive from '@rn-primitives/checkbox';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import { Check } from '../../lib/icons/Check';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
|
|
7
|
+
function Checkbox({
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}: CheckboxPrimitive.RootProps & {
|
|
11
|
+
ref?: React.RefObject<CheckboxPrimitive.RootRef>;
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<CheckboxPrimitive.Root
|
|
15
|
+
className={cn(
|
|
16
|
+
'web:peer h-4 w-4 native:h-[20] native:w-[20] shrink-0 rounded-sm native:rounded border border-primary 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 disabled:cursor-not-allowed disabled:opacity-50',
|
|
17
|
+
props.checked && 'bg-primary',
|
|
18
|
+
className,
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
<CheckboxPrimitive.Indicator
|
|
23
|
+
className={cn('items-center justify-center h-full w-full')}
|
|
24
|
+
>
|
|
25
|
+
<Check
|
|
26
|
+
size={12}
|
|
27
|
+
strokeWidth={Platform.OS === 'web' ? 2.5 : 3.5}
|
|
28
|
+
className="text-primary-foreground"
|
|
29
|
+
/>
|
|
30
|
+
</CheckboxPrimitive.Indicator>
|
|
31
|
+
</CheckboxPrimitive.Root>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { Checkbox };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as CollapsiblePrimitive from '@rn-primitives/collapsible';
|
|
2
|
+
|
|
3
|
+
const Collapsible = CollapsiblePrimitive.Root;
|
|
4
|
+
|
|
5
|
+
const CollapsibleTrigger = CollapsiblePrimitive.Trigger;
|
|
6
|
+
|
|
7
|
+
const CollapsibleContent = CollapsiblePrimitive.Content;
|
|
8
|
+
|
|
9
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|