mtxuilib 0.1.511 → 0.1.512

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.
@@ -0,0 +1,5 @@
1
+ interface ClipboardCopyProps {
2
+ value: string;
3
+ }
4
+ export declare const ClipboardCopy: ({ value }: ClipboardCopyProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CopyIcon } from "lucide-react";
3
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "mtxuilib/ui/tooltip";
4
+ import { useState } from "react";
5
+ import { useCopyToClipboard } from "usehooks-ts";
6
+ import { Button } from "../ui/button";
7
+ export const ClipboardCopy = ({ value }) => {
8
+ const [isCopied, setIsCopied] = useState(false);
9
+ const [_, copy] = useCopyToClipboard();
10
+ const handleCopy = () => {
11
+ copy(value)
12
+ .then(() => {
13
+ setIsCopied(true);
14
+ setTimeout(() => setIsCopied(false), 2000);
15
+ })
16
+ .catch((err) => console.log("An error occurred while copying: ", err));
17
+ };
18
+ return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", onClick: handleCopy, className: "p-2 hover:bg-gray-100 dark:hover:bg-gray-800", children: _jsx(CopyIcon, { className: "h-4 w-4" }) }) }), _jsx(TooltipContent, { className: "bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 px-3 py-1 text-sm rounded shadow-lg", children: isCopied ? "Copied!" : "Copy" })] }) }));
19
+ };
@@ -0,0 +1,5 @@
1
+ interface SkeletonLoadingProps {
2
+ loading?: boolean;
3
+ }
4
+ export declare const SkeletonListview: ({ loading }: SkeletonLoadingProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Icons } from "../../icons/icons";
4
+ export const SkeletonListview = ({ loading }) => {
5
+ return (_jsx("div", { className: "flex mx-auto justify-center items-center h-screen", children: _jsx("div", { className: "text-bolt-elements-textPrimary flex-1 flex flex-col items-center", children: _jsx(Icons.reload, { className: "size-6 animate-spin" }) }) }));
6
+ };
@@ -0,0 +1,5 @@
1
+ interface SkeletonLoadingProps {
2
+ loading?: boolean;
3
+ }
4
+ export declare const SkeletonLoading: ({ loading }: SkeletonLoadingProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Icons } from "../../icons/icons";
4
+ export const SkeletonLoading = ({ loading }) => {
5
+ return (_jsx("div", { className: "flex mx-auto justify-center items-center h-screen", children: _jsx("div", { className: "text-bolt-elements-textPrimary flex-1 flex flex-col items-center", children: _jsx(Icons.reload, { className: "size-6 animate-spin" }) }) }));
6
+ };
@@ -0,0 +1 @@
1
+ export declare function useIsMobile(): boolean;
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ const MOBILE_BREAKPOINT = 768;
3
+ export function useIsMobile() {
4
+ const [isMobile, setIsMobile] = React.useState(undefined);
5
+ React.useEffect(() => {
6
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
7
+ const onChange = () => {
8
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
9
+ };
10
+ mql.addEventListener("change", onChange);
11
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
12
+ return () => mql.removeEventListener("change", onChange);
13
+ }, []);
14
+ return !!isMobile;
15
+ }
@@ -46,6 +46,16 @@
46
46
  --novel-highlight-pink: #faf1f5;
47
47
  --novel-highlight-gray: #f1f1ef;
48
48
  /* novel editor 相关样式结束 */
49
+
50
+ /* shadcn siderbar */
51
+ --sidebar-background: 0 0% 98%;
52
+ --sidebar-foreground: 240 5.3% 26.1%;
53
+ --sidebar-primary: 240 5.9% 10%;
54
+ --sidebar-primary-foreground: 0 0% 98%;
55
+ --sidebar-accent: 240 4.8% 95.9%;
56
+ --sidebar-accent-foreground: 240 5.9% 10%;
57
+ --sidebar-border: 220 13% 91%;
58
+ --sidebar-ring: 217.2 91.2% 59.8%;
49
59
  }
50
60
 
51
61
  .dark {
@@ -88,6 +98,16 @@
88
98
  --novel-highlight-pink: #5c1a3a;
89
99
  --novel-highlight-gray: #3a3a3a;
90
100
  /* novel editor 相关样式结束 */
101
+
102
+ /* shadcn siderbar */
103
+ --sidebar-background: 240 5.9% 10%;
104
+ --sidebar-foreground: 240 4.8% 95.9%;
105
+ --sidebar-primary: 224.3 76.3% 48%;
106
+ --sidebar-primary-foreground: 0 0% 100%;
107
+ --sidebar-accent: 240 3.7% 15.9%;
108
+ --sidebar-accent-foreground: 240 4.8% 95.9%;
109
+ --sidebar-border: 240 3.7% 15.9%;
110
+ --sidebar-ring: 217.2 91.2% 59.8%;
91
111
  }
92
112
  }
93
113
  /*
@@ -2,9 +2,9 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { CheckIcon, ChevronRightIcon, DotFilledIcon, } from "@radix-ui/react-icons";
4
4
  import * as MenubarPrimitive from "@radix-ui/react-menubar";
5
+ import { cn } from "../lib/utils";
5
6
  import * as React from "react";
6
7
  const MenubarMenu = MenubarPrimitive.Menu;
7
- import { cn } from "../lib/utils";
8
8
  const MenubarGroup = MenubarPrimitive.Group;
9
9
  const MenubarPortal = MenubarPrimitive.Portal;
10
10
  const MenubarSub = MenubarPrimitive.Sub;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { ButtonProps } from "./button";
2
+ import { type ButtonProps } from "./button";
3
3
  declare const Pagination: {
4
4
  ({ className, ...props }: React.ComponentProps<"nav">): import("react/jsx-runtime").JSX.Element;
5
5
  displayName: string;
@@ -25,4 +25,4 @@ declare const PaginationEllipsis: {
25
25
  ({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
26
26
  displayName: string;
27
27
  };
28
- export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious };
28
+ export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, };
@@ -20,4 +20,4 @@ const PaginationNext = ({ className, ...props }) => (_jsxs(PaginationLink, { "ar
20
20
  PaginationNext.displayName = "PaginationNext";
21
21
  const PaginationEllipsis = ({ className, ...props }) => (_jsxs("span", { "aria-hidden": true, className: cn("flex h-9 w-9 items-center justify-center", className), ...props, children: [_jsx(DotsHorizontalIcon, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "More pages" })] }));
22
22
  PaginationEllipsis.displayName = "PaginationEllipsis";
23
- export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious };
23
+ export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, };
@@ -0,0 +1,66 @@
1
+ import { TooltipContent } from "@radix-ui/react-tooltip";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ import * as React from "react";
4
+ type SidebarContext = {
5
+ state: "expanded" | "collapsed";
6
+ open: boolean;
7
+ setOpen: (open: boolean) => void;
8
+ openMobile: boolean;
9
+ setOpenMobile: (open: boolean) => void;
10
+ isMobile: boolean;
11
+ toggleSidebar: () => void;
12
+ };
13
+ declare const SidebarContext: React.Context<SidebarContext | null>;
14
+ declare function useSidebar(): SidebarContext;
15
+ declare const SidebarProvider: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
16
+ defaultOpen?: boolean;
17
+ open?: boolean;
18
+ onOpenChange?: (open: boolean) => void;
19
+ }, "ref"> & React.RefAttributes<HTMLDivElement>>;
20
+ declare const Sidebar: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
21
+ side?: "left" | "right";
22
+ variant?: "sidebar" | "floating" | "inset";
23
+ collapsible?: "offcanvas" | "icon" | "none";
24
+ }, "ref"> & React.RefAttributes<HTMLDivElement>>;
25
+ declare const SidebarTrigger: React.ForwardRefExoticComponent<Omit<import("./button").ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
26
+ declare const SidebarRail: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
27
+ declare const SidebarInset: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
28
+ declare const SidebarInput: React.ForwardRefExoticComponent<Omit<import("./input").InputProps & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
29
+ declare const SidebarHeader: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
30
+ declare const SidebarFooter: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
31
+ declare const SidebarSeparator: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-select").SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
32
+ declare const SidebarContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
33
+ declare const SidebarGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
34
+ declare const SidebarGroupLabel: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
35
+ asChild?: boolean;
36
+ }, "ref"> & React.RefAttributes<HTMLDivElement>>;
37
+ declare const SidebarGroupAction: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
38
+ asChild?: boolean;
39
+ }, "ref"> & React.RefAttributes<HTMLButtonElement>>;
40
+ declare const SidebarGroupContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
41
+ declare const SidebarMenu: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & React.RefAttributes<HTMLUListElement>>;
42
+ declare const SidebarMenuItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
43
+ declare const SidebarMenuButton: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
44
+ asChild?: boolean;
45
+ isActive?: boolean;
46
+ tooltip?: string | React.ComponentProps<typeof TooltipContent>;
47
+ } & VariantProps<(props?: ({
48
+ variant?: "default" | "outline" | null | undefined;
49
+ size?: "lg" | "sm" | "default" | null | undefined;
50
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
51
+ declare const SidebarMenuAction: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
52
+ asChild?: boolean;
53
+ showOnHover?: boolean;
54
+ }, "ref"> & React.RefAttributes<HTMLButtonElement>>;
55
+ declare const SidebarMenuBadge: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
56
+ declare const SidebarMenuSkeleton: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
57
+ showIcon?: boolean;
58
+ }, "ref"> & React.RefAttributes<HTMLDivElement>>;
59
+ declare const SidebarMenuSub: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & React.RefAttributes<HTMLUListElement>>;
60
+ declare const SidebarMenuSubItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
61
+ declare const SidebarMenuSubButton: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> & {
62
+ asChild?: boolean;
63
+ size?: "sm" | "md";
64
+ isActive?: boolean;
65
+ }, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
66
+ export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar, };
@@ -0,0 +1,217 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Separator } from "@radix-ui/react-select";
4
+ import { Slot } from "@radix-ui/react-slot";
5
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@radix-ui/react-tooltip";
6
+ import { cva } from "class-variance-authority";
7
+ import { PanelLeft } from "lucide-react";
8
+ import * as React from "react";
9
+ import { useCallback, useMemo } from "react";
10
+ import { useIsMobile } from "../hooks/use-mobile";
11
+ import { cn } from "../lib/utils";
12
+ import { Button } from "./button";
13
+ import { Input } from "./input";
14
+ import { Sheet, SheetContent } from "./sheet";
15
+ import { Skeleton } from "./skeleton";
16
+ const SIDEBAR_COOKIE_NAME = "sidebar:state";
17
+ const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
18
+ const SIDEBAR_WIDTH = "16rem";
19
+ const SIDEBAR_WIDTH_MOBILE = "18rem";
20
+ const SIDEBAR_WIDTH_ICON = "3rem";
21
+ const SIDEBAR_KEYBOARD_SHORTCUT = "b";
22
+ const SidebarContext = React.createContext(null);
23
+ function useSidebar() {
24
+ const context = React.useContext(SidebarContext);
25
+ if (!context) {
26
+ throw new Error("useSidebar must be used within a SidebarProvider.");
27
+ }
28
+ return context;
29
+ }
30
+ const SidebarProvider = React.forwardRef(({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }, ref) => {
31
+ const isMobile = useIsMobile();
32
+ const [openMobile, setOpenMobile] = React.useState(false);
33
+ const [_open, _setOpen] = React.useState(defaultOpen);
34
+ const open = openProp ?? _open;
35
+ const setOpen = React.useCallback((value) => {
36
+ if (setOpenProp) {
37
+ return setOpenProp?.(typeof value === "function" ? value(open) : value);
38
+ }
39
+ _setOpen(value);
40
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${open}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
41
+ }, [setOpenProp, open]);
42
+ const toggleSidebar = useCallback(() => {
43
+ return isMobile
44
+ ? setOpenMobile((open) => !open)
45
+ : setOpen((open) => !open);
46
+ }, [isMobile, setOpen, setOpenMobile]);
47
+ React.useEffect(() => {
48
+ const handleKeyDown = (event) => {
49
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
50
+ (event.metaKey || event.ctrlKey)) {
51
+ event.preventDefault();
52
+ toggleSidebar();
53
+ }
54
+ };
55
+ window.addEventListener("keydown", handleKeyDown);
56
+ return () => window.removeEventListener("keydown", handleKeyDown);
57
+ }, [toggleSidebar]);
58
+ const state = open ? "expanded" : "collapsed";
59
+ const contextValue = useMemo(() => ({
60
+ state,
61
+ open,
62
+ setOpen,
63
+ isMobile,
64
+ openMobile,
65
+ setOpenMobile,
66
+ toggleSidebar,
67
+ }), [
68
+ state,
69
+ open,
70
+ setOpen,
71
+ isMobile,
72
+ openMobile,
73
+ setOpenMobile,
74
+ toggleSidebar,
75
+ ]);
76
+ return (_jsx(SidebarContext.Provider, { value: contextValue, children: _jsx(TooltipProvider, { delayDuration: 0, children: _jsx("div", { style: {
77
+ "--sidebar-width": SIDEBAR_WIDTH,
78
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
79
+ ...style,
80
+ }, className: cn("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar", className), ref: ref, ...props, children: children }) }) }));
81
+ });
82
+ SidebarProvider.displayName = "SidebarProvider";
83
+ const Sidebar = React.forwardRef(({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props }, ref) => {
84
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
85
+ if (collapsible === "none") {
86
+ return (_jsx("div", { className: cn("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground", className), ref: ref, ...props, children: children }));
87
+ }
88
+ if (isMobile) {
89
+ return (_jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: _jsx(SheetContent, { "data-sidebar": "sidebar", "data-mobile": "true", className: "w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden", style: {
90
+ "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
91
+ }, side: side, children: _jsx("div", { className: "flex h-full w-full flex-col", children: children }) }) }));
92
+ }
93
+ return (_jsxs("div", { ref: ref, className: "group peer hidden md:block text-sidebar-foreground", "data-state": state, "data-collapsible": state === "collapsed" ? collapsible : "", "data-variant": variant, "data-side": side, children: [_jsx("div", { className: cn("duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset"
94
+ ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
95
+ : "group-data-[collapsible=icon]:w-[--sidebar-width-icon]") }), _jsx("div", { className: cn("duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex", side === "left"
96
+ ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
97
+ : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]", variant === "floating" || variant === "inset"
98
+ ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]"
99
+ : "group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l", className), ...props, children: _jsx("div", { "data-sidebar": "sidebar", className: "flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow", children: children }) })] }));
100
+ });
101
+ Sidebar.displayName = "Sidebar";
102
+ const SidebarTrigger = React.forwardRef(({ className, onClick, ...props }, ref) => {
103
+ const { toggleSidebar } = useSidebar();
104
+ return (_jsxs(Button, { ref: ref, "data-sidebar": "trigger", variant: "ghost", size: "icon", className: cn("h-7 w-7", className), onClick: (event) => {
105
+ onClick?.(event);
106
+ toggleSidebar();
107
+ }, ...props, children: [_jsx(PanelLeft, {}), _jsx("span", { className: "sr-only", children: "Toggle Sidebar" })] }));
108
+ });
109
+ SidebarTrigger.displayName = "SidebarTrigger";
110
+ const SidebarRail = React.forwardRef(({ className, ...props }, ref) => {
111
+ const { toggleSidebar } = useSidebar();
112
+ return (_jsx("button", { ref: ref, "data-sidebar": "rail", "aria-label": "Toggle Sidebar", tabIndex: -1, onClick: toggleSidebar, title: "Toggle Sidebar", className: cn("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex", "[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className), ...props }));
113
+ });
114
+ SidebarRail.displayName = "SidebarRail";
115
+ const SidebarInset = React.forwardRef(({ className, ...props }, ref) => {
116
+ return (_jsx("main", { ref: ref, className: cn("relative flex min-h-svh flex-1 flex-col bg-background", "peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow", className), ...props }));
117
+ });
118
+ SidebarInset.displayName = "SidebarInset";
119
+ const SidebarInput = React.forwardRef(({ className, ...props }, ref) => {
120
+ return (_jsx(Input, { ref: ref, "data-sidebar": "input", className: cn("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring", className), ...props }));
121
+ });
122
+ SidebarInput.displayName = "SidebarInput";
123
+ const SidebarHeader = React.forwardRef(({ className, ...props }, ref) => {
124
+ return (_jsx("div", { ref: ref, "data-sidebar": "header", className: cn("flex flex-col gap-2 p-2", className), ...props }));
125
+ });
126
+ SidebarHeader.displayName = "SidebarHeader";
127
+ const SidebarFooter = React.forwardRef(({ className, ...props }, ref) => {
128
+ return (_jsx("div", { ref: ref, "data-sidebar": "footer", className: cn("flex flex-col gap-2 p-2", className), ...props }));
129
+ });
130
+ SidebarFooter.displayName = "SidebarFooter";
131
+ const SidebarSeparator = React.forwardRef(({ className, ...props }, ref) => {
132
+ return (_jsx(Separator, { ref: ref, "data-sidebar": "separator", className: cn("mx-2 w-auto bg-sidebar-border", className), ...props }));
133
+ });
134
+ SidebarSeparator.displayName = "SidebarSeparator";
135
+ const SidebarContent = React.forwardRef(({ className, ...props }, ref) => {
136
+ return (_jsx("div", { ref: ref, "data-sidebar": "content", className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className), ...props }));
137
+ });
138
+ SidebarContent.displayName = "SidebarContent";
139
+ const SidebarGroup = React.forwardRef(({ className, ...props }, ref) => {
140
+ return (_jsx("div", { ref: ref, "data-sidebar": "group", className: cn("relative flex w-full min-w-0 flex-col p-2", className), ...props }));
141
+ });
142
+ SidebarGroup.displayName = "SidebarGroup";
143
+ const SidebarGroupLabel = React.forwardRef(({ className, asChild = false, ...props }, ref) => {
144
+ const Comp = asChild ? Slot : "div";
145
+ return (_jsx(Comp, { ref: ref, "data-sidebar": "group-label", className: cn("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", className), ...props }));
146
+ });
147
+ SidebarGroupLabel.displayName = "SidebarGroupLabel";
148
+ const SidebarGroupAction = React.forwardRef(({ className, asChild = false, ...props }, ref) => {
149
+ const Comp = asChild ? Slot : "button";
150
+ return (_jsx(Comp, { ref: ref, "data-sidebar": "group-action", className: cn("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 after:md:hidden", "group-data-[collapsible=icon]:hidden", className), ...props }));
151
+ });
152
+ SidebarGroupAction.displayName = "SidebarGroupAction";
153
+ const SidebarGroupContent = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, "data-sidebar": "group-content", className: cn("w-full text-sm", className), ...props })));
154
+ SidebarGroupContent.displayName = "SidebarGroupContent";
155
+ const SidebarMenu = React.forwardRef(({ className, ...props }, ref) => (_jsx("ul", { ref: ref, "data-sidebar": "menu", className: cn("flex w-full min-w-0 flex-col gap-1", className), ...props })));
156
+ SidebarMenu.displayName = "SidebarMenu";
157
+ const SidebarMenuItem = React.forwardRef(({ className, ...props }, ref) => (_jsx("li", { ref: ref, "data-sidebar": "menu-item", className: cn("group/menu-item relative", className), ...props })));
158
+ SidebarMenuItem.displayName = "SidebarMenuItem";
159
+ const sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", {
160
+ variants: {
161
+ variant: {
162
+ default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
163
+ outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
164
+ },
165
+ size: {
166
+ default: "h-8 text-sm",
167
+ sm: "h-7 text-xs",
168
+ lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0",
169
+ },
170
+ },
171
+ defaultVariants: {
172
+ variant: "default",
173
+ size: "default",
174
+ },
175
+ });
176
+ const SidebarMenuButton = React.forwardRef(({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }, ref) => {
177
+ const Comp = asChild ? Slot : "button";
178
+ const { isMobile, state } = useSidebar();
179
+ const button = (_jsx(Comp, { ref: ref, "data-sidebar": "menu-button", "data-size": size, "data-active": isActive, className: cn(sidebarMenuButtonVariants({ variant, size }), className), ...props }));
180
+ if (!tooltip) {
181
+ return button;
182
+ }
183
+ if (typeof tooltip === "string") {
184
+ tooltip = {
185
+ children: tooltip,
186
+ };
187
+ }
188
+ return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: button }), _jsx(TooltipContent, { side: "right", align: "center", hidden: state !== "collapsed" || isMobile, ...tooltip })] }));
189
+ });
190
+ SidebarMenuButton.displayName = "SidebarMenuButton";
191
+ const SidebarMenuAction = React.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
192
+ const Comp = asChild ? Slot : "button";
193
+ return (_jsx(Comp, { ref: ref, "data-sidebar": "menu-action", className: cn("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 after:md:hidden", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", showOnHover &&
194
+ "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0", className), ...props }));
195
+ });
196
+ SidebarMenuAction.displayName = "SidebarMenuAction";
197
+ const SidebarMenuBadge = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, "data-sidebar": "menu-badge", className: cn("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className), ...props })));
198
+ SidebarMenuBadge.displayName = "SidebarMenuBadge";
199
+ const SidebarMenuSkeleton = React.forwardRef(({ className, showIcon = false, ...props }, ref) => {
200
+ const width = React.useMemo(() => {
201
+ return `${Math.floor(Math.random() * 40) + 50}%`;
202
+ }, []);
203
+ return (_jsxs("div", { ref: ref, "data-sidebar": "menu-skeleton", className: cn("rounded-md h-8 flex gap-2 px-2 items-center", className), ...props, children: [showIcon && (_jsx(Skeleton, { className: "size-4 rounded-md", "data-sidebar": "menu-skeleton-icon" })), _jsx(Skeleton, { className: "h-4 flex-1 max-w-[--skeleton-width]", "data-sidebar": "menu-skeleton-text", style: {
204
+ "--skeleton-width": width,
205
+ } })] }));
206
+ });
207
+ SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
208
+ const SidebarMenuSub = React.forwardRef(({ className, ...props }, ref) => (_jsx("ul", { ref: ref, "data-sidebar": "menu-sub", className: cn("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5", "group-data-[collapsible=icon]:hidden", className), ...props })));
209
+ SidebarMenuSub.displayName = "SidebarMenuSub";
210
+ const SidebarMenuSubItem = React.forwardRef(({ ...props }, ref) => _jsx("li", { ref: ref, ...props }));
211
+ SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
212
+ const SidebarMenuSubButton = React.forwardRef(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
213
+ const Comp = asChild ? Slot : "a";
214
+ return (_jsx(Comp, { ref: ref, "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, className: cn("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", size === "sm" && "text-xs", size === "md" && "text-sm", "group-data-[collapsible=icon]:hidden", className), ...props }));
215
+ });
216
+ SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
217
+ export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar, };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mtxuilib",
3
3
  "private": false,
4
- "version": "0.1.511",
4
+ "version": "0.1.512",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },