@munchi_oy/native-ui 0.1.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/dist/index.d.mts +568 -0
- package/dist/index.d.ts +568 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/global.css +53 -0
- package/nativewind-env.d.ts +2 -0
- package/package.json +88 -0
- package/src/MAlert.tsx +38 -0
- package/src/MAnimation.tsx +55 -0
- package/src/MAvatar.tsx +111 -0
- package/src/MBadge.tsx +72 -0
- package/src/MButton.tsx +90 -0
- package/src/MCard.tsx +15 -0
- package/src/MChevron.tsx +47 -0
- package/src/MConfirmation.tsx +68 -0
- package/src/MCountDown.tsx +120 -0
- package/src/MDateTimePicker.tsx +124 -0
- package/src/MDivider.tsx +69 -0
- package/src/MDrawerRightPanel.tsx +187 -0
- package/src/MDropdown.tsx +277 -0
- package/src/MInput.tsx +162 -0
- package/src/MLabel.tsx +3 -0
- package/src/MLucideIcon.tsx +21 -0
- package/src/MModal.tsx +287 -0
- package/src/MNativeAlert.tsx +33 -0
- package/src/MNumpad.tsx +520 -0
- package/src/MPicker.tsx +150 -0
- package/src/MPinPadKeys.tsx +104 -0
- package/src/MPortal.tsx +4 -0
- package/src/MProgressBar.tsx +74 -0
- package/src/MRadioGroup.tsx +4 -0
- package/src/MRequiredLabel.tsx +21 -0
- package/src/MResponsiveContainer.tsx +74 -0
- package/src/MSearch.tsx +138 -0
- package/src/MSelector.tsx +48 -0
- package/src/MSkeleton.tsx +3 -0
- package/src/MSwitch.tsx +13 -0
- package/src/MTable.tsx +17 -0
- package/src/MTabs.tsx +198 -0
- package/src/MText.tsx +51 -0
- package/src/MTimerUp.tsx +88 -0
- package/src/MToggle.tsx +51 -0
- package/src/constants.ts +19 -0
- package/src/hooks/useColorScheme.tsx +12 -0
- package/src/hooks/useIconColors.ts +19 -0
- package/src/index.ts +124 -0
- package/src/primitives/accordion.tsx +143 -0
- package/src/primitives/alert-dialog.tsx +181 -0
- package/src/primitives/alert.tsx +94 -0
- package/src/primitives/aspect-ratio.tsx +5 -0
- package/src/primitives/avatar.tsx +47 -0
- package/src/primitives/badge.tsx +57 -0
- package/src/primitives/button.tsx +92 -0
- package/src/primitives/card.tsx +86 -0
- package/src/primitives/checkbox.tsx +35 -0
- package/src/primitives/collapsible.tsx +9 -0
- package/src/primitives/context-menu.tsx +255 -0
- package/src/primitives/dialog.tsx +166 -0
- package/src/primitives/dropdown-menu.tsx +264 -0
- package/src/primitives/hover-card.tsx +45 -0
- package/src/primitives/input.tsx +25 -0
- package/src/primitives/label.tsx +33 -0
- package/src/primitives/menubar.tsx +266 -0
- package/src/primitives/navigation-menu.tsx +192 -0
- package/src/primitives/popover.tsx +46 -0
- package/src/primitives/progress.tsx +82 -0
- package/src/primitives/radio-group.tsx +42 -0
- package/src/primitives/select.tsx +192 -0
- package/src/primitives/separator.tsx +28 -0
- package/src/primitives/skeleton.tsx +39 -0
- package/src/primitives/switch.tsx +102 -0
- package/src/primitives/table.tsx +107 -0
- package/src/primitives/tabs.tsx +66 -0
- package/src/primitives/text.tsx +28 -0
- package/src/primitives/textarea.tsx +39 -0
- package/src/primitives/toggle-group.tsx +89 -0
- package/src/primitives/toggle.tsx +91 -0
- package/src/primitives/tooltip.tsx +40 -0
- package/src/primitives/typography.tsx +214 -0
- package/src/theme.ts +43 -0
- package/src/tokens.ts +7 -0
- package/src/utils.ts +14 -0
- package/tailwind.config.ts +112 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import * as DialogPrimitive from "@rn-primitives/dialog";
|
|
2
|
+
import { X } from "lucide-react-native";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Platform, StyleSheet, View, type ViewProps } from "react-native";
|
|
5
|
+
import Animated, { FadeIn, FadeOut } from "react-native-reanimated";
|
|
6
|
+
import { cn } from "../utils";
|
|
7
|
+
|
|
8
|
+
const Dialog = DialogPrimitive.Root;
|
|
9
|
+
|
|
10
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
11
|
+
|
|
12
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
13
|
+
|
|
14
|
+
const DialogClose = DialogPrimitive.Close;
|
|
15
|
+
|
|
16
|
+
const DialogOverlayWeb = React.forwardRef<
|
|
17
|
+
DialogPrimitive.OverlayRef,
|
|
18
|
+
DialogPrimitive.OverlayProps
|
|
19
|
+
>(({ className, ...props }, ref) => {
|
|
20
|
+
const { open } = DialogPrimitive.useRootContext();
|
|
21
|
+
return (
|
|
22
|
+
<DialogPrimitive.Overlay
|
|
23
|
+
className={cn(
|
|
24
|
+
"bg-black/80 flex justify-center items-center p-2 absolute top-0 right-0 bottom-0 left-0",
|
|
25
|
+
open
|
|
26
|
+
? "web:animate-in web:fade-in-0"
|
|
27
|
+
: "web:animate-out web:fade-out-0",
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
ref={ref}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
DialogOverlayWeb.displayName = "DialogOverlayWeb";
|
|
37
|
+
|
|
38
|
+
const DialogOverlayNative = React.forwardRef<
|
|
39
|
+
DialogPrimitive.OverlayRef,
|
|
40
|
+
DialogPrimitive.OverlayProps
|
|
41
|
+
>(({ className, children, ...props }, ref) => {
|
|
42
|
+
return (
|
|
43
|
+
<DialogPrimitive.Overlay
|
|
44
|
+
style={StyleSheet.absoluteFill}
|
|
45
|
+
className={cn(
|
|
46
|
+
"flex bg-black/80 justify-center items-center p-2",
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
ref={ref}
|
|
51
|
+
>
|
|
52
|
+
<Animated.View
|
|
53
|
+
entering={FadeIn.duration(150)}
|
|
54
|
+
exiting={FadeOut.duration(150)}
|
|
55
|
+
>
|
|
56
|
+
<>{children}</>
|
|
57
|
+
</Animated.View>
|
|
58
|
+
</DialogPrimitive.Overlay>
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
DialogOverlayNative.displayName = "DialogOverlayNative";
|
|
63
|
+
|
|
64
|
+
const DialogOverlay = Platform.select({
|
|
65
|
+
web: DialogOverlayWeb,
|
|
66
|
+
default: DialogOverlayNative
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const DialogContent = React.forwardRef<
|
|
70
|
+
DialogPrimitive.ContentRef,
|
|
71
|
+
DialogPrimitive.ContentProps & { portalHost?: string }
|
|
72
|
+
>(({ className, children, portalHost, ...props }, ref) => {
|
|
73
|
+
const { open } = DialogPrimitive.useRootContext();
|
|
74
|
+
return (
|
|
75
|
+
<DialogPortal hostName={portalHost}>
|
|
76
|
+
<DialogOverlay>
|
|
77
|
+
<DialogPrimitive.Content
|
|
78
|
+
ref={ref}
|
|
79
|
+
className={cn(
|
|
80
|
+
"max-w-lg gap-4 border border-border web:cursor-default bg-background p-6 shadow-lg web:duration-200 rounded-lg",
|
|
81
|
+
open
|
|
82
|
+
? "web:animate-in web:fade-in-0 web:zoom-in-95"
|
|
83
|
+
: "web:animate-out web:fade-out-0 web:zoom-out-95",
|
|
84
|
+
className
|
|
85
|
+
)}
|
|
86
|
+
{...props}
|
|
87
|
+
>
|
|
88
|
+
{children}
|
|
89
|
+
<DialogPrimitive.Close
|
|
90
|
+
className={
|
|
91
|
+
"absolute right-4 top-4 p-0.5 web:group rounded-sm opacity-70 web:ring-offset-background web:transition-opacity web:hover:opacity-100 web:focus:outline-none web:focus:ring-2 web:focus:ring-ring web:focus:ring-offset-2 web:disabled:pointer-events-none"
|
|
92
|
+
}
|
|
93
|
+
>
|
|
94
|
+
<X
|
|
95
|
+
size={Platform.OS === "web" ? 16 : 18}
|
|
96
|
+
className={cn(
|
|
97
|
+
"text-muted-foreground",
|
|
98
|
+
open && "text-accent-foreground"
|
|
99
|
+
)}
|
|
100
|
+
/>
|
|
101
|
+
</DialogPrimitive.Close>
|
|
102
|
+
</DialogPrimitive.Content>
|
|
103
|
+
</DialogOverlay>
|
|
104
|
+
</DialogPortal>
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
108
|
+
|
|
109
|
+
const DialogHeader = ({ className, ...props }: ViewProps) => (
|
|
110
|
+
<View
|
|
111
|
+
className={cn("flex flex-col gap-1.5 text-center sm:text-left", className)}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
);
|
|
115
|
+
DialogHeader.displayName = "DialogHeader";
|
|
116
|
+
|
|
117
|
+
const DialogFooter = ({ className, ...props }: ViewProps) => (
|
|
118
|
+
<View
|
|
119
|
+
className={cn(
|
|
120
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end gap-2",
|
|
121
|
+
className
|
|
122
|
+
)}
|
|
123
|
+
{...props}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
DialogFooter.displayName = "DialogFooter";
|
|
127
|
+
|
|
128
|
+
const DialogTitle = React.forwardRef<
|
|
129
|
+
DialogPrimitive.TitleRef,
|
|
130
|
+
DialogPrimitive.TitleProps
|
|
131
|
+
>(({ className, ...props }, ref) => (
|
|
132
|
+
<DialogPrimitive.Title
|
|
133
|
+
ref={ref}
|
|
134
|
+
className={cn(
|
|
135
|
+
"text-lg native:text-xl text-foreground font-semibold leading-none tracking-tight",
|
|
136
|
+
className
|
|
137
|
+
)}
|
|
138
|
+
{...props}
|
|
139
|
+
/>
|
|
140
|
+
));
|
|
141
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
142
|
+
|
|
143
|
+
const DialogDescription = React.forwardRef<
|
|
144
|
+
DialogPrimitive.DescriptionRef,
|
|
145
|
+
DialogPrimitive.DescriptionProps
|
|
146
|
+
>(({ className, ...props }, ref) => (
|
|
147
|
+
<DialogPrimitive.Description
|
|
148
|
+
ref={ref}
|
|
149
|
+
className={cn("text-sm native:text-base text-muted-foreground", className)}
|
|
150
|
+
{...props}
|
|
151
|
+
/>
|
|
152
|
+
));
|
|
153
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
154
|
+
|
|
155
|
+
export {
|
|
156
|
+
Dialog,
|
|
157
|
+
DialogClose,
|
|
158
|
+
DialogContent,
|
|
159
|
+
DialogDescription,
|
|
160
|
+
DialogFooter,
|
|
161
|
+
DialogHeader,
|
|
162
|
+
DialogOverlay,
|
|
163
|
+
DialogPortal,
|
|
164
|
+
DialogTitle,
|
|
165
|
+
DialogTrigger
|
|
166
|
+
};
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import * as DropdownMenuPrimitive from "@rn-primitives/dropdown-menu";
|
|
2
|
+
import {
|
|
3
|
+
Check,
|
|
4
|
+
ChevronDown,
|
|
5
|
+
ChevronRight,
|
|
6
|
+
ChevronUp
|
|
7
|
+
} from "lucide-react-native";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import {
|
|
10
|
+
Platform,
|
|
11
|
+
type StyleProp,
|
|
12
|
+
StyleSheet,
|
|
13
|
+
Text,
|
|
14
|
+
type TextProps,
|
|
15
|
+
View,
|
|
16
|
+
type ViewProps,
|
|
17
|
+
type ViewStyle
|
|
18
|
+
} from "react-native";
|
|
19
|
+
import { cn } from "../utils";
|
|
20
|
+
import { TextClassContext } from "./text";
|
|
21
|
+
|
|
22
|
+
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
23
|
+
|
|
24
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
25
|
+
|
|
26
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
27
|
+
|
|
28
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
29
|
+
|
|
30
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
31
|
+
|
|
32
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
33
|
+
|
|
34
|
+
const DropdownMenuSubTrigger = React.forwardRef<
|
|
35
|
+
DropdownMenuPrimitive.SubTriggerRef,
|
|
36
|
+
DropdownMenuPrimitive.SubTriggerProps & {
|
|
37
|
+
inset?: boolean;
|
|
38
|
+
}
|
|
39
|
+
>(({ className, inset, children, ...props }, ref) => {
|
|
40
|
+
const { open } = DropdownMenuPrimitive.useSubContext();
|
|
41
|
+
const Icon =
|
|
42
|
+
Platform.OS === "web" ? ChevronRight : open ? ChevronUp : ChevronDown;
|
|
43
|
+
return (
|
|
44
|
+
<TextClassContext.Provider
|
|
45
|
+
value={cn(
|
|
46
|
+
"select-none text-sm native:text-lg text-primary",
|
|
47
|
+
open && "native:text-accent-foreground"
|
|
48
|
+
)}
|
|
49
|
+
>
|
|
50
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
51
|
+
ref={ref}
|
|
52
|
+
className={cn(
|
|
53
|
+
"flex flex-row web:cursor-default web:select-none gap-2 items-center web:focus:bg-accent web:hover:bg-accent active:bg-accent rounded-sm px-2 py-1.5 native:py-2 web:outline-none",
|
|
54
|
+
open && "bg-accent",
|
|
55
|
+
inset && "pl-8",
|
|
56
|
+
className
|
|
57
|
+
)}
|
|
58
|
+
{...props}
|
|
59
|
+
>
|
|
60
|
+
<>{children}</>
|
|
61
|
+
<Icon size={18} className="ml-auto text-foreground" />
|
|
62
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
63
|
+
</TextClassContext.Provider>
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
DropdownMenuSubTrigger.displayName =
|
|
67
|
+
DropdownMenuPrimitive.SubTrigger.displayName;
|
|
68
|
+
|
|
69
|
+
const DropdownMenuSubContent = React.forwardRef<
|
|
70
|
+
DropdownMenuPrimitive.SubContentRef,
|
|
71
|
+
DropdownMenuPrimitive.SubContentProps
|
|
72
|
+
>(({ className, ...props }, ref) => {
|
|
73
|
+
const { open } = DropdownMenuPrimitive.useSubContext();
|
|
74
|
+
return (
|
|
75
|
+
<DropdownMenuPrimitive.SubContent
|
|
76
|
+
ref={ref}
|
|
77
|
+
className={cn(
|
|
78
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-border mt-1 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",
|
|
79
|
+
open
|
|
80
|
+
? "web:animate-in web:fade-in-0 web:zoom-in-95"
|
|
81
|
+
: "web:animate-out web:fade-out-0 web:zoom-out",
|
|
82
|
+
className
|
|
83
|
+
)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
DropdownMenuSubContent.displayName = "DropdownMenuSubContent";
|
|
89
|
+
|
|
90
|
+
const DropdownMenuContent = React.forwardRef<
|
|
91
|
+
DropdownMenuPrimitive.ContentRef,
|
|
92
|
+
DropdownMenuPrimitive.ContentProps & {
|
|
93
|
+
overlayStyle?: StyleProp<ViewStyle>;
|
|
94
|
+
overlayClassName?: ViewProps["className"];
|
|
95
|
+
portalHost?: string;
|
|
96
|
+
}
|
|
97
|
+
>(
|
|
98
|
+
(
|
|
99
|
+
{ className, overlayClassName, overlayStyle, portalHost, ...props },
|
|
100
|
+
ref
|
|
101
|
+
) => {
|
|
102
|
+
const { open } = DropdownMenuPrimitive.useRootContext();
|
|
103
|
+
return (
|
|
104
|
+
<DropdownMenuPrimitive.Portal hostName={portalHost}>
|
|
105
|
+
<DropdownMenuPrimitive.Overlay
|
|
106
|
+
style={
|
|
107
|
+
overlayStyle
|
|
108
|
+
? StyleSheet.flatten([
|
|
109
|
+
Platform.OS !== "web" ? StyleSheet.absoluteFill : undefined,
|
|
110
|
+
overlayStyle
|
|
111
|
+
])
|
|
112
|
+
: Platform.OS !== "web"
|
|
113
|
+
? StyleSheet.absoluteFill
|
|
114
|
+
: undefined
|
|
115
|
+
}
|
|
116
|
+
className={overlayClassName}
|
|
117
|
+
>
|
|
118
|
+
<DropdownMenuPrimitive.Content
|
|
119
|
+
ref={ref}
|
|
120
|
+
className={cn(
|
|
121
|
+
"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",
|
|
122
|
+
open
|
|
123
|
+
? "web:animate-in web:fade-in-0 web:zoom-in-95"
|
|
124
|
+
: "web:animate-out web:fade-out-0 web:zoom-out-95",
|
|
125
|
+
className
|
|
126
|
+
)}
|
|
127
|
+
{...props}
|
|
128
|
+
/>
|
|
129
|
+
</DropdownMenuPrimitive.Overlay>
|
|
130
|
+
</DropdownMenuPrimitive.Portal>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
135
|
+
|
|
136
|
+
const DropdownMenuItem = React.forwardRef<
|
|
137
|
+
DropdownMenuPrimitive.ItemRef,
|
|
138
|
+
DropdownMenuPrimitive.ItemProps & {
|
|
139
|
+
inset?: boolean;
|
|
140
|
+
}
|
|
141
|
+
>(({ className, inset, ...props }, ref) => (
|
|
142
|
+
<TextClassContext.Provider value="select-none text-sm native:text-lg text-popover-foreground web:group-focus:text-accent-foreground">
|
|
143
|
+
<DropdownMenuPrimitive.Item
|
|
144
|
+
ref={ref}
|
|
145
|
+
className={cn(
|
|
146
|
+
"relative flex flex-row web:cursor-default gap-2 items-center 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",
|
|
147
|
+
inset && "pl-8",
|
|
148
|
+
props.disabled && "opacity-50 web:pointer-events-none",
|
|
149
|
+
className
|
|
150
|
+
)}
|
|
151
|
+
{...props}
|
|
152
|
+
/>
|
|
153
|
+
</TextClassContext.Provider>
|
|
154
|
+
));
|
|
155
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
156
|
+
|
|
157
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
158
|
+
DropdownMenuPrimitive.CheckboxItemRef,
|
|
159
|
+
DropdownMenuPrimitive.CheckboxItemProps
|
|
160
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
161
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
162
|
+
ref={ref}
|
|
163
|
+
className={cn(
|
|
164
|
+
"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",
|
|
165
|
+
props.disabled && "web:pointer-events-none opacity-50",
|
|
166
|
+
className
|
|
167
|
+
)}
|
|
168
|
+
checked={checked}
|
|
169
|
+
{...props}
|
|
170
|
+
>
|
|
171
|
+
<View className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
172
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
173
|
+
<Check size={14} strokeWidth={3} className="text-foreground" />
|
|
174
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
175
|
+
</View>
|
|
176
|
+
<>{children}</>
|
|
177
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
178
|
+
));
|
|
179
|
+
DropdownMenuCheckboxItem.displayName =
|
|
180
|
+
DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
181
|
+
|
|
182
|
+
const DropdownMenuRadioItem = React.forwardRef<
|
|
183
|
+
DropdownMenuPrimitive.RadioItemRef,
|
|
184
|
+
DropdownMenuPrimitive.RadioItemProps
|
|
185
|
+
>(({ className, children, ...props }, ref) => (
|
|
186
|
+
<DropdownMenuPrimitive.RadioItem
|
|
187
|
+
ref={ref}
|
|
188
|
+
className={cn(
|
|
189
|
+
"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",
|
|
190
|
+
props.disabled && "web:pointer-events-none opacity-50",
|
|
191
|
+
className
|
|
192
|
+
)}
|
|
193
|
+
{...props}
|
|
194
|
+
>
|
|
195
|
+
<View className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
196
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
197
|
+
<View className="bg-foreground h-2 w-2 rounded-full" />
|
|
198
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
199
|
+
</View>
|
|
200
|
+
<>{children}</>
|
|
201
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
202
|
+
));
|
|
203
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
204
|
+
|
|
205
|
+
const DropdownMenuLabel = React.forwardRef<
|
|
206
|
+
DropdownMenuPrimitive.LabelRef,
|
|
207
|
+
DropdownMenuPrimitive.LabelProps & {
|
|
208
|
+
inset?: boolean;
|
|
209
|
+
}
|
|
210
|
+
>(({ className, inset, ...props }, ref) => (
|
|
211
|
+
<DropdownMenuPrimitive.Label
|
|
212
|
+
ref={ref}
|
|
213
|
+
className={cn(
|
|
214
|
+
"px-2 py-1.5 text-sm native:text-base font-semibold text-foreground web:cursor-default",
|
|
215
|
+
inset && "pl-8",
|
|
216
|
+
className
|
|
217
|
+
)}
|
|
218
|
+
{...props}
|
|
219
|
+
/>
|
|
220
|
+
));
|
|
221
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
222
|
+
|
|
223
|
+
const DropdownMenuSeparator = React.forwardRef<
|
|
224
|
+
DropdownMenuPrimitive.SeparatorRef,
|
|
225
|
+
DropdownMenuPrimitive.SeparatorProps
|
|
226
|
+
>(({ className, ...props }, ref) => (
|
|
227
|
+
<DropdownMenuPrimitive.Separator
|
|
228
|
+
ref={ref}
|
|
229
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
230
|
+
{...props}
|
|
231
|
+
/>
|
|
232
|
+
));
|
|
233
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
234
|
+
|
|
235
|
+
const DropdownMenuShortcut = ({ className, ...props }: TextProps) => {
|
|
236
|
+
return (
|
|
237
|
+
<Text
|
|
238
|
+
className={cn(
|
|
239
|
+
"ml-auto text-xs native:text-sm tracking-widest text-muted-foreground",
|
|
240
|
+
className
|
|
241
|
+
)}
|
|
242
|
+
{...props}
|
|
243
|
+
/>
|
|
244
|
+
);
|
|
245
|
+
};
|
|
246
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
247
|
+
|
|
248
|
+
export {
|
|
249
|
+
DropdownMenu,
|
|
250
|
+
DropdownMenuCheckboxItem,
|
|
251
|
+
DropdownMenuContent,
|
|
252
|
+
DropdownMenuGroup,
|
|
253
|
+
DropdownMenuItem,
|
|
254
|
+
DropdownMenuLabel,
|
|
255
|
+
DropdownMenuPortal,
|
|
256
|
+
DropdownMenuRadioGroup,
|
|
257
|
+
DropdownMenuRadioItem,
|
|
258
|
+
DropdownMenuSeparator,
|
|
259
|
+
DropdownMenuShortcut,
|
|
260
|
+
DropdownMenuSub,
|
|
261
|
+
DropdownMenuSubContent,
|
|
262
|
+
DropdownMenuSubTrigger,
|
|
263
|
+
DropdownMenuTrigger
|
|
264
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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 "../utils";
|
|
6
|
+
import { TextClassContext } from "./text";
|
|
7
|
+
|
|
8
|
+
const HoverCard = HoverCardPrimitive.Root;
|
|
9
|
+
|
|
10
|
+
const HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
11
|
+
|
|
12
|
+
const HoverCardContent = React.forwardRef<
|
|
13
|
+
HoverCardPrimitive.ContentRef,
|
|
14
|
+
HoverCardPrimitive.ContentProps
|
|
15
|
+
>(({ className, align = "center", sideOffset = 4, ...props }, ref) => {
|
|
16
|
+
const { open } = HoverCardPrimitive.useRootContext();
|
|
17
|
+
return (
|
|
18
|
+
<HoverCardPrimitive.Portal>
|
|
19
|
+
<HoverCardPrimitive.Overlay
|
|
20
|
+
style={Platform.OS !== "web" ? StyleSheet.absoluteFill : undefined}
|
|
21
|
+
>
|
|
22
|
+
<Animated.View entering={FadeIn}>
|
|
23
|
+
<TextClassContext.Provider value="text-popover-foreground">
|
|
24
|
+
<HoverCardPrimitive.Content
|
|
25
|
+
ref={ref}
|
|
26
|
+
align={align}
|
|
27
|
+
sideOffset={sideOffset}
|
|
28
|
+
className={cn(
|
|
29
|
+
"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",
|
|
30
|
+
open
|
|
31
|
+
? "web:animate-in web:fade-in-0 web:zoom-in-95"
|
|
32
|
+
: "web:animate-out web:fade-out-0 web:zoom-out-95",
|
|
33
|
+
className
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
</TextClassContext.Provider>
|
|
38
|
+
</Animated.View>
|
|
39
|
+
</HoverCardPrimitive.Overlay>
|
|
40
|
+
</HoverCardPrimitive.Portal>
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
44
|
+
|
|
45
|
+
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { TextInput, type TextInputProps } from "react-native";
|
|
3
|
+
import { cn } from "../utils";
|
|
4
|
+
|
|
5
|
+
const Input = React.forwardRef<
|
|
6
|
+
React.ElementRef<typeof TextInput>,
|
|
7
|
+
TextInputProps
|
|
8
|
+
>(({ className, placeholderClassName, ...props }, ref) => {
|
|
9
|
+
return (
|
|
10
|
+
<TextInput
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn(
|
|
13
|
+
"web:flex h-10 native:h-12 web:w-full rounded-md border border-input bg-background px-3 web:py-2 text-base lg:text-sm native:text-lg native:leading-[1.25] text-foreground placeholder:text-muted-foreground web:ring-offset-background file:border-0 file:bg-transparent file:font-medium web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2",
|
|
14
|
+
props.editable === false && "opacity-50 web:cursor-not-allowed",
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
placeholderClassName={cn("text-muted-foreground", placeholderClassName)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
Input.displayName = "Input";
|
|
24
|
+
|
|
25
|
+
export { Input };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as LabelPrimitive from "@rn-primitives/label";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../utils";
|
|
4
|
+
|
|
5
|
+
const Label = React.forwardRef<
|
|
6
|
+
LabelPrimitive.TextRef,
|
|
7
|
+
LabelPrimitive.TextProps
|
|
8
|
+
>(
|
|
9
|
+
(
|
|
10
|
+
{ className, onPress, onLongPress, onPressIn, onPressOut, ...props },
|
|
11
|
+
ref
|
|
12
|
+
) => (
|
|
13
|
+
<LabelPrimitive.Root
|
|
14
|
+
className="web:cursor-default"
|
|
15
|
+
onPress={onPress}
|
|
16
|
+
onLongPress={onLongPress}
|
|
17
|
+
onPressIn={onPressIn}
|
|
18
|
+
onPressOut={onPressOut}
|
|
19
|
+
>
|
|
20
|
+
<LabelPrimitive.Text
|
|
21
|
+
ref={ref}
|
|
22
|
+
className={cn(
|
|
23
|
+
"text-sm text-foreground native:text-base font-medium leading-none web:peer-disabled:cursor-not-allowed web:peer-disabled:opacity-70",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
</LabelPrimitive.Root>
|
|
29
|
+
)
|
|
30
|
+
);
|
|
31
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
32
|
+
|
|
33
|
+
export { Label };
|