@chaos_team/chaos-ui 1.0.5

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +286 -0
  2. package/LICENSE +21 -0
  3. package/README.md +295 -0
  4. package/THIRD_PARTY_NOTICES.md +22 -0
  5. package/dist/business.cjs +26 -0
  6. package/dist/business.d.cts +10311 -0
  7. package/dist/business.d.ts +10311 -0
  8. package/dist/business.js +26 -0
  9. package/dist/format-BUpOzeCo.d.cts +8 -0
  10. package/dist/format-BUpOzeCo.d.ts +8 -0
  11. package/dist/hooks.cjs +8 -0
  12. package/dist/hooks.d.cts +1148 -0
  13. package/dist/hooks.d.ts +1148 -0
  14. package/dist/hooks.js +8 -0
  15. package/dist/index.cjs +6 -0
  16. package/dist/index.d.cts +5616 -0
  17. package/dist/index.d.ts +5616 -0
  18. package/dist/index.js +6 -0
  19. package/dist/lib.cjs +42 -0
  20. package/dist/lib.d.cts +804 -0
  21. package/dist/lib.d.ts +804 -0
  22. package/dist/lib.js +42 -0
  23. package/dist/message-KJli9tvf.d.cts +71 -0
  24. package/dist/message-KJli9tvf.d.ts +71 -0
  25. package/dist/message-provider-BI-P3CNq.d.cts +11 -0
  26. package/dist/message-provider-BI-P3CNq.d.ts +11 -0
  27. package/dist/next.cjs +6 -0
  28. package/dist/next.d.cts +103 -0
  29. package/dist/next.d.ts +103 -0
  30. package/dist/next.js +6 -0
  31. package/dist/theme-toggle-JL_jZE-w.d.cts +81 -0
  32. package/dist/theme-toggle-JL_jZE-w.d.ts +81 -0
  33. package/dist/time-picker-H1AaecnE.d.cts +452 -0
  34. package/dist/time-picker-H1AaecnE.d.ts +452 -0
  35. package/dist/ui/icons.cjs +6 -0
  36. package/dist/ui/icons.d.cts +3 -0
  37. package/dist/ui/icons.d.ts +3 -0
  38. package/dist/ui/icons.js +6 -0
  39. package/dist/ui-icons.cjs +6 -0
  40. package/dist/ui-icons.d.cts +205 -0
  41. package/dist/ui-icons.d.ts +205 -0
  42. package/dist/ui-icons.js +6 -0
  43. package/dist/ui.cjs +6 -0
  44. package/dist/ui.d.cts +39 -0
  45. package/dist/ui.d.ts +39 -0
  46. package/dist/ui.js +6 -0
  47. package/package.json +265 -0
  48. package/styles.css +1300 -0
  49. package/styles.css.d.ts +11 -0
@@ -0,0 +1,103 @@
1
+ import * as React from 'react';
2
+ import { ToasterProps } from 'sonner';
3
+ export { M as MessageProvider, a as MessageProviderProps } from './message-provider-BI-P3CNq.cjs';
4
+ export { E as ErrorPage, I as InternalError, N as NotFound, T as ThemeToggle, U as Unauthorized, u as useResolvedTheme } from './theme-toggle-JL_jZE-w.cjs';
5
+
6
+ /**
7
+ * @component Toaster
8
+ * @category ui/feedback
9
+ * @since 0.2.0
10
+ * @description Toast notification renderer using Sonner, themed with application icons and colors / 基于 Sonner 的吐司通知渲染器,使用应用图标和颜色主题化
11
+ * @keywords toast, sonner, notification, feedback, alert, 通知, 吐司
12
+ * @example
13
+ * <Toaster />
14
+ */
15
+ declare const Toaster: ({ ...props }: ToasterProps) => React.JSX.Element;
16
+
17
+ interface MobileNavItem {
18
+ label: string;
19
+ href: string;
20
+ icon: React.ReactNode;
21
+ badge?: number | string;
22
+ active?: boolean;
23
+ }
24
+ interface MobileBottomNavProps extends Omit<React.ComponentProps<"nav">, "onChange"> {
25
+ items: MobileNavItem[];
26
+ onChange?: (href: string) => void;
27
+ variant?: "default" | "floating";
28
+ className?: string;
29
+ }
30
+ declare function MobileBottomNav({ items, onChange, variant, className, ...props }: MobileBottomNavProps): React.JSX.Element;
31
+
32
+ interface PublicLayoutProps extends React.ComponentProps<"div"> {
33
+ logo?: React.ReactNode;
34
+ nav?: Array<{
35
+ label: string;
36
+ href: string;
37
+ }>;
38
+ footer?: React.ReactNode;
39
+ headerActions?: React.ReactNode;
40
+ className?: string;
41
+ }
42
+ /**
43
+ * @component PublicLayout
44
+ * @category layout/admin
45
+ * @since 0.2.0
46
+ * @description Public-facing page layout with sticky header, navigation links, and optional footer, suitable for landing or marketing pages / 面向公众的页面布局,包含固定头部、导航链接和可选页脚,适用于落地页或营销页面
47
+ * @keywords public, layout, landing, header, footer, navigation, marketing
48
+ * @example
49
+ * <PublicLayout logo={<Brand />} nav={[{ label: "Home", href: "/" }]}>
50
+ * <HeroSection />
51
+ * </PublicLayout>
52
+ */
53
+ declare function PublicLayout({ logo, nav, footer, headerActions, className, children, ...props }: PublicLayoutProps): React.JSX.Element;
54
+
55
+ interface TopBarItem {
56
+ label: string;
57
+ href: string;
58
+ icon?: React.ReactNode;
59
+ children?: TopBarItem[];
60
+ }
61
+ interface TopBarProps extends React.ComponentProps<"header"> {
62
+ logo?: React.ReactNode;
63
+ logoHref?: string;
64
+ nav?: TopBarItem[];
65
+ actions?: React.ReactNode;
66
+ sticky?: boolean;
67
+ variant?: "default" | "transparent" | "bordered";
68
+ className?: string;
69
+ }
70
+ /**
71
+ * @component TopBar
72
+ * @category layout/admin
73
+ * @since 0.2.0
74
+ * @description Responsive top navigation bar with logo, dropdown mega-menus, mobile hamburger drawer, and action slots / 响应式顶部导航栏,包含 Logo、下拉菜单、移动端汉堡抽屉和操作区插槽
75
+ * @keywords top-bar, navigation, header, mega-menu, responsive, mobile, admin
76
+ * @example
77
+ * <TopBar logo={<Brand />} nav={navItems} actions={<UserMenu />} variant="bordered" />
78
+ */
79
+ declare function TopBar({ logo: logoProp, logoHref, nav, actions, sticky, variant, className, ...props }: TopBarProps): React.JSX.Element;
80
+ /**
81
+ * @component MegaMenu
82
+ * @category layout/admin
83
+ * @since 0.2.0
84
+ * @description Hover-triggered mega dropdown menu with grouped items, icons, and descriptions, suitable for complex navigation / 悬停触发的超级下拉菜单,包含分组项、图标和描述,适用于复杂导航结构
85
+ * @keywords mega-menu, dropdown, navigation, hover, grouped, admin
86
+ * @example
87
+ * <MegaMenu trigger="Products" groups={[{ label: "Food", items: [{ label: "Snacks", href: "#", description: "All snacks" }] }]} />
88
+ */
89
+ declare function MegaMenu({ trigger, groups, className, }: {
90
+ trigger: React.ReactNode;
91
+ groups: Array<{
92
+ label: string;
93
+ items: Array<{
94
+ label: string;
95
+ href: string;
96
+ description?: string;
97
+ icon?: React.ReactNode;
98
+ }>;
99
+ }>;
100
+ className?: string;
101
+ }): React.JSX.Element;
102
+
103
+ export { MegaMenu, MobileBottomNav, type MobileNavItem, PublicLayout, Toaster, TopBar, type TopBarItem };
package/dist/next.d.ts ADDED
@@ -0,0 +1,103 @@
1
+ import * as React from 'react';
2
+ import { ToasterProps } from 'sonner';
3
+ export { M as MessageProvider, a as MessageProviderProps } from './message-provider-BI-P3CNq.js';
4
+ export { E as ErrorPage, I as InternalError, N as NotFound, T as ThemeToggle, U as Unauthorized, u as useResolvedTheme } from './theme-toggle-JL_jZE-w.js';
5
+
6
+ /**
7
+ * @component Toaster
8
+ * @category ui/feedback
9
+ * @since 0.2.0
10
+ * @description Toast notification renderer using Sonner, themed with application icons and colors / 基于 Sonner 的吐司通知渲染器,使用应用图标和颜色主题化
11
+ * @keywords toast, sonner, notification, feedback, alert, 通知, 吐司
12
+ * @example
13
+ * <Toaster />
14
+ */
15
+ declare const Toaster: ({ ...props }: ToasterProps) => React.JSX.Element;
16
+
17
+ interface MobileNavItem {
18
+ label: string;
19
+ href: string;
20
+ icon: React.ReactNode;
21
+ badge?: number | string;
22
+ active?: boolean;
23
+ }
24
+ interface MobileBottomNavProps extends Omit<React.ComponentProps<"nav">, "onChange"> {
25
+ items: MobileNavItem[];
26
+ onChange?: (href: string) => void;
27
+ variant?: "default" | "floating";
28
+ className?: string;
29
+ }
30
+ declare function MobileBottomNav({ items, onChange, variant, className, ...props }: MobileBottomNavProps): React.JSX.Element;
31
+
32
+ interface PublicLayoutProps extends React.ComponentProps<"div"> {
33
+ logo?: React.ReactNode;
34
+ nav?: Array<{
35
+ label: string;
36
+ href: string;
37
+ }>;
38
+ footer?: React.ReactNode;
39
+ headerActions?: React.ReactNode;
40
+ className?: string;
41
+ }
42
+ /**
43
+ * @component PublicLayout
44
+ * @category layout/admin
45
+ * @since 0.2.0
46
+ * @description Public-facing page layout with sticky header, navigation links, and optional footer, suitable for landing or marketing pages / 面向公众的页面布局,包含固定头部、导航链接和可选页脚,适用于落地页或营销页面
47
+ * @keywords public, layout, landing, header, footer, navigation, marketing
48
+ * @example
49
+ * <PublicLayout logo={<Brand />} nav={[{ label: "Home", href: "/" }]}>
50
+ * <HeroSection />
51
+ * </PublicLayout>
52
+ */
53
+ declare function PublicLayout({ logo, nav, footer, headerActions, className, children, ...props }: PublicLayoutProps): React.JSX.Element;
54
+
55
+ interface TopBarItem {
56
+ label: string;
57
+ href: string;
58
+ icon?: React.ReactNode;
59
+ children?: TopBarItem[];
60
+ }
61
+ interface TopBarProps extends React.ComponentProps<"header"> {
62
+ logo?: React.ReactNode;
63
+ logoHref?: string;
64
+ nav?: TopBarItem[];
65
+ actions?: React.ReactNode;
66
+ sticky?: boolean;
67
+ variant?: "default" | "transparent" | "bordered";
68
+ className?: string;
69
+ }
70
+ /**
71
+ * @component TopBar
72
+ * @category layout/admin
73
+ * @since 0.2.0
74
+ * @description Responsive top navigation bar with logo, dropdown mega-menus, mobile hamburger drawer, and action slots / 响应式顶部导航栏,包含 Logo、下拉菜单、移动端汉堡抽屉和操作区插槽
75
+ * @keywords top-bar, navigation, header, mega-menu, responsive, mobile, admin
76
+ * @example
77
+ * <TopBar logo={<Brand />} nav={navItems} actions={<UserMenu />} variant="bordered" />
78
+ */
79
+ declare function TopBar({ logo: logoProp, logoHref, nav, actions, sticky, variant, className, ...props }: TopBarProps): React.JSX.Element;
80
+ /**
81
+ * @component MegaMenu
82
+ * @category layout/admin
83
+ * @since 0.2.0
84
+ * @description Hover-triggered mega dropdown menu with grouped items, icons, and descriptions, suitable for complex navigation / 悬停触发的超级下拉菜单,包含分组项、图标和描述,适用于复杂导航结构
85
+ * @keywords mega-menu, dropdown, navigation, hover, grouped, admin
86
+ * @example
87
+ * <MegaMenu trigger="Products" groups={[{ label: "Food", items: [{ label: "Snacks", href: "#", description: "All snacks" }] }]} />
88
+ */
89
+ declare function MegaMenu({ trigger, groups, className, }: {
90
+ trigger: React.ReactNode;
91
+ groups: Array<{
92
+ label: string;
93
+ items: Array<{
94
+ label: string;
95
+ href: string;
96
+ description?: string;
97
+ icon?: React.ReactNode;
98
+ }>;
99
+ }>;
100
+ className?: string;
101
+ }): React.JSX.Element;
102
+
103
+ export { MegaMenu, MobileBottomNav, type MobileNavItem, PublicLayout, Toaster, TopBar, type TopBarItem };
package/dist/next.js ADDED
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Chaos UI - Enterprise React Component Library
3
+ * Copyright (c) 2026 qxyfoods
4
+ * MIT License
5
+ */
6
+ "use client";import{useTheme as me}from"next-themes";import{Toaster as xe}from"sonner";import*as e from"lucide-react";var q=e.ArrowLeftIcon;var A=e.ChevronDownIcon;var K=e.CircleCheckIcon;var W=e.HomeIcon;var X=e.InfoIcon;var Q=e.LifeBuoyIcon;var Z=e.Loader2Icon;var j=e.MenuIcon;var J=e.MonitorIcon,F=e.MoonIcon;var Y=e.OctagonXIcon;var $=e.SearchXIcon;var ee=e.ServerCrashIcon;var oe=e.ShieldAlertIcon;var z=e.SunIcon;var te=e.TriangleAlertIcon;var re=e.WrenchIcon;var ne=e.XIcon;import{jsx as P}from"react/jsx-runtime";var ae=({...o})=>{let{theme:t}=me();return P(xe,{theme:t??"system",className:"toaster group","data-slot":"sonner",icons:{success:P(K,{className:"size-4"}),info:P(X,{className:"size-4"}),warning:P(te,{className:"size-4"}),error:P(Y,{className:"size-4"}),loading:P(Z,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...o})};import{jsx as ie}from"react/jsx-runtime";function fe(o={}){let{position:t="top-right",visibleToasts:r=5}=o;return ie("div",{"data-slot":"message-provider",children:ie(ae,{position:t,visibleToasts:r})})}import"react";import we from"next/link";import{useTranslation as Me}from"react-i18next";import{clsx as ge}from"clsx";import{twMerge as Ie}from"tailwind-merge";function i(...o){return Ie(ge(o))}import"react";import{Button as be}from"@base-ui/react/button";import{cva as ve}from"class-variance-authority";import{Fragment as he,jsx as G,jsxs as Pe}from"react/jsx-runtime";var D=ve("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function x({className:o,variant:t="default",size:r="default",icon:n,iconRight:s,children:p,...a}){let m=n!=null||s!=null;return G(be,{"data-slot":"button",className:i(D({variant:t,size:r,className:o})),...a,children:m?Pe(he,{children:[n!=null&&G("span",{"data-icon":"inline-start",className:"shrink-0",children:n}),p,s!=null&&G("span",{"data-icon":"inline-end",className:"shrink-0",children:s})]}):p})}import{mergeProps as Le}from"@base-ui/react/merge-props";import{useRender as Ce}from"@base-ui/react/use-render";import{cva as ye}from"class-variance-authority";var ce=ye("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function V({className:o,variant:t="default",render:r,...n}){return Ce({defaultTagName:"span",props:Le({className:i(ce({variant:t}),o)},n),render:r,state:{slot:"badge",variant:t}})}import"react";import{Menu as L}from"@base-ui/react/menu";import{jsx as C,jsxs as co}from"react/jsx-runtime";function H({...o}){return C(L.Root,{"data-slot":"dropdown-menu",...o})}function O({...o}){return C(L.Trigger,{"data-slot":"dropdown-menu-trigger",...o})}function U({align:o="start",alignOffset:t=0,side:r="bottom",sideOffset:n=4,className:s,...p}){return C(L.Portal,{children:C(L.Positioner,{className:"isolate z-50 outline-none",align:o,alignOffset:t,side:r,sideOffset:n,children:C(L.Popup,{"data-slot":"dropdown-menu-content",className:i("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1 shadow-md ring-1 duration-100 outline-none data-closed:overflow-hidden",s),...p})})})}function M({className:o,inset:t,variant:r="default",...n}){return C(L.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:i("group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),...n})}import{Separator as Se}from"@base-ui/react/separator";import{jsx as ke}from"react/jsx-runtime";function E({className:o,orientation:t="horizontal",...r}){return ke(Se,{"data-slot":"separator",orientation:t,className:i("bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",o),...r})}import{jsx as d,jsxs as u}from"react/jsx-runtime";var Te={403:{title:"\u65E0\u6743\u8BBF\u95EE",description:"\u62B1\u6B49\uFF0C\u60A8\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u6B64\u9875\u9762\u3002\u5982\u6709\u7591\u95EE\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u3002"},404:{title:"\u9875\u9762\u4E0D\u5B58\u5728",description:"\u62B1\u6B49\uFF0C\u60A8\u8BBF\u95EE\u7684\u9875\u9762\u5DF2\u88AB\u79FB\u52A8\u6216\u4E0D\u5B58\u5728\u3002"},500:{title:"\u670D\u52A1\u5F02\u5E38",description:"\u62B1\u6B49\uFF0C\u670D\u52A1\u5668\u5F00\u4E86\u4E2A\u5C0F\u5DEE\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002"},503:{title:"\u670D\u52A1\u6682\u4E0D\u53EF\u7528",description:"\u7CFB\u7EDF\u6B63\u5728\u7EF4\u62A4\u4E2D\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"}},Ne={403:{label:"Access restricted",impact:"\u5F53\u524D\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3",action:"\u5207\u6362\u8D26\u53F7\u6216\u8054\u7CFB\u7BA1\u7406\u5458\u5F00\u901A\u8BBF\u95EE\u8303\u56F4\u3002",icon:oe,accent:"text-warning",surface:"bg-warning/10 ring-warning/20"},404:{label:"Route not found",impact:"\u76EE\u6807\u9875\u9762\u672A\u547D\u4E2D",action:"\u68C0\u67E5\u94FE\u63A5\u662F\u5426\u5B8C\u6574\uFF0C\u6216\u56DE\u5230\u9996\u9875\u91CD\u65B0\u8FDB\u5165\u3002",icon:$,accent:"text-info",surface:"bg-info/10 ring-info/20"},500:{label:"Server incident",impact:"\u670D\u52A1\u7AEF\u54CD\u5E94\u5F02\u5E38",action:"\u7A0D\u540E\u91CD\u8BD5\uFF1B\u5982\u679C\u6301\u7EED\u51FA\u73B0\uFF0C\u8BF7\u63D0\u4EA4\u9519\u8BEF\u4E0A\u4E0B\u6587\u3002",icon:ee,accent:"text-destructive",surface:"bg-destructive/10 ring-destructive/20"},503:{label:"Maintenance window",impact:"\u7CFB\u7EDF\u6B63\u5728\u7EF4\u62A4",action:"\u7B49\u5F85\u7EF4\u62A4\u5B8C\u6210\u540E\u5237\u65B0\u9875\u9762\u3002",icon:re,accent:"text-brand-600 dark:text-brand-700",surface:"bg-brand-100/70 ring-brand-300/50 dark:bg-brand-300/15 dark:ring-brand-400/30"}};function _({status:o=404,title:t,description:r,homeHref:n="/",showHome:s=!0,showBack:p=!0,onBack:a,illustration:m,className:v}){let{t:I}=Me("error"),k=Te[o],f=Ne[o],N=f.icon,l={403:{title:"errorPage.accessRestricted.title",description:"errorPage.accessRestricted.description"},404:{title:"errorPage.notFound.title",description:"errorPage.notFound.description"},500:{title:"errorPage.serverError.title",description:"errorPage.serverError.description"},503:{title:"errorPage.maintenance.title",description:"errorPage.maintenance.description"}}[o],w=t??I(l.title,k.title),ue=r??I(l.description,k.description);return d("div",{"data-slot":"error-page",className:i("flex min-h-[60vh] items-center justify-center bg-background px-4 py-10 sm:px-6",v),children:u("div",{className:"grid w-full max-w-5xl overflow-hidden rounded-xl border bg-card text-card-foreground shadow-sm lg:grid-cols-[minmax(0,1fr)_20rem]",children:[u("section",{className:"flex min-w-0 flex-col justify-between gap-10 p-6 sm:p-8 lg:p-10",children:[u("div",{className:"space-y-8",children:[u("div",{className:"flex flex-wrap items-center gap-3",children:[d(V,{variant:"outline",className:"h-6 rounded-md font-mono",children:o}),d("span",{className:"text-xs font-medium uppercase text-muted-foreground",children:f.label})]}),u("div",{className:"grid gap-6 sm:grid-cols-[auto_minmax(0,1fr)] sm:items-center",children:[d("div",{className:i("flex size-20 items-center justify-center rounded-xl ring-1 sm:size-24",f.surface),children:m??d(N,{className:i("size-10 sm:size-12",f.accent)})}),u("div",{className:"min-w-0 space-y-3",children:[d("p",{className:i("font-mono text-5xl font-semibold leading-none sm:text-6xl",f.accent),children:o}),d("h1",{className:"text-2xl font-semibold tracking-tight text-balance sm:text-3xl",children:w}),d("p",{className:"max-w-xl text-sm leading-6 text-muted-foreground sm:text-base",children:ue})]})]})]}),u("div",{className:"flex flex-wrap items-center gap-2",children:[s&&u(we,{href:n,className:D({size:"lg"}),children:[d(W,{}),I("errorPage.home")]}),p&&u(x,{size:"lg",variant:"outline",onClick:a??(()=>history.back()),children:[d(q,{}),I("errorPage.back")]})]})]}),d("aside",{className:"border-t bg-muted/35 p-6 sm:p-8 lg:border-l lg:border-t-0",children:u("div",{className:"flex h-full flex-col justify-between gap-8",children:[u("div",{className:"space-y-5",children:[u("div",{className:"flex items-center gap-2 text-sm font-medium",children:[d(Q,{className:"size-4 text-muted-foreground"}),I("errorPage.context")]}),d(E,{}),u("dl",{className:"space-y-5 text-sm",children:[u("div",{className:"space-y-1",children:[d("dt",{className:"text-xs font-medium uppercase text-muted-foreground",children:I("errorPage.impact")}),d("dd",{className:"text-foreground",children:f.impact})]}),u("div",{className:"space-y-1",children:[d("dt",{className:"text-xs font-medium uppercase text-muted-foreground",children:I("errorPage.action")}),d("dd",{className:"leading-6 text-foreground",children:f.action})]})]})]}),d("div",{className:"rounded-lg border bg-background/70 p-3 text-xs leading-5 text-muted-foreground",children:"Request ID \u4F1A\u5728\u751F\u4EA7\u73AF\u5883\u7531\u4E0A\u6E38\u7F51\u5173\u6CE8\u5165\uFF0C\u7EC4\u4EF6\u4EC5\u8D1F\u8D23\u7A33\u5B9A\u5448\u73B0\u9519\u8BEF\u72B6\u6001\u3002"})]})})]})})}function Ho(){return d(_,{status:404})}function Oo(){return d(_,{status:500})}function Uo(){return d(_,{status:403})}import"react";import De from"next/link";import{useTranslation as Re}from"react-i18next";import{jsx as y,jsxs as se}from"react/jsx-runtime";function Zo({items:o,onChange:t,variant:r="default",className:n,...s}){let{t:p}=Re("mobile");return y("nav",{"data-slot":"mobile-bottom-nav","aria-label":p("mobileBottomNav.ariaLabel"),className:i("fixed bottom-0 left-0 right-0 z-40 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 md:hidden",r==="floating"&&"mx-3 mb-3 rounded-2xl border shadow-lg",n),...s,children:y("ul",{className:"flex items-stretch justify-around",children:o.map(a=>{let m=a.active,v=se("span",{className:i("flex h-14 w-full flex-col items-center justify-center gap-0.5 text-[0.65rem] transition-colors",m?"text-primary":"text-muted-foreground"),children:[se("span",{className:"relative",children:[a.icon,a.badge!==void 0&&a.badge!==0&&y("span",{className:"absolute -top-1 -right-2 flex h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[0.6rem] font-medium text-destructive-foreground",children:a.badge})]}),a.label]});return y("li",{className:"flex-1",children:t?y(x,{type:"button",variant:"ghost",onClick:()=>t(a.href),className:"h-auto w-full rounded-none p-0","aria-current":m?"page":void 0,children:v}):y(De,{href:a.href,className:"block","aria-current":m?"page":void 0,children:v})},a.href)})})})}import{useTheme as pe}from"next-themes";import{jsx as g,jsxs as S}from"react/jsx-runtime";function rt({className:o,showSystem:t=!0,align:r="end"}){let{theme:n,setTheme:s}=pe();return S(H,{children:[S(O,{render:g(x,{variant:"ghost",size:"icon",className:i("relative",o),"aria-label":"Toggle theme"}),children:[g(z,{className:"size-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),g(F,{className:"absolute size-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),g("span",{className:"sr-only",children:"Toggle theme"})]}),S(U,{align:r,children:[S(M,{onClick:()=>s("light"),children:[g(z,{}),"\u6D45\u8272",n==="light"&&g("span",{className:"ml-auto text-xs",children:"\u2713"})]}),t&&S(M,{onClick:()=>s("system"),children:[g(J,{}),"\u8DDF\u968F\u7CFB\u7EDF",n==="system"&&g("span",{className:"ml-auto text-xs",children:"\u2713"})]}),S(M,{onClick:()=>s("dark"),children:[g(F,{}),"\u6DF1\u8272",n==="dark"&&g("span",{className:"ml-auto text-xs",children:"\u2713"})]})]})]})}function nt(){let{theme:o,resolvedTheme:t}=pe();return o==="system"?t??"light":o??"light"}import"react";import de from"next/link";import{jsx as h,jsxs as le}from"react/jsx-runtime";function dt({logo:o,nav:t=[],footer:r,headerActions:n,className:s,children:p,...a}){return le("div",{"data-slot":"public-layout",className:i("bg-background flex min-h-screen flex-col",s),...a,children:[h("header",{className:"bg-background/95 sticky top-0 z-30 border-b backdrop-blur",children:le("div",{className:"container mx-auto flex h-14 items-center justify-between gap-4 px-4",children:[h(de,{href:"/",className:"flex items-center gap-2 font-semibold",children:o??"Chaos UI"}),h("nav",{className:"hidden items-center gap-6 md:flex",children:t.map(m=>h(de,{href:m.href,className:"text-muted-foreground hover:text-foreground text-sm transition-colors",children:m.label},m.href))}),h("div",{className:"flex items-center gap-2",children:n})]})}),h("main",{className:"flex-1",children:p}),r&&h("footer",{className:"bg-muted/30 text-muted-foreground border-t px-4 py-8 text-sm",children:r})]})}import*as R from"react";import{useTranslation as Be}from"react-i18next";import T from"next/link";import{jsx as c,jsxs as b}from"react/jsx-runtime";function bt({logo:o,logoHref:t="/",nav:r=[],actions:n,sticky:s=!0,variant:p="default",className:a,...m}){let{t:v}=Be("navigation"),I=o??v("topBar.defaultLogo"),[k,f]=R.useState(!1),[N,B]=R.useState(null);return b("header",{"data-slot":"top-bar","data-variant":p,className:i("z-30 flex h-14 items-center gap-4 px-4",s&&"sticky top-0",p==="bordered"&&"border-b",p==="default"&&"bg-background/95 supports-[backdrop-filter]:bg-background/80 border-b backdrop-blur",p==="transparent"&&"bg-transparent",a),...m,children:[c(x,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>f(l=>!l),className:"md:hidden","aria-label":v("topBar.toggleMenu"),children:k?c(ne,{}):c(j,{})}),c(T,{href:t,className:"flex items-center gap-2 font-semibold",children:I}),c("nav",{className:"hidden flex-1 items-center gap-1 md:flex",children:r.map(l=>l.children?.length?b("div",{className:"relative",onMouseEnter:()=>B(l.href),onMouseLeave:()=>B(null),children:[b(x,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground hover:bg-muted hover:text-foreground inline-flex items-center gap-1 rounded-md px-3 py-1.5 text-sm font-medium transition-colors","aria-expanded":N===l.href,children:[l.icon,l.label,c(A,{className:"size-3.5"})]}),N===l.href&&c("div",{className:"bg-popover absolute top-full left-0 z-50 min-w-48 rounded-md border p-1 shadow-md",children:l.children.map(w=>c(T,{href:w.href,className:"hover:bg-accent hover:text-accent-foreground block rounded-sm px-2 py-1.5 text-sm",children:w.label},w.href))})]},l.href):c(T,{href:l.href,className:"text-muted-foreground hover:bg-muted hover:text-foreground rounded-md px-3 py-1.5 text-sm font-medium transition-colors",children:l.label},l.href))}),c("div",{className:"ml-auto hidden items-center gap-2 sm:flex",children:n}),k&&c("div",{className:"bg-background fixed inset-x-0 top-14 z-40 border-b p-4 md:hidden",children:b("nav",{className:"flex flex-col gap-1",children:[r.map(l=>c(T,{href:l.href,onClick:()=>f(!1),className:"hover:bg-muted rounded-md px-3 py-2 text-sm font-medium",children:l.label},l.href)),n&&c("div",{className:"mt-2 flex flex-col gap-2 border-t pt-2",children:n})]})})]})}function vt({trigger:o,groups:t,className:r}){let[n,s]=R.useState(!1);return b("div",{className:"relative",onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[b(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>s(p=>!p),className:"text-muted-foreground hover:bg-muted hover:text-foreground inline-flex items-center gap-1 rounded-md px-3 py-1.5 text-sm font-medium","aria-expanded":n,children:[o,c(A,{className:"size-3.5"})]}),n&&c("div",{className:i("absolute top-full left-1/2 z-50 -translate-x-1/2 pt-2",r),children:c("div",{className:"bg-popover grid min-w-96 gap-6 rounded-lg border p-6 shadow-lg md:grid-cols-2",children:t.map(p=>b("div",{className:"space-y-2",children:[c("h3",{className:"text-muted-foreground text-xs font-semibold",children:p.label}),c("ul",{className:"space-y-1",children:p.items.map(a=>c("li",{children:b(T,{href:a.href,className:"hover:bg-accent flex items-start gap-3 rounded-md p-2",children:[a.icon&&c("span",{className:"text-muted-foreground mt-0.5",children:a.icon}),b("div",{className:"flex-1",children:[c("div",{className:"text-sm font-medium",children:a.label}),a.description&&c("div",{className:"text-muted-foreground text-xs",children:a.description})]})]})},a.href))})]},p.label))})})]})}export{_ as ErrorPage,Oo as InternalError,vt as MegaMenu,fe as MessageProvider,Zo as MobileBottomNav,Ho as NotFound,dt as PublicLayout,rt as ThemeToggle,ae as Toaster,bt as TopBar,Uo as Unauthorized,nt as useResolvedTheme};
@@ -0,0 +1,81 @@
1
+ import * as React from 'react';
2
+
3
+ interface ErrorPageProps {
4
+ status?: 403 | 404 | 500 | 503;
5
+ title?: string;
6
+ description?: string;
7
+ homeHref?: string;
8
+ showHome?: boolean;
9
+ showBack?: boolean;
10
+ onBack?: () => void;
11
+ illustration?: React.ReactNode;
12
+ className?: string;
13
+ }
14
+ /**
15
+ * @component ErrorPage
16
+ * @category business/ux
17
+ * @since 0.2.0
18
+ * @description Full-featured error page for 403/404/500/503 status codes with context panel, i18n, and navigation actions / 全功能错误页面,支持 403/404/500/503 状态码,含上下文面板、国际化及导航操作
19
+ * @keywords error, 403, 404, 500, 503, page, status
20
+ * @example
21
+ * <ErrorPage status={404} />
22
+ */
23
+ declare function ErrorPage({ status, title, description, homeHref, showHome, showBack, onBack, illustration, className, }: ErrorPageProps): React.JSX.Element;
24
+ /**
25
+ * @component NotFound
26
+ * @category business/ux
27
+ * @since 0.2.0
28
+ * @description Convenience wrapper for ErrorPage with status 404 / ErrorPage 的 404 便捷包装
29
+ * @keywords error, 404, not found
30
+ * @example
31
+ * <NotFound />
32
+ */
33
+ declare function NotFound(): React.JSX.Element;
34
+ /**
35
+ * @component InternalError
36
+ * @category business/ux
37
+ * @since 0.2.0
38
+ * @description Convenience wrapper for ErrorPage with status 500 / ErrorPage 的 500 便捷包装
39
+ * @keywords error, 500, server, internal
40
+ * @example
41
+ * <InternalError />
42
+ */
43
+ declare function InternalError(): React.JSX.Element;
44
+ /**
45
+ * @component Unauthorized
46
+ * @category business/ux
47
+ * @since 0.2.0
48
+ * @description Convenience wrapper for ErrorPage with status 403 / ErrorPage 的 403 便捷包装
49
+ * @keywords error, 403, unauthorized, access
50
+ * @example
51
+ * <Unauthorized />
52
+ */
53
+ declare function Unauthorized(): React.JSX.Element;
54
+
55
+ interface ThemeToggleProps {
56
+ className?: string;
57
+ showSystem?: boolean;
58
+ align?: "start" | "center" | "end";
59
+ }
60
+ /**
61
+ * @component ThemeToggle
62
+ * @category business/ux
63
+ * @since 0.2.0
64
+ * @description Dropdown toggle for switching between light, dark, and system theme modes / 下拉切换按钮,用于在浅色、深色和跟随系统主题间切换
65
+ * @keywords theme, toggle, dark, light, system, mode
66
+ * @example
67
+ * <ThemeToggle showSystem />
68
+ */
69
+ declare function ThemeToggle({ className, showSystem, align, }: ThemeToggleProps): React.JSX.Element;
70
+ /**
71
+ * @component useResolvedTheme
72
+ * @category business/ux
73
+ * @since 0.2.0
74
+ * @description Hook that resolves the effective theme ("light" or "dark") from next-themes, accounting for system preference / 从 next-themes 解析实际生效的主题("light" 或 "dark"),考虑系统偏好设置
75
+ * @keywords theme, hook, resolved, dark, light, system
76
+ * @example
77
+ * const theme = useResolvedTheme();
78
+ */
79
+ declare function useResolvedTheme(): "light" | "dark";
80
+
81
+ export { ErrorPage as E, InternalError as I, NotFound as N, ThemeToggle as T, Unauthorized as U, useResolvedTheme as u };
@@ -0,0 +1,81 @@
1
+ import * as React from 'react';
2
+
3
+ interface ErrorPageProps {
4
+ status?: 403 | 404 | 500 | 503;
5
+ title?: string;
6
+ description?: string;
7
+ homeHref?: string;
8
+ showHome?: boolean;
9
+ showBack?: boolean;
10
+ onBack?: () => void;
11
+ illustration?: React.ReactNode;
12
+ className?: string;
13
+ }
14
+ /**
15
+ * @component ErrorPage
16
+ * @category business/ux
17
+ * @since 0.2.0
18
+ * @description Full-featured error page for 403/404/500/503 status codes with context panel, i18n, and navigation actions / 全功能错误页面,支持 403/404/500/503 状态码,含上下文面板、国际化及导航操作
19
+ * @keywords error, 403, 404, 500, 503, page, status
20
+ * @example
21
+ * <ErrorPage status={404} />
22
+ */
23
+ declare function ErrorPage({ status, title, description, homeHref, showHome, showBack, onBack, illustration, className, }: ErrorPageProps): React.JSX.Element;
24
+ /**
25
+ * @component NotFound
26
+ * @category business/ux
27
+ * @since 0.2.0
28
+ * @description Convenience wrapper for ErrorPage with status 404 / ErrorPage 的 404 便捷包装
29
+ * @keywords error, 404, not found
30
+ * @example
31
+ * <NotFound />
32
+ */
33
+ declare function NotFound(): React.JSX.Element;
34
+ /**
35
+ * @component InternalError
36
+ * @category business/ux
37
+ * @since 0.2.0
38
+ * @description Convenience wrapper for ErrorPage with status 500 / ErrorPage 的 500 便捷包装
39
+ * @keywords error, 500, server, internal
40
+ * @example
41
+ * <InternalError />
42
+ */
43
+ declare function InternalError(): React.JSX.Element;
44
+ /**
45
+ * @component Unauthorized
46
+ * @category business/ux
47
+ * @since 0.2.0
48
+ * @description Convenience wrapper for ErrorPage with status 403 / ErrorPage 的 403 便捷包装
49
+ * @keywords error, 403, unauthorized, access
50
+ * @example
51
+ * <Unauthorized />
52
+ */
53
+ declare function Unauthorized(): React.JSX.Element;
54
+
55
+ interface ThemeToggleProps {
56
+ className?: string;
57
+ showSystem?: boolean;
58
+ align?: "start" | "center" | "end";
59
+ }
60
+ /**
61
+ * @component ThemeToggle
62
+ * @category business/ux
63
+ * @since 0.2.0
64
+ * @description Dropdown toggle for switching between light, dark, and system theme modes / 下拉切换按钮,用于在浅色、深色和跟随系统主题间切换
65
+ * @keywords theme, toggle, dark, light, system, mode
66
+ * @example
67
+ * <ThemeToggle showSystem />
68
+ */
69
+ declare function ThemeToggle({ className, showSystem, align, }: ThemeToggleProps): React.JSX.Element;
70
+ /**
71
+ * @component useResolvedTheme
72
+ * @category business/ux
73
+ * @since 0.2.0
74
+ * @description Hook that resolves the effective theme ("light" or "dark") from next-themes, accounting for system preference / 从 next-themes 解析实际生效的主题("light" 或 "dark"),考虑系统偏好设置
75
+ * @keywords theme, hook, resolved, dark, light, system
76
+ * @example
77
+ * const theme = useResolvedTheme();
78
+ */
79
+ declare function useResolvedTheme(): "light" | "dark";
80
+
81
+ export { ErrorPage as E, InternalError as I, NotFound as N, ThemeToggle as T, Unauthorized as U, useResolvedTheme as u };