@campxdev/react-native-blueprint 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/LICENSE +20 -0
- package/README.md +358 -0
- package/lib/module/app/_layout.js +23 -0
- package/lib/module/app/_layout.js.map +1 -0
- package/lib/module/assets/icons/weather_icons/drizzle.png +0 -0
- package/lib/module/assets/icons/weather_icons/foggy.png +0 -0
- package/lib/module/assets/icons/weather_icons/freezing_rain.png +0 -0
- package/lib/module/assets/icons/weather_icons/partly_cloudy.png +0 -0
- package/lib/module/assets/icons/weather_icons/rainy.png +0 -0
- package/lib/module/assets/icons/weather_icons/showers.png +0 -0
- package/lib/module/assets/icons/weather_icons/sunny_weather.png +0 -0
- package/lib/module/assets/icons/weather_icons/thunderstorm.png +0 -0
- package/lib/module/assets/icons/weather_icons/thunderstorm_hail.png +0 -0
- package/lib/module/components/theme-config.js +265 -0
- package/lib/module/components/theme-config.js.map +1 -0
- package/lib/module/components/ui/Accordion.js +228 -0
- package/lib/module/components/ui/Accordion.js.map +1 -0
- package/lib/module/components/ui/Alert-Dialog.js +266 -0
- package/lib/module/components/ui/Alert-Dialog.js.map +1 -0
- package/lib/module/components/ui/Alert.js +107 -0
- package/lib/module/components/ui/Alert.js.map +1 -0
- package/lib/module/components/ui/AppBar.js +403 -0
- package/lib/module/components/ui/AppBar.js.map +1 -0
- package/lib/module/components/ui/Aspect-Ratio.js +27 -0
- package/lib/module/components/ui/Aspect-Ratio.js.map +1 -0
- package/lib/module/components/ui/Avatar.js +97 -0
- package/lib/module/components/ui/Avatar.js.map +1 -0
- package/lib/module/components/ui/Badge.js +127 -0
- package/lib/module/components/ui/Badge.js.map +1 -0
- package/lib/module/components/ui/Bottom-Sheet.js +144 -0
- package/lib/module/components/ui/Bottom-Sheet.js.map +1 -0
- package/lib/module/components/ui/Button.js +88 -0
- package/lib/module/components/ui/Button.js.map +1 -0
- package/lib/module/components/ui/Card.js +176 -0
- package/lib/module/components/ui/Card.js.map +1 -0
- package/lib/module/components/ui/Checkbox.js +65 -0
- package/lib/module/components/ui/Checkbox.js.map +1 -0
- package/lib/module/components/ui/Collapsible.js +42 -0
- package/lib/module/components/ui/Collapsible.js.map +1 -0
- package/lib/module/components/ui/Context-Menu.js +287 -0
- package/lib/module/components/ui/Context-Menu.js.map +1 -0
- package/lib/module/components/ui/Custom-Card.js +202 -0
- package/lib/module/components/ui/Custom-Card.js.map +1 -0
- package/lib/module/components/ui/Dialog.js +202 -0
- package/lib/module/components/ui/Dialog.js.map +1 -0
- package/lib/module/components/ui/Dropdown-Menu.js +421 -0
- package/lib/module/components/ui/Dropdown-Menu.js.map +1 -0
- package/lib/module/components/ui/Floating-Action.js +50 -0
- package/lib/module/components/ui/Floating-Action.js.map +1 -0
- package/lib/module/components/ui/Greeting-Card.js +392 -0
- package/lib/module/components/ui/Greeting-Card.js.map +1 -0
- package/lib/module/components/ui/Hover-Card.js +96 -0
- package/lib/module/components/ui/Hover-Card.js.map +1 -0
- package/lib/module/components/ui/Icon.js +73 -0
- package/lib/module/components/ui/Icon.js.map +1 -0
- package/lib/module/components/ui/Input.js +74 -0
- package/lib/module/components/ui/Input.js.map +1 -0
- package/lib/module/components/ui/Label.js +44 -0
- package/lib/module/components/ui/Label.js.map +1 -0
- package/lib/module/components/ui/Menubar.js +375 -0
- package/lib/module/components/ui/Menubar.js.map +1 -0
- package/lib/module/components/ui/Native-Only-Animated-View.js +41 -0
- package/lib/module/components/ui/Native-Only-Animated-View.js.map +1 -0
- package/lib/module/components/ui/NavBar.js +352 -0
- package/lib/module/components/ui/NavBar.js.map +1 -0
- package/lib/module/components/ui/Popover.js +101 -0
- package/lib/module/components/ui/Popover.js.map +1 -0
- package/lib/module/components/ui/Progress.js +124 -0
- package/lib/module/components/ui/Progress.js.map +1 -0
- package/lib/module/components/ui/Radio-Group.js +75 -0
- package/lib/module/components/ui/Radio-Group.js.map +1 -0
- package/lib/module/components/ui/Select.js +269 -0
- package/lib/module/components/ui/Select.js.map +1 -0
- package/lib/module/components/ui/Separator.js +58 -0
- package/lib/module/components/ui/Separator.js.map +1 -0
- package/lib/module/components/ui/SizedBox.js +101 -0
- package/lib/module/components/ui/SizedBox.js.map +1 -0
- package/lib/module/components/ui/Skeleton.js +57 -0
- package/lib/module/components/ui/Skeleton.js.map +1 -0
- package/lib/module/components/ui/Slider.js +169 -0
- package/lib/module/components/ui/Slider.js.map +1 -0
- package/lib/module/components/ui/Switch.js +55 -0
- package/lib/module/components/ui/Switch.js.map +1 -0
- package/lib/module/components/ui/Table.js +150 -0
- package/lib/module/components/ui/Table.js.map +1 -0
- package/lib/module/components/ui/Tabs.js +106 -0
- package/lib/module/components/ui/Tabs.js.map +1 -0
- package/lib/module/components/ui/Text.js +69 -0
- package/lib/module/components/ui/Text.js.map +1 -0
- package/lib/module/components/ui/Textarea.js +88 -0
- package/lib/module/components/ui/Textarea.js.map +1 -0
- package/lib/module/components/ui/Theme-Toggle.js +156 -0
- package/lib/module/components/ui/Theme-Toggle.js.map +1 -0
- package/lib/module/components/ui/Toast.js +101 -0
- package/lib/module/components/ui/Toast.js.map +1 -0
- package/lib/module/components/ui/Toggle-Group.js +129 -0
- package/lib/module/components/ui/Toggle-Group.js.map +1 -0
- package/lib/module/components/ui/Toggle.js +106 -0
- package/lib/module/components/ui/Toggle.js.map +1 -0
- package/lib/module/components/ui/Tooltip.js +106 -0
- package/lib/module/components/ui/Tooltip.js.map +1 -0
- package/lib/module/components/ui/index.js +45 -0
- package/lib/module/components/ui/index.js.map +1 -0
- package/lib/module/index.js +19 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/lib/ThemeProvider.js +173 -0
- package/lib/module/lib/ThemeProvider.js.map +1 -0
- package/lib/module/lib/cornerRadius.js +164 -0
- package/lib/module/lib/cornerRadius.js.map +1 -0
- package/lib/module/lib/fonts.js +25 -0
- package/lib/module/lib/fonts.js.map +1 -0
- package/lib/module/lib/theme.js +212 -0
- package/lib/module/lib/theme.js.map +1 -0
- package/lib/module/lib/utils.js +137 -0
- package/lib/module/lib/utils.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/package.json +208 -0
- package/src/app/_layout.tsx +25 -0
- package/src/assets/icons/weather_icons/drizzle.png +0 -0
- package/src/assets/icons/weather_icons/foggy.png +0 -0
- package/src/assets/icons/weather_icons/freezing_rain.png +0 -0
- package/src/assets/icons/weather_icons/partly_cloudy.png +0 -0
- package/src/assets/icons/weather_icons/rainy.png +0 -0
- package/src/assets/icons/weather_icons/showers.png +0 -0
- package/src/assets/icons/weather_icons/sunny_weather.png +0 -0
- package/src/assets/icons/weather_icons/thunderstorm.png +0 -0
- package/src/assets/icons/weather_icons/thunderstorm_hail.png +0 -0
- package/src/components/theme-config.ts +331 -0
- package/src/components/ui/Accordion.tsx +253 -0
- package/src/components/ui/Alert-Dialog.tsx +295 -0
- package/src/components/ui/Alert.tsx +137 -0
- package/src/components/ui/AppBar.tsx +551 -0
- package/src/components/ui/Aspect-Ratio.tsx +25 -0
- package/src/components/ui/Avatar.tsx +103 -0
- package/src/components/ui/Badge.tsx +121 -0
- package/src/components/ui/Bottom-Sheet.tsx +224 -0
- package/src/components/ui/Button.tsx +100 -0
- package/src/components/ui/Card.tsx +185 -0
- package/src/components/ui/Checkbox.tsx +81 -0
- package/src/components/ui/Collapsible.tsx +40 -0
- package/src/components/ui/Context-Menu.tsx +407 -0
- package/src/components/ui/Custom-Card.tsx +226 -0
- package/src/components/ui/Dialog.tsx +240 -0
- package/src/components/ui/Dropdown-Menu.tsx +544 -0
- package/src/components/ui/Floating-Action.tsx +54 -0
- package/src/components/ui/Greeting-Card.tsx +471 -0
- package/src/components/ui/Hover-Card.tsx +101 -0
- package/src/components/ui/Icon.tsx +75 -0
- package/src/components/ui/Input.tsx +90 -0
- package/src/components/ui/Label.tsx +48 -0
- package/src/components/ui/Menubar.tsx +509 -0
- package/src/components/ui/Native-Only-Animated-View.tsx +37 -0
- package/src/components/ui/NavBar.tsx +397 -0
- package/src/components/ui/Popover.tsx +110 -0
- package/src/components/ui/Progress.tsx +138 -0
- package/src/components/ui/Radio-Group.tsx +79 -0
- package/src/components/ui/Select.tsx +344 -0
- package/src/components/ui/Separator.tsx +68 -0
- package/src/components/ui/SizedBox.tsx +116 -0
- package/src/components/ui/Skeleton.tsx +55 -0
- package/src/components/ui/Slider.tsx +222 -0
- package/src/components/ui/Switch.tsx +67 -0
- package/src/components/ui/Table.tsx +170 -0
- package/src/components/ui/Tabs.tsx +119 -0
- package/src/components/ui/Text.tsx +73 -0
- package/src/components/ui/Textarea.tsx +93 -0
- package/src/components/ui/Theme-Toggle.tsx +204 -0
- package/src/components/ui/Toast.tsx +127 -0
- package/src/components/ui/Toggle-Group.tsx +160 -0
- package/src/components/ui/Toggle.tsx +122 -0
- package/src/components/ui/Tooltip.tsx +117 -0
- package/src/components/ui/index.ts +42 -0
- package/src/index.tsx +24 -0
- package/src/lib/ThemeProvider.tsx +204 -0
- package/src/lib/cornerRadius.ts +160 -0
- package/src/lib/fonts.ts +28 -0
- package/src/lib/theme.ts +151 -0
- package/src/lib/utils.ts +146 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { Icon } from './Icon';
|
|
2
|
+
import { NativeOnlyAnimatedView } from './Native-Only-Animated-View';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
import * as DialogPrimitive from '@rn-primitives/dialog';
|
|
5
|
+
import { X } from 'lucide-react-native';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { Platform, Text, View, type ViewProps } from 'react-native';
|
|
8
|
+
import { cssInterop } from 'nativewind';
|
|
9
|
+
import { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
10
|
+
import { FullWindowOverlay as RNFullWindowOverlay } from 'react-native-screens';
|
|
11
|
+
|
|
12
|
+
cssInterop(View, { className: 'style' });
|
|
13
|
+
cssInterop(Text, { className: 'style' });
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Root dialog container
|
|
17
|
+
*
|
|
18
|
+
* A modal window that overlays the main content and requires user interaction.
|
|
19
|
+
* Unlike AlertDialog, this is for non-critical content that doesn't require immediate action.
|
|
20
|
+
*
|
|
21
|
+
* @component
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <Dialog>
|
|
25
|
+
* <DialogTrigger asChild>
|
|
26
|
+
* <Button><Text>Open Dialog</Text></Button>
|
|
27
|
+
* </DialogTrigger>
|
|
28
|
+
* <DialogContent>
|
|
29
|
+
* <DialogHeader>
|
|
30
|
+
* <DialogTitle><Text>Edit Profile</Text></DialogTitle>
|
|
31
|
+
* <DialogDescription><Text>Make changes to your profile</Text></DialogDescription>
|
|
32
|
+
* </DialogHeader>
|
|
33
|
+
* <DialogFooter>
|
|
34
|
+
* <Button><Text>Save</Text></Button>
|
|
35
|
+
* </DialogFooter>
|
|
36
|
+
* </DialogContent>
|
|
37
|
+
* </Dialog>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
const Dialog = DialogPrimitive.Root;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Trigger button that opens the dialog
|
|
44
|
+
*/
|
|
45
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Portal component for rendering dialog outside DOM hierarchy
|
|
49
|
+
*/
|
|
50
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Close button component for manually closing the dialog
|
|
54
|
+
*/
|
|
55
|
+
const DialogClose = DialogPrimitive.Close;
|
|
56
|
+
|
|
57
|
+
const FullWindowOverlay =
|
|
58
|
+
Platform.OS === 'ios' ? RNFullWindowOverlay : React.Fragment;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Semi-transparent overlay behind the dialog
|
|
62
|
+
*
|
|
63
|
+
* Provides backdrop that dims background content. Uses platform-specific
|
|
64
|
+
* full window overlay on iOS for proper z-index layering.
|
|
65
|
+
*/
|
|
66
|
+
function DialogOverlay({
|
|
67
|
+
className,
|
|
68
|
+
children,
|
|
69
|
+
...props
|
|
70
|
+
}: Omit<DialogPrimitive.OverlayProps, 'asChild'> &
|
|
71
|
+
React.RefAttributes<DialogPrimitive.OverlayRef> & {
|
|
72
|
+
children?: React.ReactNode;
|
|
73
|
+
}) {
|
|
74
|
+
return (
|
|
75
|
+
<FullWindowOverlay>
|
|
76
|
+
<DialogPrimitive.Overlay
|
|
77
|
+
className={cn(
|
|
78
|
+
'absolute bottom-0 left-0 right-0 top-0 z-50 flex items-center justify-center bg-black/50 p-2',
|
|
79
|
+
Platform.select({
|
|
80
|
+
web: 'animate-in fade-in-0 fixed cursor-default [&>*]:cursor-auto',
|
|
81
|
+
}),
|
|
82
|
+
className
|
|
83
|
+
)}
|
|
84
|
+
{...props}
|
|
85
|
+
asChild={Platform.OS !== 'web'}
|
|
86
|
+
>
|
|
87
|
+
<NativeOnlyAnimatedView
|
|
88
|
+
entering={FadeIn.duration(200)}
|
|
89
|
+
exiting={FadeOut.duration(150)}
|
|
90
|
+
>
|
|
91
|
+
<NativeOnlyAnimatedView
|
|
92
|
+
entering={FadeIn.delay(50)}
|
|
93
|
+
exiting={FadeOut.duration(150)}
|
|
94
|
+
>
|
|
95
|
+
<>{children}</>
|
|
96
|
+
</NativeOnlyAnimatedView>
|
|
97
|
+
</NativeOnlyAnimatedView>
|
|
98
|
+
</DialogPrimitive.Overlay>
|
|
99
|
+
</FullWindowOverlay>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Main dialog content container
|
|
105
|
+
*
|
|
106
|
+
* Contains the actual dialog UI with automatic close button in top-right corner.
|
|
107
|
+
* Includes smooth fade and zoom animations.
|
|
108
|
+
*
|
|
109
|
+
* @param {string} [portalHost] - Optional portal host name for custom rendering location
|
|
110
|
+
* @param {string} [className] - Additional Tailwind classes
|
|
111
|
+
*/
|
|
112
|
+
function DialogContent({
|
|
113
|
+
className,
|
|
114
|
+
portalHost,
|
|
115
|
+
children,
|
|
116
|
+
...props
|
|
117
|
+
}: DialogPrimitive.ContentProps &
|
|
118
|
+
React.RefAttributes<DialogPrimitive.ContentRef> & {
|
|
119
|
+
portalHost?: string;
|
|
120
|
+
}) {
|
|
121
|
+
return (
|
|
122
|
+
<DialogPortal hostName={portalHost}>
|
|
123
|
+
<DialogOverlay>
|
|
124
|
+
<DialogPrimitive.Content
|
|
125
|
+
className={cn(
|
|
126
|
+
'bg-background border-border z-50 mx-auto flex w-full max-w-[calc(100%-2rem)] flex-col gap-4 rounded-lg border p-6 shadow-lg shadow-black/5 sm:max-w-lg',
|
|
127
|
+
Platform.select({
|
|
128
|
+
web: 'animate-in fade-in-0 zoom-in-95 duration-200',
|
|
129
|
+
}),
|
|
130
|
+
className
|
|
131
|
+
)}
|
|
132
|
+
{...props}
|
|
133
|
+
>
|
|
134
|
+
<>{children}</>
|
|
135
|
+
<DialogPrimitive.Close
|
|
136
|
+
className={cn(
|
|
137
|
+
'absolute right-4 top-4 rounded opacity-70 active:opacity-100',
|
|
138
|
+
Platform.select({
|
|
139
|
+
web: 'ring-offset-background focus:ring-ring data-[state=open]:bg-accent transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2',
|
|
140
|
+
})
|
|
141
|
+
)}
|
|
142
|
+
hitSlop={12}
|
|
143
|
+
>
|
|
144
|
+
<Icon
|
|
145
|
+
as={X}
|
|
146
|
+
className={cn(
|
|
147
|
+
'text-accent-foreground web:pointer-events-none size-4 shrink-0'
|
|
148
|
+
)}
|
|
149
|
+
/>
|
|
150
|
+
<Text className="sr-only">Close</Text>
|
|
151
|
+
</DialogPrimitive.Close>
|
|
152
|
+
</DialogPrimitive.Content>
|
|
153
|
+
</DialogOverlay>
|
|
154
|
+
</DialogPortal>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Dialog header container
|
|
160
|
+
*
|
|
161
|
+
* Contains title and description with appropriate spacing and alignment.
|
|
162
|
+
* Centered on mobile, left-aligned on larger screens.
|
|
163
|
+
*/
|
|
164
|
+
function DialogHeader({ className, ...props }: ViewProps) {
|
|
165
|
+
return (
|
|
166
|
+
<View
|
|
167
|
+
className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
|
|
168
|
+
{...props}
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Dialog footer container
|
|
175
|
+
*
|
|
176
|
+
* Contains action buttons. Stacked vertically on mobile (reverse order),
|
|
177
|
+
* horizontal row on larger screens (right-aligned).
|
|
178
|
+
*/
|
|
179
|
+
function DialogFooter({ className, ...props }: ViewProps) {
|
|
180
|
+
return (
|
|
181
|
+
<View
|
|
182
|
+
className={cn(
|
|
183
|
+
'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',
|
|
184
|
+
className
|
|
185
|
+
)}
|
|
186
|
+
{...props}
|
|
187
|
+
/>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Dialog title component
|
|
193
|
+
*
|
|
194
|
+
* Large, semibold heading for the dialog. Automatically announced by screen readers.
|
|
195
|
+
*/
|
|
196
|
+
function DialogTitle({
|
|
197
|
+
className,
|
|
198
|
+
...props
|
|
199
|
+
}: DialogPrimitive.TitleProps & React.RefAttributes<DialogPrimitive.TitleRef>) {
|
|
200
|
+
return (
|
|
201
|
+
<DialogPrimitive.Title
|
|
202
|
+
className={cn(
|
|
203
|
+
'text-foreground text-lg font-semibold leading-none',
|
|
204
|
+
className
|
|
205
|
+
)}
|
|
206
|
+
{...props}
|
|
207
|
+
/>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Dialog description component
|
|
213
|
+
*
|
|
214
|
+
* Muted text providing additional context or instructions for the dialog.
|
|
215
|
+
*/
|
|
216
|
+
function DialogDescription({
|
|
217
|
+
className,
|
|
218
|
+
...props
|
|
219
|
+
}: DialogPrimitive.DescriptionProps &
|
|
220
|
+
React.RefAttributes<DialogPrimitive.DescriptionRef>) {
|
|
221
|
+
return (
|
|
222
|
+
<DialogPrimitive.Description
|
|
223
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
224
|
+
{...props}
|
|
225
|
+
/>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export {
|
|
230
|
+
Dialog,
|
|
231
|
+
DialogClose,
|
|
232
|
+
DialogContent,
|
|
233
|
+
DialogDescription,
|
|
234
|
+
DialogFooter,
|
|
235
|
+
DialogHeader,
|
|
236
|
+
DialogOverlay,
|
|
237
|
+
DialogPortal,
|
|
238
|
+
DialogTitle,
|
|
239
|
+
DialogTrigger,
|
|
240
|
+
};
|