@refraction-ui/react 0.2.0 → 0.2.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/dist/index.cjs +69 -94
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +69 -95
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -157,6 +157,7 @@ __export(index_exports, {
|
|
|
157
157
|
PRESENCE_STATUS_COLORS: () => STATUS_COLORS,
|
|
158
158
|
PRESENCE_STATUS_LABELS: () => STATUS_LABELS,
|
|
159
159
|
Pagination: () => Pagination,
|
|
160
|
+
Payment: () => Payment,
|
|
160
161
|
Popover: () => Popover,
|
|
161
162
|
PopoverClose: () => PopoverClose,
|
|
162
163
|
PopoverContent: () => PopoverContent,
|
|
@@ -1138,106 +1139,16 @@ function getAssignableRoles(user) {
|
|
|
1138
1139
|
if (hasRole(user, "reviewer")) return ["student"];
|
|
1139
1140
|
return [];
|
|
1140
1141
|
}
|
|
1141
|
-
function createMockAdapter(initialUser) {
|
|
1142
|
-
let currentUser = initialUser ?? null;
|
|
1143
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
1144
|
-
function notify() {
|
|
1145
|
-
for (const fn of listeners) {
|
|
1146
|
-
fn(currentUser);
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
return {
|
|
1150
|
-
async signIn(email, _password) {
|
|
1151
|
-
currentUser = {
|
|
1152
|
-
uid: "mock-" + email,
|
|
1153
|
-
email,
|
|
1154
|
-
displayName: email.split("@")[0],
|
|
1155
|
-
photoURL: null,
|
|
1156
|
-
roles: ["student"]
|
|
1157
|
-
};
|
|
1158
|
-
notify();
|
|
1159
|
-
return currentUser;
|
|
1160
|
-
},
|
|
1161
|
-
async signInWithOAuth(_provider) {
|
|
1162
|
-
currentUser = {
|
|
1163
|
-
uid: "mock-oauth",
|
|
1164
|
-
email: "oauth@example.com",
|
|
1165
|
-
displayName: "OAuth User",
|
|
1166
|
-
photoURL: null,
|
|
1167
|
-
roles: ["student"]
|
|
1168
|
-
};
|
|
1169
|
-
notify();
|
|
1170
|
-
return currentUser;
|
|
1171
|
-
},
|
|
1172
|
-
async signUp(email, _password, displayName) {
|
|
1173
|
-
currentUser = {
|
|
1174
|
-
uid: "mock-" + email,
|
|
1175
|
-
email,
|
|
1176
|
-
displayName,
|
|
1177
|
-
photoURL: null,
|
|
1178
|
-
roles: ["student"]
|
|
1179
|
-
};
|
|
1180
|
-
notify();
|
|
1181
|
-
return currentUser;
|
|
1182
|
-
},
|
|
1183
|
-
async signOut() {
|
|
1184
|
-
currentUser = null;
|
|
1185
|
-
notify();
|
|
1186
|
-
},
|
|
1187
|
-
async resetPassword(_email) {
|
|
1188
|
-
},
|
|
1189
|
-
async getToken() {
|
|
1190
|
-
return currentUser ? "mock-token-" + currentUser.uid : null;
|
|
1191
|
-
},
|
|
1192
|
-
onAuthStateChange(callback) {
|
|
1193
|
-
listeners.add(callback);
|
|
1194
|
-
callback(currentUser);
|
|
1195
|
-
return () => {
|
|
1196
|
-
listeners.delete(callback);
|
|
1197
|
-
};
|
|
1198
|
-
}
|
|
1199
|
-
};
|
|
1200
|
-
}
|
|
1201
|
-
function resolveAdapter(provider) {
|
|
1202
|
-
const resolved = provider ?? detectProvider();
|
|
1203
|
-
switch (resolved) {
|
|
1204
|
-
case "firebase":
|
|
1205
|
-
if (typeof console !== "undefined") {
|
|
1206
|
-
console.warn("[refraction-ui/auth] Firebase adapter not yet implemented. Using mock adapter.");
|
|
1207
|
-
}
|
|
1208
|
-
return createMockAdapter();
|
|
1209
|
-
case "supabase":
|
|
1210
|
-
if (typeof console !== "undefined") {
|
|
1211
|
-
console.warn("[refraction-ui/auth] Supabase adapter not yet implemented. Using mock adapter.");
|
|
1212
|
-
}
|
|
1213
|
-
return createMockAdapter();
|
|
1214
|
-
case "mock":
|
|
1215
|
-
return createMockAdapter();
|
|
1216
|
-
case "none":
|
|
1217
|
-
default:
|
|
1218
|
-
return createMockAdapter();
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
function detectProvider() {
|
|
1222
|
-
const env = typeof process !== "undefined" ? process.env : {};
|
|
1223
|
-
const explicit = env["REFRACTION_AUTH_PROVIDER"];
|
|
1224
|
-
if (explicit) return explicit;
|
|
1225
|
-
if (env["FIREBASE_API_KEY"] || env["NEXT_PUBLIC_FIREBASE_API_KEY"]) {
|
|
1226
|
-
return "firebase";
|
|
1227
|
-
}
|
|
1228
|
-
if (env["SUPABASE_URL"] || env["NEXT_PUBLIC_SUPABASE_URL"]) {
|
|
1229
|
-
return "supabase";
|
|
1230
|
-
}
|
|
1231
|
-
return "none";
|
|
1232
|
-
}
|
|
1233
1142
|
|
|
1234
1143
|
// ../react-auth/dist/index.js
|
|
1235
1144
|
var AuthContext = React41.createContext(null);
|
|
1236
1145
|
function AuthProvider({ children, ...config }) {
|
|
1237
1146
|
const authRef = React41.useRef(null);
|
|
1238
1147
|
if (!authRef.current) {
|
|
1239
|
-
|
|
1240
|
-
|
|
1148
|
+
if (!config.adapter) {
|
|
1149
|
+
throw new Error("[refraction-ui/react-auth] You must provide an `adapter` to AuthProvider.");
|
|
1150
|
+
}
|
|
1151
|
+
authRef.current = createAuth(config.adapter, config);
|
|
1241
1152
|
}
|
|
1242
1153
|
const [state, setState] = React41.useState(() => authRef.current.getState());
|
|
1243
1154
|
React41.useEffect(() => {
|
|
@@ -12326,6 +12237,69 @@ var CardGrid = React41.forwardRef(
|
|
|
12326
12237
|
);
|
|
12327
12238
|
CardGrid.displayName = "CardGrid";
|
|
12328
12239
|
|
|
12329
|
-
|
|
12240
|
+
// ../payment/dist/index.js
|
|
12241
|
+
function createPayment(props = {}) {
|
|
12242
|
+
return {
|
|
12243
|
+
props: {
|
|
12244
|
+
...props,
|
|
12245
|
+
"data-slot": "payment"
|
|
12246
|
+
}
|
|
12247
|
+
};
|
|
12248
|
+
}
|
|
12249
|
+
var Payment = React41.forwardRef(
|
|
12250
|
+
({ className, disabled, ...props }, ref) => {
|
|
12251
|
+
const api = createPayment({ disabled });
|
|
12252
|
+
return /* @__PURE__ */ jsx(
|
|
12253
|
+
"div",
|
|
12254
|
+
{
|
|
12255
|
+
ref,
|
|
12256
|
+
className: cn(
|
|
12257
|
+
"w-full max-w-md mx-auto p-6 border border-border rounded-xl bg-card text-card-foreground shadow-sm",
|
|
12258
|
+
disabled && "opacity-50 pointer-events-none",
|
|
12259
|
+
className
|
|
12260
|
+
),
|
|
12261
|
+
...api.props,
|
|
12262
|
+
...props
|
|
12263
|
+
}
|
|
12264
|
+
);
|
|
12265
|
+
}
|
|
12266
|
+
);
|
|
12267
|
+
Payment.displayName = "Payment";
|
|
12268
|
+
var PaymentHeader = React41.forwardRef(
|
|
12269
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-6 flex flex-col gap-1.5", className), ...props })
|
|
12270
|
+
);
|
|
12271
|
+
PaymentHeader.displayName = "PaymentHeader";
|
|
12272
|
+
var PaymentTitle = React41.forwardRef(
|
|
12273
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("h3", { ref, className: cn("text-xl font-semibold leading-none tracking-tight", className), ...props })
|
|
12274
|
+
);
|
|
12275
|
+
PaymentTitle.displayName = "PaymentTitle";
|
|
12276
|
+
var PaymentDescription = React41.forwardRef(
|
|
12277
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props })
|
|
12278
|
+
);
|
|
12279
|
+
PaymentDescription.displayName = "PaymentDescription";
|
|
12280
|
+
var PaymentContent = React41.forwardRef(
|
|
12281
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col gap-4", className), ...props })
|
|
12282
|
+
);
|
|
12283
|
+
PaymentContent.displayName = "PaymentContent";
|
|
12284
|
+
var PaymentFooter = React41.forwardRef(
|
|
12285
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mt-6 flex flex-col gap-3", className), ...props })
|
|
12286
|
+
);
|
|
12287
|
+
PaymentFooter.displayName = "PaymentFooter";
|
|
12288
|
+
var PaymentButton = React41.forwardRef(
|
|
12289
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
12290
|
+
"button",
|
|
12291
|
+
{
|
|
12292
|
+
ref,
|
|
12293
|
+
className: cn(
|
|
12294
|
+
"inline-flex w-full items-center justify-center whitespace-nowrap rounded-md bg-primary px-4 py-2.5 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
12295
|
+
className
|
|
12296
|
+
),
|
|
12297
|
+
...props
|
|
12298
|
+
}
|
|
12299
|
+
)
|
|
12300
|
+
);
|
|
12301
|
+
PaymentButton.displayName = "PaymentButton";
|
|
12302
|
+
|
|
12303
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AnimatedText, AppShell, AuthGuard, AuthProvider, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, BadgeDisplay, BottomNav, Breadcrumbs, Button, CATEGORY_LABELS, Calendar, CalendarHeader, Callout, Card2 as Card, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselTrigger, Checkbox, CodeBlock, CodeEditor, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, ContentProtection, DataTable, DatePicker, DeviceFrame, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogTitle, DialogTrigger, DiffViewer, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EMOJI_CATEGORIES, EMOJI_DATA, EmojiPicker, FeedbackButton, FeedbackDialog, FileUpload, Footer, InlineEditor, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InstallPrompt, KeyboardShortcut, LanguageSelector, LinkCard, MarkdownRenderer, MobileNav, MobileNavContent, MobileNavLink, MobileNavTrigger, Navbar, OtpInput, STATUS_COLORS as PRESENCE_STATUS_COLORS, STATUS_LABELS as PRESENCE_STATUS_LABELS, Pagination, Payment, Popover, PopoverClose, PopoverContent, PopoverTrigger, PresenceIndicator, ProgressBar, RadioGroup, RadioItem, ReactionBar, ResizableDivider, ResizableLayout, ResizablePane, STATUS_COLORS2 as STATUS_COLORS, STATUS_LABELS2 as STATUS_LABELS, SearchBar, SearchResultItem, SearchResults, Select, SelectContent, SelectItem, SelectTrigger, ShortcutBadge, Sidebar, Skeleton, SkeletonText, SkipToContent, SlideViewer, StatsGrid, StatusIndicator, Steps, Switch, TableOfContents, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeScript, ThemeToggle, ThreadView, Toast, ToastProvider, Toaster, Tooltip, TooltipContent, TooltipTrigger, TypewriterText, VersionSelector, VideoPlayer, animatedTextVariants, avatarFallbackVariants, avatarImageVariants, avatarTokens, avatarVariants, badgeGridVariants, badgeItemVariants, badgeVariants, bottomNavTabVariants, bottomNavVariants, breadcrumbItemVariants, breadcrumbSeparatorStyles, breadcrumbsVariants, buttonTokens, buttonVariants, calendarVariants, canAccessAdmin, canAccessReviewer, cardContentVariants, cardDescriptionVariants, cardFooterVariants, cardHeaderVariants, cardTitleVariants, cardTokens, cardVariants, cellVariants, checkIconPath, checkboxTokens, checkboxVariants, codeEditorTokens, codeEditorVariants, collapsibleContentVariants, commandGroupVariants, commandInputVariants, commandItemVariants, commandVariants, contentProtectionVariants, controlsVariants, createDiffViewer, dayVariants, deviceFrameVariants, dialogContentVariants, diffViewerTokens, diffViewerVariants, editorVariants, emojiPickerContainerStyles, emojiPickerEmojiButtonStyles, emojiPickerGridStyles, feedbackDialogVariants, fileUploadDropZoneVariants, fileUploadFileItemStyles, fileUploadFileListStyles, footerVariants, formatFileSize, formatRelativeTime, formatShortcut, formatTimestamp, getAssignableRoles, getDefaultPortal, getInitials, hasAllRoles, hasAnyRole, hasRole, headerVariants, indeterminateIconPath, inputGroupAddonVariants, inputGroupButtonVariants, inputGroupTokens, inputGroupVariants, inputVariants, installPromptVariants, latestBadgeVariants, markdownRendererTokens, menuContentVariants, menuItemVariants, mobileNavContentVariants, mobileNavLinkVariants, mobileNavTokens, mobileNavTriggerVariants, mobileNavVariants, navLinkVariants, navbarVariants, optionVariants, otpInputContainerVariants, otpInputSlotVariants, otpInputTokens, overlayStyles, overlayVariants, playerVariants, popoverContentVariants, previewVariants, progressBarVariants, proseVariants, radioCircleVariants, radioGroupVariants, radioItemVariants, reactionAddButtonStyles, reactionBarStyles, reactionCountStyles, reactionEmojiStyles, reactionPillVariants, resizableDividerVariants, resizableLayoutTokens, resizableLayoutVariants, resizablePaneVariants, rowVariants, searchBarVariants, searchResultVariants, selectContentVariants, selectItemVariants, selectTokens, selectTriggerVariants, selectorVariants, shortcutBadgeStyles, shortcutKeyStyles, shortcutSeparatorStyles, skeletonVariants, slideTypeBadgeVariants, progressBarVariants2 as slideViewerProgressBarVariants, slideViewerTokens, slideViewerVariants, statCardVariants, statsGridVariants, statusBarVariants, statusContainerStyles, statusDotVariants, statusLabelStyles, statusPulseVariants, switchThumbVariants, switchTokens, switchVariants, tabBarVariants, tabVariants, tableVariants, tabsListVariants, tabsTriggerVariants, textareaVariants, threadAuthorStyles, threadAvatarStyles, threadBodyStyles, threadContainerStyles, threadContentStyles, threadMessageStyles, threadReactionsStyles, threadTimestampStyles, toastVariants, toolbarVariants, tooltipContentVariants, typewriterVariants, useAuth, useTheme, useToast, optionVariants2 as versionSelectorOptionVariants, versionSelectorVariants, watermarkVariants };
|
|
12330
12304
|
//# sourceMappingURL=index.js.map
|
|
12331
12305
|
//# sourceMappingURL=index.js.map
|