linked-data-browser 0.0.0 → 0.0.2
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 +1 -1
- 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/infra/ansible.cfg +0 -0
- package/infra/hosts +2 -0
- package/infra/hosts.example +2 -0
- package/infra/nginx.conf.j2 +12 -0
- package/infra/playbook.yml +77 -0
- package/infra/secrets.yml +11 -0
- 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 +17 -5
- 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
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import * as ContextMenuPrimitive from '@rn-primitives/context-menu';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Platform,
|
|
5
|
+
type StyleProp,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Text,
|
|
8
|
+
type TextProps,
|
|
9
|
+
View,
|
|
10
|
+
type ViewStyle,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import { Check } from '../../lib/icons/Check';
|
|
13
|
+
import { ChevronDown } from '../../lib/icons/ChevronDown';
|
|
14
|
+
import { ChevronRight } from '../../lib/icons/ChevronRight';
|
|
15
|
+
import { ChevronUp } from '../../lib/icons/ChevronUp';
|
|
16
|
+
import { cn } from '../../lib/utils';
|
|
17
|
+
import { TextClassContext } from '../../components/ui/text';
|
|
18
|
+
|
|
19
|
+
const ContextMenu = ContextMenuPrimitive.Root;
|
|
20
|
+
const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
21
|
+
const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
22
|
+
const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
23
|
+
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
24
|
+
|
|
25
|
+
function ContextMenuSubTrigger({
|
|
26
|
+
className,
|
|
27
|
+
inset,
|
|
28
|
+
children,
|
|
29
|
+
...props
|
|
30
|
+
}: ContextMenuPrimitive.SubTriggerProps & {
|
|
31
|
+
ref?: React.RefObject<ContextMenuPrimitive.SubTriggerRef>;
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
inset?: boolean;
|
|
34
|
+
}) {
|
|
35
|
+
const { open } = ContextMenuPrimitive.useSubContext();
|
|
36
|
+
const Icon =
|
|
37
|
+
Platform.OS === 'web' ? ChevronRight : open ? ChevronUp : ChevronDown;
|
|
38
|
+
return (
|
|
39
|
+
<TextClassContext.Provider
|
|
40
|
+
value={cn(
|
|
41
|
+
'select-none text-sm native:text-lg text-primary',
|
|
42
|
+
open && 'native:text-accent-foreground',
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
<ContextMenuPrimitive.SubTrigger
|
|
46
|
+
className={cn(
|
|
47
|
+
'flex flex-row web:cursor-default web:select-none items-center gap-2 web:focus:bg-accent active:bg-accent web:hover:bg-accent rounded-sm px-2 py-1.5 native:py-2 web:outline-none',
|
|
48
|
+
open && 'bg-accent',
|
|
49
|
+
inset && 'pl-8',
|
|
50
|
+
className,
|
|
51
|
+
)}
|
|
52
|
+
{...props}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
<Icon size={18} className="ml-auto text-foreground" />
|
|
56
|
+
</ContextMenuPrimitive.SubTrigger>
|
|
57
|
+
</TextClassContext.Provider>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function ContextMenuSubContent({
|
|
62
|
+
className,
|
|
63
|
+
...props
|
|
64
|
+
}: ContextMenuPrimitive.SubContentProps & {
|
|
65
|
+
ref?: React.RefObject<ContextMenuPrimitive.SubContentRef>;
|
|
66
|
+
}) {
|
|
67
|
+
const { open } = ContextMenuPrimitive.useSubContext();
|
|
68
|
+
return (
|
|
69
|
+
<ContextMenuPrimitive.SubContent
|
|
70
|
+
className={cn(
|
|
71
|
+
'z-50 min-w-[8rem] overflow-hidden rounded-md border mt-1 border-border bg-popover p-1 shadow-md shadow-foreground/5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
72
|
+
open
|
|
73
|
+
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
74
|
+
: 'web:animate-out web:fade-out-0 web:zoom-out',
|
|
75
|
+
className,
|
|
76
|
+
)}
|
|
77
|
+
{...props}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function ContextMenuContent({
|
|
83
|
+
className,
|
|
84
|
+
overlayClassName,
|
|
85
|
+
overlayStyle,
|
|
86
|
+
portalHost,
|
|
87
|
+
...props
|
|
88
|
+
}: ContextMenuPrimitive.ContentProps & {
|
|
89
|
+
ref?: React.RefObject<ContextMenuPrimitive.ContentRef>;
|
|
90
|
+
overlayStyle?: StyleProp<ViewStyle>;
|
|
91
|
+
overlayClassName?: string;
|
|
92
|
+
portalHost?: string;
|
|
93
|
+
}) {
|
|
94
|
+
const { open } = ContextMenuPrimitive.useRootContext();
|
|
95
|
+
return (
|
|
96
|
+
<ContextMenuPrimitive.Portal hostName={portalHost}>
|
|
97
|
+
<ContextMenuPrimitive.Overlay
|
|
98
|
+
style={
|
|
99
|
+
overlayStyle
|
|
100
|
+
? StyleSheet.flatten([
|
|
101
|
+
Platform.OS !== 'web' ? StyleSheet.absoluteFill : undefined,
|
|
102
|
+
overlayStyle as typeof StyleSheet.absoluteFill,
|
|
103
|
+
])
|
|
104
|
+
: Platform.OS !== 'web'
|
|
105
|
+
? StyleSheet.absoluteFill
|
|
106
|
+
: undefined
|
|
107
|
+
}
|
|
108
|
+
className={overlayClassName}
|
|
109
|
+
>
|
|
110
|
+
<ContextMenuPrimitive.Content
|
|
111
|
+
className={cn(
|
|
112
|
+
'z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 shadow-md shadow-foreground/5 web:data-[side=bottom]:slide-in-from-top-2 web:data-[side=left]:slide-in-from-right-2 web:data-[side=right]:slide-in-from-left-2 web:data-[side=top]:slide-in-from-bottom-2',
|
|
113
|
+
open
|
|
114
|
+
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
115
|
+
: 'web:animate-out web:fade-out-0 web:zoom-out-95',
|
|
116
|
+
className,
|
|
117
|
+
)}
|
|
118
|
+
{...props}
|
|
119
|
+
/>
|
|
120
|
+
</ContextMenuPrimitive.Overlay>
|
|
121
|
+
</ContextMenuPrimitive.Portal>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function ContextMenuItem({
|
|
126
|
+
className,
|
|
127
|
+
inset,
|
|
128
|
+
...props
|
|
129
|
+
}: ContextMenuPrimitive.ItemProps & {
|
|
130
|
+
ref?: React.RefObject<ContextMenuPrimitive.ItemRef>;
|
|
131
|
+
className?: string;
|
|
132
|
+
inset?: boolean;
|
|
133
|
+
}) {
|
|
134
|
+
return (
|
|
135
|
+
<TextClassContext.Provider value="select-none text-sm native:text-lg text-popover-foreground web:group-focus:text-accent-foreground">
|
|
136
|
+
<ContextMenuPrimitive.Item
|
|
137
|
+
className={cn(
|
|
138
|
+
'relative flex flex-row web:cursor-default items-center gap-2 rounded-sm px-2 py-1.5 native:py-2 web:outline-none web:focus:bg-accent active:bg-accent web:hover:bg-accent group',
|
|
139
|
+
inset && 'pl-8',
|
|
140
|
+
props.disabled && 'opacity-50 web:pointer-events-none',
|
|
141
|
+
className,
|
|
142
|
+
)}
|
|
143
|
+
{...props}
|
|
144
|
+
/>
|
|
145
|
+
</TextClassContext.Provider>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function ContextMenuCheckboxItem({
|
|
150
|
+
className,
|
|
151
|
+
children,
|
|
152
|
+
...props
|
|
153
|
+
}: ContextMenuPrimitive.CheckboxItemProps & {
|
|
154
|
+
ref?: React.RefObject<ContextMenuPrimitive.CheckboxItemRef>;
|
|
155
|
+
children?: React.ReactNode;
|
|
156
|
+
}) {
|
|
157
|
+
return (
|
|
158
|
+
<ContextMenuPrimitive.CheckboxItem
|
|
159
|
+
className={cn(
|
|
160
|
+
'relative flex flex-row web:cursor-default items-center web:group rounded-sm py-1.5 native:py-2 pl-8 pr-2 web:outline-none web:focus:bg-accent active:bg-accent',
|
|
161
|
+
props.disabled && 'web:pointer-events-none opacity-50',
|
|
162
|
+
className,
|
|
163
|
+
)}
|
|
164
|
+
{...props}
|
|
165
|
+
>
|
|
166
|
+
<View className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
167
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
168
|
+
<Check size={14} strokeWidth={3} className="text-foreground" />
|
|
169
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
170
|
+
</View>
|
|
171
|
+
{children}
|
|
172
|
+
</ContextMenuPrimitive.CheckboxItem>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function ContextMenuRadioItem({
|
|
177
|
+
className,
|
|
178
|
+
children,
|
|
179
|
+
...props
|
|
180
|
+
}: ContextMenuPrimitive.RadioItemProps & {
|
|
181
|
+
ref?: React.RefObject<ContextMenuPrimitive.RadioItemRef>;
|
|
182
|
+
children?: React.ReactNode;
|
|
183
|
+
}) {
|
|
184
|
+
return (
|
|
185
|
+
<ContextMenuPrimitive.RadioItem
|
|
186
|
+
className={cn(
|
|
187
|
+
'relative flex flex-row web:cursor-default web:group items-center rounded-sm py-1.5 native:py-2 pl-8 pr-2 web:outline-none web:focus:bg-accent active:bg-accent',
|
|
188
|
+
props.disabled && 'web:pointer-events-none opacity-50',
|
|
189
|
+
className,
|
|
190
|
+
)}
|
|
191
|
+
{...props}
|
|
192
|
+
>
|
|
193
|
+
<View className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
194
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
195
|
+
<View className="bg-foreground h-2 w-2 rounded-full" />
|
|
196
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
197
|
+
</View>
|
|
198
|
+
{children}
|
|
199
|
+
</ContextMenuPrimitive.RadioItem>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function ContextMenuLabel({
|
|
204
|
+
className,
|
|
205
|
+
inset,
|
|
206
|
+
...props
|
|
207
|
+
}: ContextMenuPrimitive.LabelProps & {
|
|
208
|
+
ref?: React.RefObject<ContextMenuPrimitive.LabelRef>;
|
|
209
|
+
className?: string;
|
|
210
|
+
inset?: boolean;
|
|
211
|
+
}) {
|
|
212
|
+
return (
|
|
213
|
+
<ContextMenuPrimitive.Label
|
|
214
|
+
className={cn(
|
|
215
|
+
'px-2 py-1.5 text-sm native:text-base font-semibold text-foreground web:cursor-default',
|
|
216
|
+
inset && 'pl-8',
|
|
217
|
+
className,
|
|
218
|
+
)}
|
|
219
|
+
{...props}
|
|
220
|
+
/>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function ContextMenuSeparator({
|
|
225
|
+
className,
|
|
226
|
+
...props
|
|
227
|
+
}: ContextMenuPrimitive.SeparatorProps & {
|
|
228
|
+
ref?: React.RefObject<ContextMenuPrimitive.SeparatorRef>;
|
|
229
|
+
}) {
|
|
230
|
+
return (
|
|
231
|
+
<ContextMenuPrimitive.Separator
|
|
232
|
+
className={cn('-mx-1 my-1 h-px bg-border', className)}
|
|
233
|
+
{...props}
|
|
234
|
+
/>
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function ContextMenuShortcut({ className, ...props }: TextProps) {
|
|
239
|
+
return (
|
|
240
|
+
<Text
|
|
241
|
+
className={cn(
|
|
242
|
+
'ml-auto text-xs native:text-sm tracking-widest text-muted-foreground',
|
|
243
|
+
className,
|
|
244
|
+
)}
|
|
245
|
+
{...props}
|
|
246
|
+
/>
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export {
|
|
251
|
+
ContextMenu,
|
|
252
|
+
ContextMenuCheckboxItem,
|
|
253
|
+
ContextMenuContent,
|
|
254
|
+
ContextMenuGroup,
|
|
255
|
+
ContextMenuItem,
|
|
256
|
+
ContextMenuLabel,
|
|
257
|
+
ContextMenuRadioGroup,
|
|
258
|
+
ContextMenuRadioItem,
|
|
259
|
+
ContextMenuSeparator,
|
|
260
|
+
ContextMenuShortcut,
|
|
261
|
+
ContextMenuSub,
|
|
262
|
+
ContextMenuSubContent,
|
|
263
|
+
ContextMenuSubTrigger,
|
|
264
|
+
ContextMenuTrigger,
|
|
265
|
+
};
|
package/components/ui/dialog.tsx
CHANGED
|
@@ -2,8 +2,8 @@ import * as DialogPrimitive from '@rn-primitives/dialog';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Platform, StyleSheet, View, type ViewProps } from 'react-native';
|
|
4
4
|
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
5
|
-
import { X } from '
|
|
6
|
-
import { cn } from '
|
|
5
|
+
import { X } from '../../lib/icons/X';
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
7
|
|
|
8
8
|
const Dialog = DialogPrimitive.Root;
|
|
9
9
|
|
|
@@ -24,8 +24,10 @@ function DialogOverlayWeb({
|
|
|
24
24
|
<DialogPrimitive.Overlay
|
|
25
25
|
className={cn(
|
|
26
26
|
'bg-black/80 flex justify-center items-center p-2 absolute top-0 right-0 bottom-0 left-0',
|
|
27
|
-
open
|
|
28
|
-
|
|
27
|
+
open
|
|
28
|
+
? 'web:animate-in web:fade-in-0'
|
|
29
|
+
: 'web:animate-out web:fade-out-0',
|
|
30
|
+
className,
|
|
29
31
|
)}
|
|
30
32
|
{...props}
|
|
31
33
|
/>
|
|
@@ -43,10 +45,16 @@ function DialogOverlayNative({
|
|
|
43
45
|
return (
|
|
44
46
|
<DialogPrimitive.Overlay
|
|
45
47
|
style={StyleSheet.absoluteFill}
|
|
46
|
-
className={cn(
|
|
48
|
+
className={cn(
|
|
49
|
+
'flex bg-black/80 justify-center items-center p-2',
|
|
50
|
+
className,
|
|
51
|
+
)}
|
|
47
52
|
{...props}
|
|
48
53
|
>
|
|
49
|
-
<Animated.View
|
|
54
|
+
<Animated.View
|
|
55
|
+
entering={FadeIn.duration(150)}
|
|
56
|
+
exiting={FadeOut.duration(150)}
|
|
57
|
+
>
|
|
50
58
|
{children}
|
|
51
59
|
</Animated.View>
|
|
52
60
|
</DialogPrimitive.Overlay>
|
|
@@ -78,7 +86,7 @@ function DialogContent({
|
|
|
78
86
|
open
|
|
79
87
|
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
80
88
|
: 'web:animate-out web:fade-out-0 web:zoom-out-95',
|
|
81
|
-
className
|
|
89
|
+
className,
|
|
82
90
|
)}
|
|
83
91
|
{...props}
|
|
84
92
|
>
|
|
@@ -90,7 +98,10 @@ function DialogContent({
|
|
|
90
98
|
>
|
|
91
99
|
<X
|
|
92
100
|
size={Platform.OS === 'web' ? 16 : 18}
|
|
93
|
-
className={cn(
|
|
101
|
+
className={cn(
|
|
102
|
+
'text-muted-foreground',
|
|
103
|
+
open && 'text-accent-foreground',
|
|
104
|
+
)}
|
|
94
105
|
/>
|
|
95
106
|
</DialogPrimitive.Close>
|
|
96
107
|
</DialogPrimitive.Content>
|
|
@@ -101,14 +112,23 @@ function DialogContent({
|
|
|
101
112
|
|
|
102
113
|
function DialogHeader({ className, ...props }: ViewProps) {
|
|
103
114
|
return (
|
|
104
|
-
<View
|
|
115
|
+
<View
|
|
116
|
+
className={cn(
|
|
117
|
+
'flex flex-col gap-1.5 text-center sm:text-left',
|
|
118
|
+
className,
|
|
119
|
+
)}
|
|
120
|
+
{...props}
|
|
121
|
+
/>
|
|
105
122
|
);
|
|
106
123
|
}
|
|
107
124
|
|
|
108
125
|
function DialogFooter({ className, ...props }: ViewProps) {
|
|
109
126
|
return (
|
|
110
127
|
<View
|
|
111
|
-
className={cn(
|
|
128
|
+
className={cn(
|
|
129
|
+
'flex flex-col-reverse sm:flex-row sm:justify-end gap-2',
|
|
130
|
+
className,
|
|
131
|
+
)}
|
|
112
132
|
{...props}
|
|
113
133
|
/>
|
|
114
134
|
);
|
|
@@ -124,7 +144,7 @@ function DialogTitle({
|
|
|
124
144
|
<DialogPrimitive.Title
|
|
125
145
|
className={cn(
|
|
126
146
|
'text-lg native:text-xl text-foreground font-semibold leading-none tracking-tight',
|
|
127
|
-
className
|
|
147
|
+
className,
|
|
128
148
|
)}
|
|
129
149
|
{...props}
|
|
130
150
|
/>
|
|
@@ -139,7 +159,10 @@ function DialogDescription({
|
|
|
139
159
|
}) {
|
|
140
160
|
return (
|
|
141
161
|
<DialogPrimitive.Description
|
|
142
|
-
className={cn(
|
|
162
|
+
className={cn(
|
|
163
|
+
'text-sm native:text-base text-muted-foreground',
|
|
164
|
+
className,
|
|
165
|
+
)}
|
|
143
166
|
{...props}
|
|
144
167
|
/>
|
|
145
168
|
);
|
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
View,
|
|
10
10
|
type ViewStyle,
|
|
11
11
|
} from 'react-native';
|
|
12
|
-
import { Check } from '
|
|
13
|
-
import { ChevronDown } from '
|
|
14
|
-
import { ChevronRight } from '
|
|
15
|
-
import { ChevronUp } from '
|
|
16
|
-
import { cn } from '
|
|
17
|
-
import { TextClassContext } from '
|
|
12
|
+
import { Check } from '../../lib/icons/Check';
|
|
13
|
+
import { ChevronDown } from '../../lib/icons/ChevronDown';
|
|
14
|
+
import { ChevronRight } from '../../lib/icons/ChevronRight';
|
|
15
|
+
import { ChevronUp } from '../../lib/icons/ChevronUp';
|
|
16
|
+
import { cn } from '../../lib/utils';
|
|
17
|
+
import { TextClassContext } from '../../components/ui/text';
|
|
18
18
|
|
|
19
19
|
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
20
20
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as HoverCardPrimitive from '@rn-primitives/hover-card';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
4
|
+
import Animated, { FadeIn } from 'react-native-reanimated';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { TextClassContext } from '../../components/ui/text';
|
|
7
|
+
|
|
8
|
+
const HoverCard = HoverCardPrimitive.Root;
|
|
9
|
+
|
|
10
|
+
const HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
11
|
+
|
|
12
|
+
function HoverCardContent({
|
|
13
|
+
className,
|
|
14
|
+
align = 'center',
|
|
15
|
+
sideOffset = 4,
|
|
16
|
+
...props
|
|
17
|
+
}: HoverCardPrimitive.ContentProps & {
|
|
18
|
+
ref?: React.RefObject<HoverCardPrimitive.ContentRef>;
|
|
19
|
+
}) {
|
|
20
|
+
const { open } = HoverCardPrimitive.useRootContext();
|
|
21
|
+
return (
|
|
22
|
+
<HoverCardPrimitive.Portal>
|
|
23
|
+
<HoverCardPrimitive.Overlay
|
|
24
|
+
style={Platform.OS !== 'web' ? StyleSheet.absoluteFill : undefined}
|
|
25
|
+
>
|
|
26
|
+
<Animated.View entering={FadeIn}>
|
|
27
|
+
<TextClassContext.Provider value="text-popover-foreground">
|
|
28
|
+
<HoverCardPrimitive.Content
|
|
29
|
+
align={align}
|
|
30
|
+
sideOffset={sideOffset}
|
|
31
|
+
className={cn(
|
|
32
|
+
'z-50 w-64 rounded-md border border-border bg-popover p-4 shadow-md shadow-foreground/5 web:outline-none web:cursor-auto data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
33
|
+
open
|
|
34
|
+
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
35
|
+
: 'web:animate-out web:fade-out-0 web:zoom-out-95',
|
|
36
|
+
className,
|
|
37
|
+
)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
</TextClassContext.Provider>
|
|
41
|
+
</Animated.View>
|
|
42
|
+
</HoverCardPrimitive.Overlay>
|
|
43
|
+
</HoverCardPrimitive.Portal>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
package/components/ui/input.tsx
CHANGED