@react-native-reusables/cli 0.4.0 → 0.5.0-alpha.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/LICENSE +1 -1
- package/bin.cjs +60513 -0
- package/package.json +7 -80
- package/README.md +0 -63
- package/__generated/components/ui/accordion.tsx +0 -125
- package/__generated/components/ui/alert-dialog.tsx +0 -160
- package/__generated/components/ui/alert.tsx +0 -75
- package/__generated/components/ui/aspect-ratio.tsx +0 -5
- package/__generated/components/ui/avatar.tsx +0 -41
- package/__generated/components/ui/badge.tsx +0 -51
- package/__generated/components/ui/button.tsx +0 -85
- package/__generated/components/ui/card.tsx +0 -55
- package/__generated/components/ui/checkbox.tsx +0 -32
- package/__generated/components/ui/collapsible.tsx +0 -9
- package/__generated/components/ui/context-menu.tsx +0 -245
- package/__generated/components/ui/dialog.tsx +0 -147
- package/__generated/components/ui/dropdown-menu.tsx +0 -253
- package/__generated/components/ui/hover-card.tsx +0 -45
- package/__generated/components/ui/input.tsx +0 -24
- package/__generated/components/ui/label.tsx +0 -27
- package/__generated/components/ui/menubar.tsx +0 -261
- package/__generated/components/ui/navigation-menu.tsx +0 -181
- package/__generated/components/ui/popover.tsx +0 -39
- package/__generated/components/ui/progress.tsx +0 -61
- package/__generated/components/ui/radio-group.tsx +0 -36
- package/__generated/components/ui/select.tsx +0 -173
- package/__generated/components/ui/separator.tsx +0 -22
- package/__generated/components/ui/skeleton.tsx +0 -39
- package/__generated/components/ui/switch.tsx +0 -95
- package/__generated/components/ui/table.tsx +0 -92
- package/__generated/components/ui/tabs.tsx +0 -62
- package/__generated/components/ui/text.tsx +0 -24
- package/__generated/components/ui/textarea.tsx +0 -27
- package/__generated/components/ui/toggle-group.tsx +0 -84
- package/__generated/components/ui/toggle.tsx +0 -85
- package/__generated/components/ui/tooltip.tsx +0 -38
- package/__generated/components/ui/typography.tsx +0 -205
- package/__generated/starter-base/README.md +0 -16
- package/__generated/starter-base/app/+not-found.tsx +0 -18
- package/__generated/starter-base/app/_layout.tsx +0 -69
- package/__generated/starter-base/app/index.tsx +0 -95
- package/__generated/starter-base/app.json +0 -40
- package/__generated/starter-base/assets/images/adaptive-icon.png +0 -0
- package/__generated/starter-base/assets/images/favicon.png +0 -0
- package/__generated/starter-base/assets/images/icon.png +0 -0
- package/__generated/starter-base/assets/images/splash.png +0 -0
- package/__generated/starter-base/babel.config.js +0 -6
- package/__generated/starter-base/components/ThemeToggle.tsx +0 -38
- package/__generated/starter-base/components/ui/avatar.tsx +0 -45
- package/__generated/starter-base/components/ui/button.tsx +0 -88
- package/__generated/starter-base/components/ui/card.tsx +0 -57
- package/__generated/starter-base/components/ui/progress.tsx +0 -61
- package/__generated/starter-base/components/ui/text.tsx +0 -24
- package/__generated/starter-base/components/ui/tooltip.tsx +0 -39
- package/__generated/starter-base/gitignore-template +0 -41
- package/__generated/starter-base/global.css +0 -49
- package/__generated/starter-base/index.js +0 -12
- package/__generated/starter-base/lib/android-navigation-bar.ts +0 -11
- package/__generated/starter-base/lib/constants.ts +0 -18
- package/__generated/starter-base/lib/icons/Info.tsx +0 -4
- package/__generated/starter-base/lib/icons/MoonStar.tsx +0 -4
- package/__generated/starter-base/lib/icons/Sun.tsx +0 -4
- package/__generated/starter-base/lib/icons/iconWithClassName.ts +0 -14
- package/__generated/starter-base/lib/useColorScheme.tsx +0 -11
- package/__generated/starter-base/lib/utils.ts +0 -6
- package/__generated/starter-base/metro.config.js +0 -6
- package/__generated/starter-base/nativewind-env.d.ts +0 -1
- package/__generated/starter-base/npmrc-template +0 -2
- package/__generated/starter-base/package.json +0 -53
- package/__generated/starter-base/tailwind.config.js +0 -65
- package/__generated/starter-base/tsconfig.json +0 -19
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import * as DropdownMenuPrimitive from '@rn-primitives/dropdown-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 './text';
|
|
18
|
-
|
|
19
|
-
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
20
|
-
|
|
21
|
-
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
22
|
-
|
|
23
|
-
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
24
|
-
|
|
25
|
-
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
26
|
-
|
|
27
|
-
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
28
|
-
|
|
29
|
-
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
30
|
-
|
|
31
|
-
const DropdownMenuSubTrigger = React.forwardRef<
|
|
32
|
-
DropdownMenuPrimitive.SubTriggerRef,
|
|
33
|
-
DropdownMenuPrimitive.SubTriggerProps & {
|
|
34
|
-
inset?: boolean;
|
|
35
|
-
}
|
|
36
|
-
>(({ className, inset, children, ...props }, ref) => {
|
|
37
|
-
const { open } = DropdownMenuPrimitive.useSubContext();
|
|
38
|
-
const Icon = Platform.OS === 'web' ? ChevronRight : open ? ChevronUp : ChevronDown;
|
|
39
|
-
return (
|
|
40
|
-
<TextClassContext.Provider
|
|
41
|
-
value={cn(
|
|
42
|
-
'select-none text-sm native:text-lg text-primary',
|
|
43
|
-
open && 'native:text-accent-foreground'
|
|
44
|
-
)}
|
|
45
|
-
>
|
|
46
|
-
<DropdownMenuPrimitive.SubTrigger
|
|
47
|
-
ref={ref}
|
|
48
|
-
className={cn(
|
|
49
|
-
'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',
|
|
50
|
-
open && 'bg-accent',
|
|
51
|
-
inset && 'pl-8',
|
|
52
|
-
className
|
|
53
|
-
)}
|
|
54
|
-
{...props}
|
|
55
|
-
>
|
|
56
|
-
<>{children}</>
|
|
57
|
-
<Icon size={18} className='ml-auto text-foreground' />
|
|
58
|
-
</DropdownMenuPrimitive.SubTrigger>
|
|
59
|
-
</TextClassContext.Provider>
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
63
|
-
|
|
64
|
-
const DropdownMenuSubContent = React.forwardRef<
|
|
65
|
-
DropdownMenuPrimitive.SubContentRef,
|
|
66
|
-
DropdownMenuPrimitive.SubContentProps
|
|
67
|
-
>(({ className, ...props }, ref) => {
|
|
68
|
-
const { open } = DropdownMenuPrimitive.useSubContext();
|
|
69
|
-
return (
|
|
70
|
-
<DropdownMenuPrimitive.SubContent
|
|
71
|
-
ref={ref}
|
|
72
|
-
className={cn(
|
|
73
|
-
'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',
|
|
74
|
-
open
|
|
75
|
-
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
76
|
-
: 'web:animate-out web:fade-out-0 web:zoom-out',
|
|
77
|
-
className
|
|
78
|
-
)}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
});
|
|
83
|
-
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
84
|
-
|
|
85
|
-
const DropdownMenuContent = React.forwardRef<
|
|
86
|
-
DropdownMenuPrimitive.ContentRef,
|
|
87
|
-
DropdownMenuPrimitive.ContentProps & {
|
|
88
|
-
overlayStyle?: StyleProp<ViewStyle>;
|
|
89
|
-
overlayClassName?: string;
|
|
90
|
-
portalHost?: string;
|
|
91
|
-
}
|
|
92
|
-
>(({ className, overlayClassName, overlayStyle, portalHost, ...props }, ref) => {
|
|
93
|
-
const { open } = DropdownMenuPrimitive.useRootContext();
|
|
94
|
-
return (
|
|
95
|
-
<DropdownMenuPrimitive.Portal hostName={portalHost}>
|
|
96
|
-
<DropdownMenuPrimitive.Overlay
|
|
97
|
-
style={
|
|
98
|
-
overlayStyle
|
|
99
|
-
? StyleSheet.flatten([
|
|
100
|
-
Platform.OS !== 'web' ? StyleSheet.absoluteFill : undefined,
|
|
101
|
-
overlayStyle,
|
|
102
|
-
])
|
|
103
|
-
: Platform.OS !== 'web'
|
|
104
|
-
? StyleSheet.absoluteFill
|
|
105
|
-
: undefined
|
|
106
|
-
}
|
|
107
|
-
className={overlayClassName}
|
|
108
|
-
>
|
|
109
|
-
<DropdownMenuPrimitive.Content
|
|
110
|
-
ref={ref}
|
|
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
|
-
</DropdownMenuPrimitive.Overlay>
|
|
121
|
-
</DropdownMenuPrimitive.Portal>
|
|
122
|
-
);
|
|
123
|
-
});
|
|
124
|
-
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
125
|
-
|
|
126
|
-
const DropdownMenuItem = React.forwardRef<
|
|
127
|
-
DropdownMenuPrimitive.ItemRef,
|
|
128
|
-
DropdownMenuPrimitive.ItemProps & {
|
|
129
|
-
inset?: boolean;
|
|
130
|
-
}
|
|
131
|
-
>(({ className, inset, ...props }, ref) => (
|
|
132
|
-
<TextClassContext.Provider value='select-none text-sm native:text-lg text-popover-foreground web:group-focus:text-accent-foreground'>
|
|
133
|
-
<DropdownMenuPrimitive.Item
|
|
134
|
-
ref={ref}
|
|
135
|
-
className={cn(
|
|
136
|
-
'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',
|
|
137
|
-
inset && 'pl-8',
|
|
138
|
-
props.disabled && 'opacity-50 web:pointer-events-none',
|
|
139
|
-
className
|
|
140
|
-
)}
|
|
141
|
-
{...props}
|
|
142
|
-
/>
|
|
143
|
-
</TextClassContext.Provider>
|
|
144
|
-
));
|
|
145
|
-
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
146
|
-
|
|
147
|
-
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
148
|
-
DropdownMenuPrimitive.CheckboxItemRef,
|
|
149
|
-
DropdownMenuPrimitive.CheckboxItemProps
|
|
150
|
-
>(({ className, children, checked, ...props }, ref) => (
|
|
151
|
-
<DropdownMenuPrimitive.CheckboxItem
|
|
152
|
-
ref={ref}
|
|
153
|
-
className={cn(
|
|
154
|
-
'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',
|
|
155
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
156
|
-
className
|
|
157
|
-
)}
|
|
158
|
-
checked={checked}
|
|
159
|
-
{...props}
|
|
160
|
-
>
|
|
161
|
-
<View className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>
|
|
162
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
163
|
-
<Check size={14} strokeWidth={3} className='text-foreground' />
|
|
164
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
165
|
-
</View>
|
|
166
|
-
<>{children}</>
|
|
167
|
-
</DropdownMenuPrimitive.CheckboxItem>
|
|
168
|
-
));
|
|
169
|
-
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
170
|
-
|
|
171
|
-
const DropdownMenuRadioItem = React.forwardRef<
|
|
172
|
-
DropdownMenuPrimitive.RadioItemRef,
|
|
173
|
-
DropdownMenuPrimitive.RadioItemProps
|
|
174
|
-
>(({ className, children, ...props }, ref) => (
|
|
175
|
-
<DropdownMenuPrimitive.RadioItem
|
|
176
|
-
ref={ref}
|
|
177
|
-
className={cn(
|
|
178
|
-
'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',
|
|
179
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
180
|
-
className
|
|
181
|
-
)}
|
|
182
|
-
{...props}
|
|
183
|
-
>
|
|
184
|
-
<View className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>
|
|
185
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
186
|
-
<View className='bg-foreground h-2 w-2 rounded-full' />
|
|
187
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
188
|
-
</View>
|
|
189
|
-
<>{children}</>
|
|
190
|
-
</DropdownMenuPrimitive.RadioItem>
|
|
191
|
-
));
|
|
192
|
-
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
193
|
-
|
|
194
|
-
const DropdownMenuLabel = React.forwardRef<
|
|
195
|
-
DropdownMenuPrimitive.LabelRef,
|
|
196
|
-
DropdownMenuPrimitive.LabelProps & {
|
|
197
|
-
inset?: boolean;
|
|
198
|
-
}
|
|
199
|
-
>(({ className, inset, ...props }, ref) => (
|
|
200
|
-
<DropdownMenuPrimitive.Label
|
|
201
|
-
ref={ref}
|
|
202
|
-
className={cn(
|
|
203
|
-
'px-2 py-1.5 text-sm native:text-base font-semibold text-foreground web:cursor-default',
|
|
204
|
-
inset && 'pl-8',
|
|
205
|
-
className
|
|
206
|
-
)}
|
|
207
|
-
{...props}
|
|
208
|
-
/>
|
|
209
|
-
));
|
|
210
|
-
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
211
|
-
|
|
212
|
-
const DropdownMenuSeparator = React.forwardRef<
|
|
213
|
-
DropdownMenuPrimitive.SeparatorRef,
|
|
214
|
-
DropdownMenuPrimitive.SeparatorProps
|
|
215
|
-
>(({ className, ...props }, ref) => (
|
|
216
|
-
<DropdownMenuPrimitive.Separator
|
|
217
|
-
ref={ref}
|
|
218
|
-
className={cn('-mx-1 my-1 h-px bg-border', className)}
|
|
219
|
-
{...props}
|
|
220
|
-
/>
|
|
221
|
-
));
|
|
222
|
-
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
223
|
-
|
|
224
|
-
const DropdownMenuShortcut = ({ className, ...props }: TextProps) => {
|
|
225
|
-
return (
|
|
226
|
-
<Text
|
|
227
|
-
className={cn(
|
|
228
|
-
'ml-auto text-xs native:text-sm tracking-widest text-muted-foreground',
|
|
229
|
-
className
|
|
230
|
-
)}
|
|
231
|
-
{...props}
|
|
232
|
-
/>
|
|
233
|
-
);
|
|
234
|
-
};
|
|
235
|
-
DropdownMenuShortcut.displayName = 'DropdownMenuShortcut';
|
|
236
|
-
|
|
237
|
-
export {
|
|
238
|
-
DropdownMenu,
|
|
239
|
-
DropdownMenuCheckboxItem,
|
|
240
|
-
DropdownMenuContent,
|
|
241
|
-
DropdownMenuGroup,
|
|
242
|
-
DropdownMenuItem,
|
|
243
|
-
DropdownMenuLabel,
|
|
244
|
-
DropdownMenuPortal,
|
|
245
|
-
DropdownMenuRadioGroup,
|
|
246
|
-
DropdownMenuRadioItem,
|
|
247
|
-
DropdownMenuSeparator,
|
|
248
|
-
DropdownMenuShortcut,
|
|
249
|
-
DropdownMenuSub,
|
|
250
|
-
DropdownMenuSubContent,
|
|
251
|
-
DropdownMenuSubTrigger,
|
|
252
|
-
DropdownMenuTrigger,
|
|
253
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
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 './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 };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { TextInput, type TextInputProps } from 'react-native';
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
4
|
-
|
|
5
|
-
const Input = React.forwardRef<React.ElementRef<typeof TextInput>, TextInputProps>(
|
|
6
|
-
({ className, placeholderClassName, ...props }, ref) => {
|
|
7
|
-
return (
|
|
8
|
-
<TextInput
|
|
9
|
-
ref={ref}
|
|
10
|
-
className={cn(
|
|
11
|
-
'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',
|
|
12
|
-
props.editable === false && 'opacity-50 web:cursor-not-allowed',
|
|
13
|
-
className
|
|
14
|
-
)}
|
|
15
|
-
placeholderClassName={cn('text-muted-foreground', placeholderClassName)}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
Input.displayName = 'Input';
|
|
23
|
-
|
|
24
|
-
export { Input };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as LabelPrimitive from '@rn-primitives/label';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
4
|
-
|
|
5
|
-
const Label = React.forwardRef<LabelPrimitive.TextRef, LabelPrimitive.TextProps>(
|
|
6
|
-
({ className, onPress, onLongPress, onPressIn, onPressOut, ...props }, ref) => (
|
|
7
|
-
<LabelPrimitive.Root
|
|
8
|
-
className='web:cursor-default'
|
|
9
|
-
onPress={onPress}
|
|
10
|
-
onLongPress={onLongPress}
|
|
11
|
-
onPressIn={onPressIn}
|
|
12
|
-
onPressOut={onPressOut}
|
|
13
|
-
>
|
|
14
|
-
<LabelPrimitive.Text
|
|
15
|
-
ref={ref}
|
|
16
|
-
className={cn(
|
|
17
|
-
'text-sm text-foreground native:text-base font-medium leading-none web:peer-disabled:cursor-not-allowed web:peer-disabled:opacity-70',
|
|
18
|
-
className
|
|
19
|
-
)}
|
|
20
|
-
{...props}
|
|
21
|
-
/>
|
|
22
|
-
</LabelPrimitive.Root>
|
|
23
|
-
)
|
|
24
|
-
);
|
|
25
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
26
|
-
|
|
27
|
-
export { Label };
|
|
@@ -1,261 +0,0 @@
|
|
|
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 './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
|
-
const Menubar = React.forwardRef<MenubarPrimitive.RootRef, MenubarPrimitive.RootProps>(
|
|
22
|
-
({ className, ...props }, ref) => (
|
|
23
|
-
<MenubarPrimitive.Root
|
|
24
|
-
ref={ref}
|
|
25
|
-
className={cn(
|
|
26
|
-
'flex flex-row h-10 native:h-12 items-center space-x-1 rounded-md border border-border bg-background p-1',
|
|
27
|
-
className
|
|
28
|
-
)}
|
|
29
|
-
{...props}
|
|
30
|
-
/>
|
|
31
|
-
)
|
|
32
|
-
);
|
|
33
|
-
Menubar.displayName = MenubarPrimitive.Root.displayName;
|
|
34
|
-
|
|
35
|
-
const MenubarTrigger = React.forwardRef<MenubarPrimitive.TriggerRef, MenubarPrimitive.TriggerProps>(
|
|
36
|
-
({ className, ...props }, ref) => {
|
|
37
|
-
const { value } = MenubarPrimitive.useRootContext();
|
|
38
|
-
const { value: itemValue } = MenubarPrimitive.useMenuContext();
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<MenubarPrimitive.Trigger
|
|
42
|
-
ref={ref}
|
|
43
|
-
className={cn(
|
|
44
|
-
'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',
|
|
45
|
-
value === itemValue && 'bg-accent text-accent-foreground',
|
|
46
|
-
className
|
|
47
|
-
)}
|
|
48
|
-
{...props}
|
|
49
|
-
/>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName;
|
|
54
|
-
|
|
55
|
-
const MenubarSubTrigger = React.forwardRef<
|
|
56
|
-
MenubarPrimitive.SubTriggerRef,
|
|
57
|
-
MenubarPrimitive.SubTriggerProps & {
|
|
58
|
-
inset?: boolean;
|
|
59
|
-
}
|
|
60
|
-
>(({ className, inset, children, ...props }, ref) => {
|
|
61
|
-
const { open } = MenubarPrimitive.useSubContext();
|
|
62
|
-
const Icon = Platform.OS === 'web' ? ChevronRight : open ? ChevronUp : ChevronDown;
|
|
63
|
-
return (
|
|
64
|
-
<TextClassContext.Provider
|
|
65
|
-
value={cn(
|
|
66
|
-
'select-none text-sm native:text-lg text-primary',
|
|
67
|
-
open && 'native:text-accent-foreground'
|
|
68
|
-
)}
|
|
69
|
-
>
|
|
70
|
-
<MenubarPrimitive.SubTrigger
|
|
71
|
-
ref={ref}
|
|
72
|
-
className={cn(
|
|
73
|
-
'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',
|
|
74
|
-
open && 'bg-accent',
|
|
75
|
-
inset && 'pl-8',
|
|
76
|
-
className
|
|
77
|
-
)}
|
|
78
|
-
{...props}
|
|
79
|
-
>
|
|
80
|
-
<>{children}</>
|
|
81
|
-
<Icon size={18} className='ml-auto text-foreground' />
|
|
82
|
-
</MenubarPrimitive.SubTrigger>
|
|
83
|
-
</TextClassContext.Provider>
|
|
84
|
-
);
|
|
85
|
-
});
|
|
86
|
-
MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName;
|
|
87
|
-
|
|
88
|
-
const MenubarSubContent = React.forwardRef<
|
|
89
|
-
MenubarPrimitive.SubContentRef,
|
|
90
|
-
MenubarPrimitive.SubContentProps
|
|
91
|
-
>(({ className, ...props }, ref) => {
|
|
92
|
-
const { open } = MenubarPrimitive.useSubContext();
|
|
93
|
-
return (
|
|
94
|
-
<MenubarPrimitive.SubContent
|
|
95
|
-
ref={ref}
|
|
96
|
-
className={cn(
|
|
97
|
-
'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',
|
|
98
|
-
open
|
|
99
|
-
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
100
|
-
: 'web:animate-out web:fade-out-0 web:zoom-out ',
|
|
101
|
-
className
|
|
102
|
-
)}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
});
|
|
107
|
-
MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName;
|
|
108
|
-
|
|
109
|
-
const MenubarContent = React.forwardRef<
|
|
110
|
-
MenubarPrimitive.ContentRef,
|
|
111
|
-
MenubarPrimitive.ContentProps & { portalHost?: string }
|
|
112
|
-
>(({ className, portalHost, ...props }, ref) => {
|
|
113
|
-
const { value } = MenubarPrimitive.useRootContext();
|
|
114
|
-
const { value: itemValue } = MenubarPrimitive.useMenuContext();
|
|
115
|
-
return (
|
|
116
|
-
<MenubarPrimitive.Portal hostName={portalHost}>
|
|
117
|
-
<MenubarPrimitive.Content
|
|
118
|
-
ref={ref}
|
|
119
|
-
className={cn(
|
|
120
|
-
'z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 shadow-md shadow-foreground/5',
|
|
121
|
-
value === itemValue
|
|
122
|
-
? 'web:animate-in web:fade-in-0 web:zoom-in-95'
|
|
123
|
-
: 'web:animate-out web:fade-out-0 web:zoom-out-95',
|
|
124
|
-
className
|
|
125
|
-
)}
|
|
126
|
-
{...props}
|
|
127
|
-
/>
|
|
128
|
-
</MenubarPrimitive.Portal>
|
|
129
|
-
);
|
|
130
|
-
});
|
|
131
|
-
MenubarContent.displayName = MenubarPrimitive.Content.displayName;
|
|
132
|
-
|
|
133
|
-
const MenubarItem = React.forwardRef<
|
|
134
|
-
MenubarPrimitive.ItemRef,
|
|
135
|
-
MenubarPrimitive.ItemProps & {
|
|
136
|
-
inset?: boolean;
|
|
137
|
-
}
|
|
138
|
-
>(({ className, inset, ...props }, ref) => (
|
|
139
|
-
<TextClassContext.Provider value='select-none text-sm native:text-lg text-popover-foreground web:group-focus:text-accent-foreground'>
|
|
140
|
-
<MenubarPrimitive.Item
|
|
141
|
-
ref={ref}
|
|
142
|
-
className={cn(
|
|
143
|
-
'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',
|
|
144
|
-
inset && 'pl-8',
|
|
145
|
-
props.disabled && 'opacity-50 web:pointer-events-none',
|
|
146
|
-
className
|
|
147
|
-
)}
|
|
148
|
-
{...props}
|
|
149
|
-
/>
|
|
150
|
-
</TextClassContext.Provider>
|
|
151
|
-
));
|
|
152
|
-
MenubarItem.displayName = MenubarPrimitive.Item.displayName;
|
|
153
|
-
|
|
154
|
-
const MenubarCheckboxItem = React.forwardRef<
|
|
155
|
-
MenubarPrimitive.CheckboxItemRef,
|
|
156
|
-
MenubarPrimitive.CheckboxItemProps
|
|
157
|
-
>(({ className, children, checked, ...props }, ref) => (
|
|
158
|
-
<MenubarPrimitive.CheckboxItem
|
|
159
|
-
ref={ref}
|
|
160
|
-
className={cn(
|
|
161
|
-
'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',
|
|
162
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
163
|
-
className
|
|
164
|
-
)}
|
|
165
|
-
checked={checked}
|
|
166
|
-
{...props}
|
|
167
|
-
>
|
|
168
|
-
<View className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>
|
|
169
|
-
<MenubarPrimitive.ItemIndicator>
|
|
170
|
-
<Check size={14} strokeWidth={3} className='text-foreground' />
|
|
171
|
-
</MenubarPrimitive.ItemIndicator>
|
|
172
|
-
</View>
|
|
173
|
-
<>{children}</>
|
|
174
|
-
</MenubarPrimitive.CheckboxItem>
|
|
175
|
-
));
|
|
176
|
-
MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName;
|
|
177
|
-
|
|
178
|
-
const MenubarRadioItem = React.forwardRef<
|
|
179
|
-
MenubarPrimitive.RadioItemRef,
|
|
180
|
-
MenubarPrimitive.RadioItemProps
|
|
181
|
-
>(({ className, children, ...props }, ref) => (
|
|
182
|
-
<MenubarPrimitive.RadioItem
|
|
183
|
-
ref={ref}
|
|
184
|
-
className={cn(
|
|
185
|
-
'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',
|
|
186
|
-
props.disabled && 'web:pointer-events-none opacity-50',
|
|
187
|
-
className
|
|
188
|
-
)}
|
|
189
|
-
{...props}
|
|
190
|
-
>
|
|
191
|
-
<View className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>
|
|
192
|
-
<MenubarPrimitive.ItemIndicator>
|
|
193
|
-
<View className='bg-foreground h-2 w-2 rounded-full' />
|
|
194
|
-
</MenubarPrimitive.ItemIndicator>
|
|
195
|
-
</View>
|
|
196
|
-
<>{children}</>
|
|
197
|
-
</MenubarPrimitive.RadioItem>
|
|
198
|
-
));
|
|
199
|
-
MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName;
|
|
200
|
-
|
|
201
|
-
const MenubarLabel = React.forwardRef<
|
|
202
|
-
MenubarPrimitive.LabelRef,
|
|
203
|
-
MenubarPrimitive.LabelProps & {
|
|
204
|
-
inset?: boolean;
|
|
205
|
-
}
|
|
206
|
-
>(({ className, inset, ...props }, ref) => (
|
|
207
|
-
<MenubarPrimitive.Label
|
|
208
|
-
ref={ref}
|
|
209
|
-
className={cn(
|
|
210
|
-
'px-2 py-1.5 text-sm native:text-base font-semibold text-foreground web:cursor-default',
|
|
211
|
-
inset && 'pl-8',
|
|
212
|
-
className
|
|
213
|
-
)}
|
|
214
|
-
{...props}
|
|
215
|
-
/>
|
|
216
|
-
));
|
|
217
|
-
MenubarLabel.displayName = MenubarPrimitive.Label.displayName;
|
|
218
|
-
|
|
219
|
-
const MenubarSeparator = React.forwardRef<
|
|
220
|
-
MenubarPrimitive.SeparatorRef,
|
|
221
|
-
MenubarPrimitive.SeparatorProps
|
|
222
|
-
>(({ className, ...props }, ref) => (
|
|
223
|
-
<MenubarPrimitive.Separator
|
|
224
|
-
ref={ref}
|
|
225
|
-
className={cn('-mx-1 my-1 h-px bg-border', className)}
|
|
226
|
-
{...props}
|
|
227
|
-
/>
|
|
228
|
-
));
|
|
229
|
-
MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName;
|
|
230
|
-
|
|
231
|
-
const MenubarShortcut = ({ className, ...props }: TextProps) => {
|
|
232
|
-
return (
|
|
233
|
-
<Text
|
|
234
|
-
className={cn(
|
|
235
|
-
'ml-auto text-xs native:text-sm tracking-widest text-muted-foreground',
|
|
236
|
-
className
|
|
237
|
-
)}
|
|
238
|
-
{...props}
|
|
239
|
-
/>
|
|
240
|
-
);
|
|
241
|
-
};
|
|
242
|
-
MenubarShortcut.displayName = 'MenubarShortcut';
|
|
243
|
-
|
|
244
|
-
export {
|
|
245
|
-
Menubar,
|
|
246
|
-
MenubarCheckboxItem,
|
|
247
|
-
MenubarContent,
|
|
248
|
-
MenubarGroup,
|
|
249
|
-
MenubarItem,
|
|
250
|
-
MenubarLabel,
|
|
251
|
-
MenubarMenu,
|
|
252
|
-
MenubarPortal,
|
|
253
|
-
MenubarRadioGroup,
|
|
254
|
-
MenubarRadioItem,
|
|
255
|
-
MenubarSeparator,
|
|
256
|
-
MenubarShortcut,
|
|
257
|
-
MenubarSub,
|
|
258
|
-
MenubarSubContent,
|
|
259
|
-
MenubarSubTrigger,
|
|
260
|
-
MenubarTrigger,
|
|
261
|
-
};
|