@yimingliao/cms 0.0.117 → 0.0.119
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import * as React15 from 'react';
|
|
2
|
+
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
3
|
+
import { UAParser } from 'ua-parser-js';
|
|
1
4
|
import { clsx } from 'clsx';
|
|
2
5
|
import { twMerge } from 'tailwind-merge';
|
|
3
|
-
import * as React15 from 'react';
|
|
4
|
-
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
5
6
|
import { usePathname } from 'next/navigation';
|
|
6
|
-
import { UAParser } from 'ua-parser-js';
|
|
7
7
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
8
8
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -17,10 +17,47 @@ import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
|
17
17
|
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
18
18
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
19
19
|
|
|
20
|
-
// src/client/applications/
|
|
20
|
+
// src/client/applications/auth/sign-in/use-device-info.ts
|
|
21
|
+
function useDeviceInfo() {
|
|
22
|
+
const [deviceInfo, setDeviceInfo] = useState(null);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const parser = new UAParser(navigator.userAgent);
|
|
25
|
+
const result = parser.getResult();
|
|
26
|
+
setDeviceInfo({
|
|
27
|
+
deviceType: result.device.type || "desktop",
|
|
28
|
+
platform: result.os.name || "Unknown",
|
|
29
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
30
|
+
language: navigator.language,
|
|
31
|
+
screenResolution: {
|
|
32
|
+
width: window.screen.width,
|
|
33
|
+
height: window.screen.height
|
|
34
|
+
},
|
|
35
|
+
browser: result.browser.name || "Unknown",
|
|
36
|
+
browserVersion: result.browser.version || "",
|
|
37
|
+
userAgent: navigator.userAgent
|
|
38
|
+
});
|
|
39
|
+
}, []);
|
|
40
|
+
return deviceInfo;
|
|
41
|
+
}
|
|
21
42
|
var cn = (...inputs) => {
|
|
22
43
|
return twMerge(clsx(inputs));
|
|
23
44
|
};
|
|
45
|
+
var MOBILE_BREAKPOINT = 768;
|
|
46
|
+
var useIsMobile = () => {
|
|
47
|
+
const [isMobile, setIsMobile] = React15.useState();
|
|
48
|
+
React15.useEffect(() => {
|
|
49
|
+
const mql = globalThis.matchMedia(
|
|
50
|
+
`(max-width: ${MOBILE_BREAKPOINT - 1}px)`
|
|
51
|
+
);
|
|
52
|
+
const onChange = () => {
|
|
53
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
54
|
+
};
|
|
55
|
+
mql.addEventListener("change", onChange);
|
|
56
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
57
|
+
return () => mql.removeEventListener("change", onChange);
|
|
58
|
+
}, []);
|
|
59
|
+
return !!isMobile;
|
|
60
|
+
};
|
|
24
61
|
var useCountdown = (initialTime) => {
|
|
25
62
|
const [timeLeft, setTimeLeft] = useState(initialTime);
|
|
26
63
|
const [isCounting, setIsCounting] = useState(false);
|
|
@@ -62,43 +99,6 @@ var useParentPathname = () => {
|
|
|
62
99
|
var isConfirm = (t, key = "ui.dialog.confirm.text") => {
|
|
63
100
|
return confirm(t(key));
|
|
64
101
|
};
|
|
65
|
-
function useDeviceInfo() {
|
|
66
|
-
const [deviceInfo, setDeviceInfo] = useState(null);
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
const parser = new UAParser(navigator.userAgent);
|
|
69
|
-
const result = parser.getResult();
|
|
70
|
-
setDeviceInfo({
|
|
71
|
-
deviceType: result.device.type || "desktop",
|
|
72
|
-
platform: result.os.name || "Unknown",
|
|
73
|
-
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
74
|
-
language: navigator.language,
|
|
75
|
-
screenResolution: {
|
|
76
|
-
width: window.screen.width,
|
|
77
|
-
height: window.screen.height
|
|
78
|
-
},
|
|
79
|
-
browser: result.browser.name || "Unknown",
|
|
80
|
-
browserVersion: result.browser.version || "",
|
|
81
|
-
userAgent: navigator.userAgent
|
|
82
|
-
});
|
|
83
|
-
}, []);
|
|
84
|
-
return deviceInfo;
|
|
85
|
-
}
|
|
86
|
-
var MOBILE_BREAKPOINT = 768;
|
|
87
|
-
var useIsMobile = () => {
|
|
88
|
-
const [isMobile, setIsMobile] = React15.useState();
|
|
89
|
-
React15.useEffect(() => {
|
|
90
|
-
const mql = globalThis.matchMedia(
|
|
91
|
-
`(max-width: ${MOBILE_BREAKPOINT - 1}px)`
|
|
92
|
-
);
|
|
93
|
-
const onChange = () => {
|
|
94
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
95
|
-
};
|
|
96
|
-
mql.addEventListener("change", onChange);
|
|
97
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
98
|
-
return () => mql.removeEventListener("change", onChange);
|
|
99
|
-
}, []);
|
|
100
|
-
return !!isMobile;
|
|
101
|
-
};
|
|
102
102
|
|
|
103
103
|
// src/client/interfaces/styles/constants.ts
|
|
104
104
|
var NAVBAR_HEIGHT = 60;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { LucideIcon } from 'lucide-react';
|
|
|
12
12
|
import { B as ButtonProps$1, L as LabelProps } from '../sidebar-CBC8_O5A.js';
|
|
13
13
|
export { S as Sidebar, a as SidebarContent, b as SidebarInset, c as SidebarProvider, u as useSidebar } from '../sidebar-CBC8_O5A.js';
|
|
14
14
|
import { U as UIStates, F as FormData, a as FormFieldController } from '../types-BUmWwzpD.js';
|
|
15
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
15
16
|
import { ClassValue } from 'clsx';
|
|
16
17
|
import 'zod';
|
|
17
18
|
import 'zod/v4/core';
|
|
@@ -521,6 +522,19 @@ interface SearchInputProps extends InputProps {
|
|
|
521
522
|
}
|
|
522
523
|
declare function SearchInput({ searchString, setSearchString, isLoading, isDisabled, ...props }: SearchInputProps): react_jsx_runtime.JSX.Element;
|
|
523
524
|
|
|
525
|
+
interface SelectProps<T extends FormData> extends ComponentProps<typeof SelectPrimitive.Root>, FormFieldController<T> {
|
|
526
|
+
className?: string;
|
|
527
|
+
placeholder?: string;
|
|
528
|
+
label?: string;
|
|
529
|
+
id?: string;
|
|
530
|
+
}
|
|
531
|
+
declare function Select<T extends FormData>({ fieldName, setFormData, isDisabled, isLoading, placeholder, label, className, children, ...props }: SelectProps<T>): react_jsx_runtime.JSX.Element;
|
|
532
|
+
declare function Option({ value, isDisabled, children, }: {
|
|
533
|
+
value: string;
|
|
534
|
+
isDisabled?: boolean;
|
|
535
|
+
children: ReactNode;
|
|
536
|
+
}): react_jsx_runtime.JSX.Element;
|
|
537
|
+
|
|
524
538
|
interface TextareaProps<T extends FormData = FormData> extends ComponentProps<"textarea">, FormFieldController<T> {
|
|
525
539
|
}
|
|
526
540
|
declare function Textarea<T extends FormData = FormData>({ fieldName, setFormData, isLoading, isDisabled, isError, ...props }: TextareaProps<T>): react_jsx_runtime.JSX.Element;
|
|
@@ -601,8 +615,8 @@ declare const NAVBAR_HEIGHT = 60;
|
|
|
601
615
|
declare const SIDEBAR_WIDTH = 288;
|
|
602
616
|
declare const PAGE_HEADER_HEIGHT = 56;
|
|
603
617
|
|
|
604
|
-
declare const cn: (...inputs: ClassValue[]) => string;
|
|
605
|
-
|
|
606
618
|
declare function useDeviceInfo(): DeviceInfo | null;
|
|
607
619
|
|
|
608
|
-
|
|
620
|
+
declare const cn: (...inputs: ClassValue[]) => string;
|
|
621
|
+
|
|
622
|
+
export { AdminProvider, ArrayInput, Button, type ButtonProps, Checkbox, ContentContainer, ControlFields, type ControlMeta, Field, FieldBody, FieldsContainer, Form, IndexField, Input, type InputProps, LayoutSkeleton, ListCardsContainer, MainFields, NAVBAR_HEIGHT, type NavItem, NavMain, Option, PAGE_HEADER_HEIGHT, PageHeader, PasswordInput, ReturnButton, SIDEBAR_WIDTH, SearchInput, Select, type ShowToastOption, SideFields, SlugField, Textarea, ThemeProvider, cn, createAdminInitializer, createChangePasswordPage, createEmailUnverifiedPage, createForgotPasswordPage, createI18nSelector, createNavbar, createRequestInterceptor, createResetPasswordPage, createResponseInterceptor, createSignInPage, createSignOutButton, createSmartFetch, createUseCommand, createUseQuery, createVerifyEmailPage, handleToast, useAdmin, useDeviceInfo };
|
package/dist/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cn, useSidebar, Sidebar, Skeleton, SidebarInset, SIDEBAR_WIDTH, SidebarGroup, SidebarMenu, Collapsible, SidebarMenuItem, SidebarMenuButton, Separator, CollapsibleTrigger, SidebarMenuAction, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, Button, Spinner, useParentPathname, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, PAGE_HEADER_HEIGHT, InputGroup, InputGroupAddon, Textarea, InputGroupInput, InputGroupButton, Label, FORM_MIDDLE_GAP_WIDTH, FORM_SIDE_FIELDS_WIDTH, Card, useDeviceInfo, CardHeader, CardTitle, CardContent, useCountdown, CardDescription, NAVBAR_HEIGHT, isConfirm, Avatar, AvatarImage, AvatarFallback, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup, Pagination, PaginationContent, PaginationItem, PaginationPrevious, PaginationLink, PaginationEllipsis, PaginationNext
|
|
2
|
-
export { NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT, SIDEBAR_WIDTH, Sidebar, SidebarContent, SidebarInset, SidebarProvider, cn, useDeviceInfo, useSidebar } from '../chunk-
|
|
1
|
+
import { cn, useSidebar, Sidebar, Skeleton, SidebarInset, SIDEBAR_WIDTH, SidebarGroup, SidebarMenu, Collapsible, SidebarMenuItem, SidebarMenuButton, Separator, CollapsibleTrigger, SidebarMenuAction, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, Button, Spinner, useParentPathname, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, PAGE_HEADER_HEIGHT, InputGroup, InputGroupAddon, Textarea, InputGroupInput, InputGroupButton, Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel, SelectItem, Label, FORM_MIDDLE_GAP_WIDTH, FORM_SIDE_FIELDS_WIDTH, Card, useDeviceInfo, CardHeader, CardTitle, CardContent, useCountdown, CardDescription, NAVBAR_HEIGHT, isConfirm, Avatar, AvatarImage, AvatarFallback, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup, Pagination, PaginationContent, PaginationItem, PaginationPrevious, PaginationLink, PaginationEllipsis, PaginationNext } from '../chunk-NDMQTMQL.js';
|
|
2
|
+
export { NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT, SIDEBAR_WIDTH, Sidebar, SidebarContent, SidebarInset, SidebarProvider, cn, useDeviceInfo, useSidebar } from '../chunk-NDMQTMQL.js';
|
|
3
3
|
import { ensureArray, findTranslation, joinUrl } from '../chunk-VSV6SQWC.js';
|
|
4
4
|
import { toast } from 'sonner';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -2517,4 +2517,4 @@ function createChangePasswordPage({
|
|
|
2517
2517
|
};
|
|
2518
2518
|
}
|
|
2519
2519
|
|
|
2520
|
-
export { AdminProvider, ArrayInput, Button2 as Button, Checkbox, ContentContainer, ControlFields, Field, FieldBody, FieldsContainer, Form, IndexField, Input, LayoutSkeleton, ListCardsContainer, MainFields, NavMain, PageHeader, PasswordInput, ReturnButton, SearchInput, SideFields, SlugField, Textarea2 as Textarea, ThemeProvider, createAdminInitializer, createChangePasswordPage, createEmailUnverifiedPage, createForgotPasswordPage, createI18nSelector, createNavbar, createRequestInterceptor, createResetPasswordPage, createResponseInterceptor, createSignInPage, createSignOutButton, createSmartFetch, createUseCommand, createUseQuery, createVerifyEmailPage, handleToast, useAdmin };
|
|
2520
|
+
export { AdminProvider, ArrayInput, Button2 as Button, Checkbox, ContentContainer, ControlFields, Field, FieldBody, FieldsContainer, Form, IndexField, Input, LayoutSkeleton, ListCardsContainer, MainFields, NavMain, Option, PageHeader, PasswordInput, ReturnButton, SearchInput, Select2 as Select, SideFields, SlugField, Textarea2 as Textarea, ThemeProvider, createAdminInitializer, createChangePasswordPage, createEmailUnverifiedPage, createForgotPasswordPage, createI18nSelector, createNavbar, createRequestInterceptor, createResetPasswordPage, createResponseInterceptor, createSignInPage, createSignOutButton, createSmartFetch, createUseCommand, createUseQuery, createVerifyEmailPage, handleToast, useAdmin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Avatar, AvatarFallback, AvatarImage, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, SIDEBAR_COOKIE_NAME, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, useSidebar } from '../../chunk-
|
|
1
|
+
export { Avatar, AvatarFallback, AvatarImage, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, SIDEBAR_COOKIE_NAME, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, useSidebar } from '../../chunk-NDMQTMQL.js';
|