reykit 1.0.252 → 1.0.254

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,8 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
+ export type Language = 'en' | 'zh';
2
3
  export type CoverContextParams = {
3
4
  isCovering: boolean;
4
5
  setIsCovering: (value: boolean) => void;
5
6
  };
7
+ export declare const useDefaultLanguage: () => Language, setDefaultLanguage: (newValue: Language) => void;
6
8
  /**
7
9
  * Create cover component and hook.
8
10
  *
@@ -7,7 +7,7 @@
7
7
  import * as ui from './ui';
8
8
  export { ui };
9
9
  export { TextBadges } from './Badge';
10
- export { type CoverContextParams, createCover, Loading, useLoading } from './Base';
10
+ export { type Language, type CoverContextParams, useDefaultLanguage, setDefaultLanguage, createCover, Loading, useLoading } from './Base';
11
11
  export { type BreadcrumbDict, Breadcrumb } from './Breadcrumb';
12
12
  export { CycleButton, ScrollToTopButton } from './Button';
13
13
  export { Form } from './Form';
@@ -52,6 +52,7 @@ import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia,
52
52
  import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, fieldVariants } from './field';
53
53
  import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, emptyMediaVariants } from './empty';
54
54
  import { SidebarProvider, SidebarInset, SidebarTrigger, Sidebar, SidebarRail, SidebarHeader, SidebarContent, SidebarFooter, SidebarSeparator, SidebarInput, SidebarGroup, SidebarGroupLabel, SidebarGroupAction, SidebarGroupContent, SidebarMenu, SidebarMenuSkeleton, SidebarMenuItem, SidebarMenuButton, SidebarMenuAction, SidebarMenuBadge, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, sidebarMenuButtonVariants, useSidebar } from './sidebar';
55
+ import { JsonViewer } from './json-viewer';
55
56
  import * as icon from './icon';
56
57
  /**
57
58
  * Hook of return popup box component dictionary by media inquiries.
@@ -69,4 +70,4 @@ declare function usePopupBox(): {
69
70
  } & PreviewCardPrimitive.Trigger.Props) => import("react/jsx-runtime").JSX.Element;
70
71
  PopupBoxContent: typeof HoverCardContent;
71
72
  };
72
- export { icon, Link, Button, buttonVariants, Badge, badgeVariants, Label, Input, Textarea, Checkbox, RadioGroup, RadioGroupItem, Switch, Toggle, toggleVariants, Kbd, Progress, Slider, Calendar, Spinner, Separator, Skeleton, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, inputGroupAddonVariants, inputGroupButtonVariants, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants, ToggleGroup, ToggleGroupItem, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Collapsible, CollapsibleContent, CollapsibleTrigger, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, alertVariants, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, HoverCard, HoverCardContent, HoverCardTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Popover, PopoverContent, PopoverTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogTitle, DialogTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogTitle, AlertDialogTrigger, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerTitle, DrawerTrigger, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Toaster, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants, ScrollArea, ScrollBar, AspectRatio, ResizableHandle, ResizablePanel, ResizablePanelGroup, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemSeparator, ItemTitle, itemVariants, itemMediaVariants, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, fieldVariants, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, emptyMediaVariants, SidebarProvider, SidebarInset, SidebarTrigger, Sidebar, SidebarRail, SidebarHeader, SidebarContent, SidebarFooter, SidebarSeparator, SidebarInput, SidebarGroup, SidebarGroupLabel, SidebarGroupAction, SidebarGroupContent, SidebarMenu, SidebarMenuSkeleton, SidebarMenuItem, SidebarMenuButton, SidebarMenuAction, SidebarMenuBadge, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, sidebarMenuButtonVariants, useSidebar, usePopupBox };
73
+ export { icon, Link, Button, buttonVariants, Badge, badgeVariants, Label, Input, Textarea, Checkbox, RadioGroup, RadioGroupItem, Switch, Toggle, toggleVariants, Kbd, Progress, Slider, Calendar, Spinner, Separator, Skeleton, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, inputGroupAddonVariants, inputGroupButtonVariants, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants, ToggleGroup, ToggleGroupItem, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Collapsible, CollapsibleContent, CollapsibleTrigger, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, alertVariants, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, HoverCard, HoverCardContent, HoverCardTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Popover, PopoverContent, PopoverTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogTitle, DialogTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogTitle, AlertDialogTrigger, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerTitle, DrawerTrigger, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Toaster, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants, ScrollArea, ScrollBar, AspectRatio, ResizableHandle, ResizablePanel, ResizablePanelGroup, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemSeparator, ItemTitle, itemVariants, itemMediaVariants, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, fieldVariants, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, emptyMediaVariants, SidebarProvider, SidebarInset, SidebarTrigger, Sidebar, SidebarRail, SidebarHeader, SidebarContent, SidebarFooter, SidebarSeparator, SidebarInput, SidebarGroup, SidebarGroupLabel, SidebarGroupAction, SidebarGroupContent, SidebarMenu, SidebarMenuSkeleton, SidebarMenuItem, SidebarMenuButton, SidebarMenuAction, SidebarMenuBadge, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, sidebarMenuButtonVariants, JsonViewer, useSidebar, usePopupBox };
@@ -0,0 +1,24 @@
1
+ import { default as React } from 'react';
2
+ import { Button } from './button';
3
+ interface JsonViewerProps {
4
+ data: Record<string, any>;
5
+ className?: string;
6
+ truncation?: Partial<TruncationSettings>;
7
+ showLineNumbers?: boolean;
8
+ showColorIndent?: boolean;
9
+ collapseOn?: 'click' | 'doubleClick';
10
+ defaultExpanded?: boolean | number;
11
+ title?: string;
12
+ language?: 'en' | 'zh';
13
+ }
14
+ interface TruncationSettings {
15
+ enabled: boolean;
16
+ itemsPerArray: number;
17
+ }
18
+ declare function JsonViewer({ data, className, truncation: truncationProp, showLineNumbers, showColorIndent, collapseOn, defaultExpanded, title, language }: JsonViewerProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function CopyButton({ value, className, variant, language, ...props }: React.ComponentProps<typeof Button> & {
20
+ value: string;
21
+ src?: string;
22
+ language?: 'en' | 'zh';
23
+ }): import("react/jsx-runtime").JSX.Element;
24
+ export { JsonViewer };
@@ -41,17 +41,17 @@ export declare function useCount(start?: number, step?: number, stop?: number, l
41
41
  */
42
42
  export declare function useIndex(array: any[], loop?: boolean): [number, () => void];
43
43
  /**
44
- * Force update render.
44
+ * Hook of force update render.
45
45
  */
46
46
  export declare function useRender(): () => void;
47
47
  /**
48
- * Whether is mobile client.
48
+ * Hook of whether is mobile client.
49
49
  *
50
50
  * @returns Judgement.
51
51
  */
52
52
  export declare function useIsMobile(): boolean;
53
53
  /**
54
- * Get value by client type.
54
+ * Hook of get value by client type.
55
55
  *
56
56
  * @param mobileValue - Value of mobile client.
57
57
  * @param value - Value of non mobile client.
@@ -59,10 +59,17 @@ export declare function useIsMobile(): boolean;
59
59
  */
60
60
  export declare function useValueByMobile<Value, MobileValue>(mobileValue: MobileValue, value: Value): Value | MobileValue;
61
61
  /**
62
- * Execute after rendering or effecting.
62
+ * Hook of execute after rendering or effecting.
63
63
  *
64
64
  * @param func - Execute function.
65
65
  * @param deps - Effect dependency list.
66
66
  * @param args - Execute arguments.
67
67
  */
68
68
  export declare function useExec<T extends any[]>(func: (...args: T) => any | Promise<any>, deps?: DependencyList, args?: T): void;
69
+ /**
70
+ * Get state value that can be updated externally.
71
+ *
72
+ * @param initialValue - Initial state value.
73
+ * @returns Get state value hook function and set state value general function.
74
+ */
75
+ export declare function createExternalState<State>(initialValue: State): [() => State, (newValue: State) => void];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reykit",
3
- "version": "1.0.252",
3
+ "version": "1.0.254",
4
4
  "description": "General-purpose JavaScript utility method package.",
5
5
  "author": "reyxbo",
6
6
  "keywords": [