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,288 @@
|
|
|
1
|
+
import * as MenubarPrimitive from '@rn-primitives/menubar';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Platform, Text, type TextProps, View } from 'react-native';
|
|
4
|
+
import { Check } from '../../lib/icons/Check';
|
|
5
|
+
import { ChevronDown } from '../../lib/icons/ChevronDown';
|
|
6
|
+
import { ChevronRight } from '../../lib/icons/ChevronRight';
|
|
7
|
+
import { ChevronUp } from '../../lib/icons/ChevronUp';
|
|
8
|
+
import { cn } from '../../lib/utils';
|
|
9
|
+
import { TextClassContext } from '../../components/ui/text';
|
|
10
|
+
|
|
11
|
+
const MenubarMenu = MenubarPrimitive.Menu;
|
|
12
|
+
|
|
13
|
+
const MenubarGroup = MenubarPrimitive.Group;
|
|
14
|
+
|
|
15
|
+
const MenubarPortal = MenubarPrimitive.Portal;
|
|
16
|
+
|
|
17
|
+
const MenubarSub = MenubarPrimitive.Sub;
|
|
18
|
+
|
|
19
|
+
const MenubarRadioGroup = MenubarPrimitive.RadioGroup;
|
|
20
|
+
|
|
21
|
+
function Menubar({
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}: MenubarPrimitive.RootProps & {
|
|
25
|
+
ref?: React.RefObject<MenubarPrimitive.RootRef>;
|
|
26
|
+
}) {
|
|
27
|
+
return (
|
|
28
|
+
<MenubarPrimitive.Root
|
|
29
|
+
className={cn(
|
|
30
|
+
'flex flex-row h-10 native:h-12 items-center space-x-1 rounded-md border border-border bg-background p-1',
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function MenubarTrigger({
|
|
39
|
+
className,
|
|
40
|
+
...props
|
|
41
|
+
}: MenubarPrimitive.TriggerProps & {
|
|
42
|
+
ref?: React.RefObject<MenubarPrimitive.TriggerRef>;
|
|
43
|
+
}) {
|
|
44
|
+
const { value } = MenubarPrimitive.useRootContext();
|
|
45
|
+
const { value: itemValue } = MenubarPrimitive.useMenuContext();
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<MenubarPrimitive.Trigger
|
|
49
|
+
className={cn(
|
|
50
|
+
'flex flex-row web:cursor-default web:select-none items-center rounded-sm px-3 py-1.5 text-sm native:h-10 native:px-5 native:py-0 font-medium web:outline-none web:focus:bg-accent active:bg-accent web:focus:text-accent-foreground',
|
|
51
|
+
value === itemValue && 'bg-accent text-accent-foreground',
|
|
52
|
+
className,
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function MenubarSubTrigger({
|
|
60
|
+
className,
|
|
61
|
+
inset,
|
|
62
|
+
children,
|
|
63
|
+
...props
|
|
64
|
+
}: MenubarPrimitive.SubTriggerProps & {
|
|
65
|
+
ref?: React.RefObject<MenubarPrimitive.SubTriggerRef>;
|
|
66
|
+
className?: string;
|
|
67
|
+
inset?: boolean;
|
|
68
|
+
children?: React.ReactNode;
|
|
69
|
+
}) {
|
|
70
|
+
const { open } = MenubarPrimitive.useSubContext();
|
|
71
|
+
const Icon =
|
|
72
|
+
Platform.OS === 'web' ? ChevronRight : open ? ChevronUp : ChevronDown;
|
|
73
|
+
return (
|
|
74
|
+
<TextClassContext.Provider
|
|
75
|
+
value={cn(
|
|
76
|
+
'select-none text-sm native:text-lg text-primary',
|
|
77
|
+
open && 'native:text-accent-foreground',
|
|
78
|
+
)}
|
|
79
|
+
>
|
|
80
|
+
<MenubarPrimitive.SubTrigger
|
|
81
|
+
className={cn(
|
|
82
|
+
'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',
|
|
83
|
+
open && 'bg-accent',
|
|
84
|
+
inset && 'pl-8',
|
|
85
|
+
className,
|
|
86
|
+
)}
|
|
87
|
+
{...props}
|
|
88
|
+
>
|
|
89
|
+
{children}
|
|
90
|
+
<Icon size={18} className="ml-auto text-foreground" />
|
|
91
|
+
</MenubarPrimitive.SubTrigger>
|
|
92
|
+
</TextClassContext.Provider>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function MenubarSubContent({
|
|
97
|
+
className,
|
|
98
|
+
...props
|
|
99
|
+
}: MenubarPrimitive.SubContentProps & {
|
|
100
|
+
ref?: React.RefObject<MenubarPrimitive.SubContentRef>;
|
|
101
|
+
}) {
|
|
102
|
+
const { open } = MenubarPrimitive.useSubContext();
|
|
103
|
+
return (
|
|
104
|
+
<MenubarPrimitive.SubContent
|
|
105
|
+
className={cn(
|
|
106
|
+
'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',
|
|
107
|
+
open
|
|
108
|
+
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
109
|
+
: 'web:animate-out web:fade-out-0 web:zoom-out ',
|
|
110
|
+
className,
|
|
111
|
+
)}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function MenubarContent({
|
|
118
|
+
className,
|
|
119
|
+
portalHost,
|
|
120
|
+
...props
|
|
121
|
+
}: MenubarPrimitive.ContentProps & {
|
|
122
|
+
ref?: React.RefObject<MenubarPrimitive.ContentRef>;
|
|
123
|
+
className?: string;
|
|
124
|
+
portalHost?: string;
|
|
125
|
+
}) {
|
|
126
|
+
const { value } = MenubarPrimitive.useRootContext();
|
|
127
|
+
const { value: itemValue } = MenubarPrimitive.useMenuContext();
|
|
128
|
+
return (
|
|
129
|
+
<MenubarPrimitive.Portal hostName={portalHost}>
|
|
130
|
+
<MenubarPrimitive.Content
|
|
131
|
+
className={cn(
|
|
132
|
+
'z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 shadow-md shadow-foreground/5',
|
|
133
|
+
value === itemValue
|
|
134
|
+
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
135
|
+
: 'web:animate-out web:fade-out-0 web:zoom-out-95',
|
|
136
|
+
className,
|
|
137
|
+
)}
|
|
138
|
+
{...props}
|
|
139
|
+
/>
|
|
140
|
+
</MenubarPrimitive.Portal>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function MenubarItem({
|
|
145
|
+
className,
|
|
146
|
+
inset,
|
|
147
|
+
...props
|
|
148
|
+
}: MenubarPrimitive.ItemProps & {
|
|
149
|
+
ref?: React.RefObject<MenubarPrimitive.ItemRef>;
|
|
150
|
+
className?: string;
|
|
151
|
+
inset?: boolean;
|
|
152
|
+
}) {
|
|
153
|
+
return (
|
|
154
|
+
<TextClassContext.Provider value="select-none text-sm native:text-lg text-popover-foreground web:group-focus:text-accent-foreground">
|
|
155
|
+
<MenubarPrimitive.Item
|
|
156
|
+
className={cn(
|
|
157
|
+
'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',
|
|
158
|
+
inset && 'pl-8',
|
|
159
|
+
props.disabled && 'opacity-50 web:pointer-events-none',
|
|
160
|
+
className,
|
|
161
|
+
)}
|
|
162
|
+
{...props}
|
|
163
|
+
/>
|
|
164
|
+
</TextClassContext.Provider>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function MenubarCheckboxItem({
|
|
169
|
+
className,
|
|
170
|
+
children,
|
|
171
|
+
checked,
|
|
172
|
+
...props
|
|
173
|
+
}: MenubarPrimitive.CheckboxItemProps & {
|
|
174
|
+
ref?: React.RefObject<MenubarPrimitive.CheckboxItemRef>;
|
|
175
|
+
children?: React.ReactNode;
|
|
176
|
+
}) {
|
|
177
|
+
return (
|
|
178
|
+
<MenubarPrimitive.CheckboxItem
|
|
179
|
+
className={cn(
|
|
180
|
+
'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',
|
|
181
|
+
props.disabled && 'web:pointer-events-none opacity-50',
|
|
182
|
+
className,
|
|
183
|
+
)}
|
|
184
|
+
checked={checked}
|
|
185
|
+
{...props}
|
|
186
|
+
>
|
|
187
|
+
<View className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
188
|
+
<MenubarPrimitive.ItemIndicator>
|
|
189
|
+
<Check size={14} strokeWidth={3} className="text-foreground" />
|
|
190
|
+
</MenubarPrimitive.ItemIndicator>
|
|
191
|
+
</View>
|
|
192
|
+
{children}
|
|
193
|
+
</MenubarPrimitive.CheckboxItem>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function MenubarRadioItem({
|
|
198
|
+
className,
|
|
199
|
+
children,
|
|
200
|
+
...props
|
|
201
|
+
}: MenubarPrimitive.RadioItemProps & {
|
|
202
|
+
ref?: React.RefObject<MenubarPrimitive.RadioItemRef>;
|
|
203
|
+
children?: React.ReactNode;
|
|
204
|
+
}) {
|
|
205
|
+
return (
|
|
206
|
+
<MenubarPrimitive.RadioItem
|
|
207
|
+
className={cn(
|
|
208
|
+
'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',
|
|
209
|
+
props.disabled && 'web:pointer-events-none opacity-50',
|
|
210
|
+
className,
|
|
211
|
+
)}
|
|
212
|
+
{...props}
|
|
213
|
+
>
|
|
214
|
+
<View className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
215
|
+
<MenubarPrimitive.ItemIndicator>
|
|
216
|
+
<View className="bg-foreground h-2 w-2 rounded-full" />
|
|
217
|
+
</MenubarPrimitive.ItemIndicator>
|
|
218
|
+
</View>
|
|
219
|
+
{children}
|
|
220
|
+
</MenubarPrimitive.RadioItem>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function MenubarLabel({
|
|
225
|
+
className,
|
|
226
|
+
inset,
|
|
227
|
+
...props
|
|
228
|
+
}: MenubarPrimitive.LabelProps & {
|
|
229
|
+
ref?: React.RefObject<MenubarPrimitive.LabelRef>;
|
|
230
|
+
className?: string;
|
|
231
|
+
inset?: boolean;
|
|
232
|
+
}) {
|
|
233
|
+
return (
|
|
234
|
+
<MenubarPrimitive.Label
|
|
235
|
+
className={cn(
|
|
236
|
+
'px-2 py-1.5 text-sm native:text-base font-semibold text-foreground web:cursor-default',
|
|
237
|
+
inset && 'pl-8',
|
|
238
|
+
className,
|
|
239
|
+
)}
|
|
240
|
+
{...props}
|
|
241
|
+
/>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function MenubarSeparator({
|
|
246
|
+
className,
|
|
247
|
+
...props
|
|
248
|
+
}: MenubarPrimitive.SeparatorProps & {
|
|
249
|
+
ref?: React.RefObject<MenubarPrimitive.SeparatorRef>;
|
|
250
|
+
}) {
|
|
251
|
+
return (
|
|
252
|
+
<MenubarPrimitive.Separator
|
|
253
|
+
className={cn('-mx-1 my-1 h-px bg-border', className)}
|
|
254
|
+
{...props}
|
|
255
|
+
/>
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function MenubarShortcut({ className, ...props }: TextProps) {
|
|
260
|
+
return (
|
|
261
|
+
<Text
|
|
262
|
+
className={cn(
|
|
263
|
+
'ml-auto text-xs native:text-sm tracking-widest text-muted-foreground',
|
|
264
|
+
className,
|
|
265
|
+
)}
|
|
266
|
+
{...props}
|
|
267
|
+
/>
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export {
|
|
272
|
+
Menubar,
|
|
273
|
+
MenubarCheckboxItem,
|
|
274
|
+
MenubarContent,
|
|
275
|
+
MenubarGroup,
|
|
276
|
+
MenubarItem,
|
|
277
|
+
MenubarLabel,
|
|
278
|
+
MenubarMenu,
|
|
279
|
+
MenubarPortal,
|
|
280
|
+
MenubarRadioGroup,
|
|
281
|
+
MenubarRadioItem,
|
|
282
|
+
MenubarSeparator,
|
|
283
|
+
MenubarShortcut,
|
|
284
|
+
MenubarSub,
|
|
285
|
+
MenubarSubContent,
|
|
286
|
+
MenubarSubTrigger,
|
|
287
|
+
MenubarTrigger,
|
|
288
|
+
};
|
|
@@ -11,8 +11,8 @@ import Animated, {
|
|
|
11
11
|
useDerivedValue,
|
|
12
12
|
withTiming,
|
|
13
13
|
} from 'react-native-reanimated';
|
|
14
|
-
import { ChevronDown } from '
|
|
15
|
-
import { cn } from '
|
|
14
|
+
import { ChevronDown } from '../../lib/icons/ChevronDown';
|
|
15
|
+
import { cn } from '../../lib/utils';
|
|
16
16
|
|
|
17
17
|
function NavigationMenu({
|
|
18
18
|
className,
|
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import * as PopoverPrimitive from '@rn-primitives/popover';
|
|
3
3
|
import { Platform, StyleSheet } from 'react-native';
|
|
4
4
|
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
5
|
-
import { cn } from '
|
|
6
|
-
import { TextClassContext } from '
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { TextClassContext } from '../../components/ui/text';
|
|
7
7
|
|
|
8
8
|
const Popover = PopoverPrimitive.Root;
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
2
|
import * as RadioGroupPrimitive from '@rn-primitives/radio-group';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
|
-
import { cn } from '
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
5
|
import { Label } from './label';
|
|
6
6
|
|
|
7
7
|
function RadioGroup({
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import * as SelectPrimitive from '@rn-primitives/select';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Platform, StyleSheet, View } from 'react-native';
|
|
4
|
+
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
5
|
+
import { Check } from '../../lib/icons/Check';
|
|
6
|
+
import { ChevronDown } from '../../lib/icons/ChevronDown';
|
|
7
|
+
import { ChevronUp } from '../../lib/icons/ChevronUp';
|
|
8
|
+
import { cn } from '../../lib/utils';
|
|
9
|
+
|
|
10
|
+
type Option = SelectPrimitive.Option;
|
|
11
|
+
|
|
12
|
+
const Select = SelectPrimitive.Root;
|
|
13
|
+
|
|
14
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
15
|
+
|
|
16
|
+
const SelectValue = SelectPrimitive.Value;
|
|
17
|
+
|
|
18
|
+
function SelectTrigger({
|
|
19
|
+
ref,
|
|
20
|
+
className,
|
|
21
|
+
children,
|
|
22
|
+
...props
|
|
23
|
+
}: SelectPrimitive.TriggerProps & {
|
|
24
|
+
ref?: React.RefObject<SelectPrimitive.TriggerRef>;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
}) {
|
|
27
|
+
return (
|
|
28
|
+
<SelectPrimitive.Trigger
|
|
29
|
+
ref={ref}
|
|
30
|
+
className={cn(
|
|
31
|
+
'flex flex-row h-10 native:h-12 items-center text-sm justify-between rounded-md border border-input bg-background px-3 py-2 web:ring-offset-background text-muted-foreground web:focus:outline-none web:focus:ring-2 web:focus:ring-ring web:focus:ring-offset-2 [&>span]:line-clamp-1',
|
|
32
|
+
props.disabled && 'web:cursor-not-allowed opacity-50',
|
|
33
|
+
className,
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
<ChevronDown
|
|
39
|
+
size={16}
|
|
40
|
+
aria-hidden={true}
|
|
41
|
+
className="text-foreground opacity-50"
|
|
42
|
+
/>
|
|
43
|
+
</SelectPrimitive.Trigger>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Platform: WEB ONLY
|
|
49
|
+
*/
|
|
50
|
+
function SelectScrollUpButton({
|
|
51
|
+
className,
|
|
52
|
+
...props
|
|
53
|
+
}: SelectPrimitive.ScrollUpButtonProps) {
|
|
54
|
+
if (Platform.OS !== 'web') {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return (
|
|
58
|
+
<SelectPrimitive.ScrollUpButton
|
|
59
|
+
className={cn(
|
|
60
|
+
'flex web:cursor-default items-center justify-center py-1',
|
|
61
|
+
className,
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
>
|
|
65
|
+
<ChevronUp size={14} className="text-foreground" />
|
|
66
|
+
</SelectPrimitive.ScrollUpButton>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Platform: WEB ONLY
|
|
72
|
+
*/
|
|
73
|
+
function SelectScrollDownButton({
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
}: SelectPrimitive.ScrollDownButtonProps) {
|
|
77
|
+
if (Platform.OS !== 'web') {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
return (
|
|
81
|
+
<SelectPrimitive.ScrollDownButton
|
|
82
|
+
className={cn(
|
|
83
|
+
'flex web:cursor-default items-center justify-center py-1',
|
|
84
|
+
className,
|
|
85
|
+
)}
|
|
86
|
+
{...props}
|
|
87
|
+
>
|
|
88
|
+
<ChevronDown size={14} className="text-foreground" />
|
|
89
|
+
</SelectPrimitive.ScrollDownButton>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function SelectContent({
|
|
94
|
+
className,
|
|
95
|
+
children,
|
|
96
|
+
position = 'popper',
|
|
97
|
+
portalHost,
|
|
98
|
+
...props
|
|
99
|
+
}: SelectPrimitive.ContentProps & {
|
|
100
|
+
ref?: React.RefObject<SelectPrimitive.ContentRef>;
|
|
101
|
+
className?: string;
|
|
102
|
+
portalHost?: string;
|
|
103
|
+
}) {
|
|
104
|
+
const { open } = SelectPrimitive.useRootContext();
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<SelectPrimitive.Portal hostName={portalHost}>
|
|
108
|
+
<SelectPrimitive.Overlay
|
|
109
|
+
style={Platform.OS !== 'web' ? StyleSheet.absoluteFill : undefined}
|
|
110
|
+
>
|
|
111
|
+
<Animated.View className="z-50" entering={FadeIn} exiting={FadeOut}>
|
|
112
|
+
<SelectPrimitive.Content
|
|
113
|
+
className={cn(
|
|
114
|
+
'relative z-50 max-h-96 min-w-[8rem] rounded-md border border-border bg-popover shadow-md shadow-foreground/10 py-2 px-1 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',
|
|
115
|
+
position === 'popper' &&
|
|
116
|
+
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
117
|
+
open
|
|
118
|
+
? 'web:zoom-in-95 web:animate-in web:fade-in-0'
|
|
119
|
+
: 'web:zoom-out-95 web:animate-out web:fade-out-0',
|
|
120
|
+
className,
|
|
121
|
+
)}
|
|
122
|
+
position={position}
|
|
123
|
+
{...props}
|
|
124
|
+
>
|
|
125
|
+
<SelectScrollUpButton />
|
|
126
|
+
<SelectPrimitive.Viewport
|
|
127
|
+
className={cn(
|
|
128
|
+
'p-1',
|
|
129
|
+
position === 'popper' &&
|
|
130
|
+
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]',
|
|
131
|
+
)}
|
|
132
|
+
>
|
|
133
|
+
{children}
|
|
134
|
+
</SelectPrimitive.Viewport>
|
|
135
|
+
<SelectScrollDownButton />
|
|
136
|
+
</SelectPrimitive.Content>
|
|
137
|
+
</Animated.View>
|
|
138
|
+
</SelectPrimitive.Overlay>
|
|
139
|
+
</SelectPrimitive.Portal>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function SelectLabel({
|
|
144
|
+
className,
|
|
145
|
+
...props
|
|
146
|
+
}: SelectPrimitive.LabelProps & {
|
|
147
|
+
ref?: React.RefObject<SelectPrimitive.LabelRef>;
|
|
148
|
+
}) {
|
|
149
|
+
return (
|
|
150
|
+
<SelectPrimitive.Label
|
|
151
|
+
className={cn(
|
|
152
|
+
'py-1.5 native:pb-2 pl-8 native:pl-10 pr-2 text-popover-foreground text-sm native:text-base font-semibold',
|
|
153
|
+
className,
|
|
154
|
+
)}
|
|
155
|
+
{...props}
|
|
156
|
+
/>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function SelectItem({
|
|
161
|
+
className,
|
|
162
|
+
...props
|
|
163
|
+
}: SelectPrimitive.ItemProps & {
|
|
164
|
+
ref?: React.RefObject<SelectPrimitive.ItemRef>;
|
|
165
|
+
}) {
|
|
166
|
+
return (
|
|
167
|
+
<SelectPrimitive.Item
|
|
168
|
+
className={cn(
|
|
169
|
+
'relative web:group flex flex-row w-full web:cursor-default web:select-none items-center rounded-sm py-1.5 native:py-2 pl-8 native:pl-10 pr-2 web:hover:bg-accent/50 active:bg-accent web:outline-none web:focus:bg-accent',
|
|
170
|
+
props.disabled && 'web:pointer-events-none opacity-50',
|
|
171
|
+
className,
|
|
172
|
+
)}
|
|
173
|
+
{...props}
|
|
174
|
+
>
|
|
175
|
+
<View className="absolute left-2 native:left-3.5 flex h-3.5 native:pt-px w-3.5 items-center justify-center">
|
|
176
|
+
<SelectPrimitive.ItemIndicator>
|
|
177
|
+
<Check
|
|
178
|
+
size={16}
|
|
179
|
+
strokeWidth={3}
|
|
180
|
+
className="text-popover-foreground"
|
|
181
|
+
/>
|
|
182
|
+
</SelectPrimitive.ItemIndicator>
|
|
183
|
+
</View>
|
|
184
|
+
<SelectPrimitive.ItemText className="text-sm native:text-lg text-popover-foreground native:text-base web:group-focus:text-accent-foreground" />
|
|
185
|
+
</SelectPrimitive.Item>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function SelectSeparator({
|
|
190
|
+
className,
|
|
191
|
+
...props
|
|
192
|
+
}: SelectPrimitive.SeparatorProps & {
|
|
193
|
+
ref?: React.RefObject<SelectPrimitive.SeparatorRef>;
|
|
194
|
+
}) {
|
|
195
|
+
return (
|
|
196
|
+
<SelectPrimitive.Separator
|
|
197
|
+
className={cn('-mx-1 my-1 h-px bg-muted', className)}
|
|
198
|
+
{...props}
|
|
199
|
+
/>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export {
|
|
204
|
+
Select,
|
|
205
|
+
SelectContent,
|
|
206
|
+
SelectGroup,
|
|
207
|
+
SelectItem,
|
|
208
|
+
SelectLabel,
|
|
209
|
+
SelectScrollDownButton,
|
|
210
|
+
SelectScrollUpButton,
|
|
211
|
+
SelectSeparator,
|
|
212
|
+
SelectTrigger,
|
|
213
|
+
SelectValue,
|
|
214
|
+
type Option,
|
|
215
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as SeparatorPrimitive from '@rn-primitives/separator';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
4
|
|
|
5
5
|
function Separator({
|
|
6
6
|
className,
|
|
@@ -17,7 +17,7 @@ function Separator({
|
|
|
17
17
|
className={cn(
|
|
18
18
|
'shrink-0 bg-border',
|
|
19
19
|
orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',
|
|
20
|
-
className
|
|
20
|
+
className,
|
|
21
21
|
)}
|
|
22
22
|
{...props}
|
|
23
23
|
/>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Animated, {
|
|
3
|
+
useAnimatedStyle,
|
|
4
|
+
useSharedValue,
|
|
5
|
+
withRepeat,
|
|
6
|
+
withSequence,
|
|
7
|
+
withTiming,
|
|
8
|
+
} from 'react-native-reanimated';
|
|
9
|
+
import { cn } from '../../lib/utils';
|
|
10
|
+
|
|
11
|
+
const duration = 1000;
|
|
12
|
+
|
|
13
|
+
function Skeleton({
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}: Omit<React.ComponentPropsWithoutRef<typeof Animated.View>, 'style'>) {
|
|
17
|
+
const sv = useSharedValue(1);
|
|
18
|
+
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
sv.value = withRepeat(
|
|
21
|
+
withSequence(withTiming(0.5, { duration }), withTiming(1, { duration })),
|
|
22
|
+
-1,
|
|
23
|
+
);
|
|
24
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
const style = useAnimatedStyle(() => ({
|
|
28
|
+
opacity: sv.value,
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Animated.View
|
|
33
|
+
style={style}
|
|
34
|
+
className={cn('rounded-md bg-secondary dark:bg-muted', className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { Skeleton };
|
package/components/ui/switch.tsx
CHANGED