mtxuilib 0.1.259 → 0.1.260

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,7 +1,7 @@
1
1
  type IconProps = React.HTMLAttributes<SVGElement>;
2
+ export type Icon = LucideIcon;
2
3
  import { type LucideProps } from "lucide-react";
3
4
  import type { LucideIcon } from "lucide-react";
4
- export type Icon = LucideIcon;
5
5
  export declare const iconVariants: (props?: ({
6
6
  variant?: "toolbar" | "menuItem" | null | undefined;
7
7
  size?: "md" | "sm" | null | undefined;
@@ -0,0 +1 @@
1
+ export declare const SquarePenIcon: (props: any) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ export const SquarePenIcon = (props) => {
3
+ return (_jsx(_Fragment, { children: _jsxs("svg", { ...props, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }), _jsx("path", { d: "M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z" })] }) }));
4
+ };
@@ -0,0 +1,7 @@
1
+ import { type ReactNode } from "react";
2
+ export declare const DashBreadcrumb: (props: {
3
+ listClasses?: string;
4
+ classActivate?: string;
5
+ capitalizeLinks?: boolean;
6
+ homeElement?: ReactNode;
7
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { DASH_PATH } from "mtxlib/lib/consts";
4
+ import { cn } from "mtxuilib/lib/utils";
5
+ import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from "mtxuilib/ui/breadcrumb";
6
+ import Link from "next/link";
7
+ import { usePathname, useSelectedLayoutSegments } from "next/navigation";
8
+ import { Fragment } from "react";
9
+ export const DashBreadcrumb = (props) => {
10
+ const { listClasses, classActivate, capitalizeLinks } = props;
11
+ const paths = usePathname();
12
+ const selectedLayoutSegments = useSelectedLayoutSegments();
13
+ const middleItems = selectedLayoutSegments.slice(0, selectedLayoutSegments.length - 1);
14
+ const pageItem = selectedLayoutSegments.slice(-1);
15
+ return (_jsx(_Fragment, { children: _jsx(Breadcrumb, { className: cn("hidden md:flex"), children: _jsxs(BreadcrumbList, { className: "font-bold", children: [_jsx(BreadcrumbItem, { children: _jsx(BreadcrumbLink, { asChild: true, children: _jsx(Link, { href: `${DASH_PATH}`, children: "dash" }) }) }), _jsx(BreadcrumbSeparator, {}), middleItems.map((link, index) => {
16
+ const href = `${DASH_PATH}/${selectedLayoutSegments.slice(0, index + 1).join("/")}`;
17
+ const itemClasses = paths === href ? `${listClasses} ${classActivate}` : listClasses;
18
+ const itemLink = capitalizeLinks
19
+ ? link[0].toUpperCase() + link.slice(1, link.length)
20
+ : link;
21
+ return (_jsxs(Fragment, { children: [_jsx(BreadcrumbItem, { className: itemClasses, children: _jsx(BreadcrumbLink, { asChild: true, children: _jsx(Link, { href: href, children: itemLink }) }) }), _jsx(BreadcrumbSeparator, {})] }, link));
22
+ }), _jsx(BreadcrumbItem, { children: _jsx(BreadcrumbPage, { children: pageItem }) })] }) }) }));
23
+ };
@@ -0,0 +1,13 @@
1
+ import type { LucideIcon } from "lucide-react";
2
+ interface SiderNavItemProps {
3
+ isCollapsed: boolean;
4
+ links?: {
5
+ title: string;
6
+ label?: string;
7
+ icon: LucideIcon;
8
+ variant: "default" | "ghost";
9
+ href: string;
10
+ }[];
11
+ }
12
+ export declare function SiderNavItem({ links, isCollapsed }: SiderNavItemProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from "mtxuilib/lib/utils";
4
+ import { buttonVariants } from "mtxuilib/ui/button";
5
+ import { Tooltip, TooltipContent, TooltipTrigger } from "mtxuilib/ui/tooltip";
6
+ import Link from "next/link";
7
+ export function SiderNavItem({ links, isCollapsed }) {
8
+ return (_jsx("div", { "data-collapsed": isCollapsed, className: "group flex flex-col gap-4 py-2 data-[collapsed=true]:py-2", children: _jsx("nav", { className: "grid gap-1 px-2 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2", children: links?.map((link, index) => isCollapsed ? (_jsxs(Tooltip, { delayDuration: 0, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs(Link, { href: link.href, className: cn(buttonVariants({ variant: link.variant, size: "icon" }), "h-9 w-9", link.variant === "default" &&
9
+ "dark:bg-muted dark:text-muted-foreground dark:hover:bg-muted dark:hover:text-white"), children: [_jsx(link.icon, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: link.title })] }) }), _jsxs(TooltipContent, { side: "right", className: "flex items-center gap-4", children: [link.title, link.label && _jsx("span", { className: "text-muted-foreground ml-auto", children: link.label })] })] }, link.href)) : (_jsxs(Link, { href: link.href, className: cn(buttonVariants({ variant: link.variant, size: "sm" }), link.variant === "default" && "dark:bg-muted dark:hover:bg-muted dark:text-white dark:hover:text-white", "justify-start"), children: [_jsx(link.icon, { className: "mr-2 h-4 w-4" }), link.title, link.label && (_jsx("span", { className: cn("ml-auto", link.variant === "default" && "text-background dark:text-white"), children: link.label }))] }, link.href))) }) }));
10
+ }
@@ -0,0 +1,47 @@
1
+ import { type StateCreator } from "zustand";
2
+ import type { Renderable } from "../../lib/render";
3
+ export type Dash5LayoutProps = {
4
+ defaultAsideCollapsed?: boolean;
5
+ navCollapsedSize?: number;
6
+ isSideCollapsed?: boolean;
7
+ siderComponent?: Renderable;
8
+ postion?: "fullScreen" | "inline";
9
+ setSiderComponent: (siderComponent: Renderable) => void;
10
+ };
11
+ export interface Dash5LayoutState extends Dash5LayoutProps {
12
+ _hasHydrated?: boolean;
13
+ setHasHydrated: (_hasHydrated: boolean) => void;
14
+ defaultLayout: number[];
15
+ setIsSideCollapsed: (isSideCollapsed: boolean) => void;
16
+ }
17
+ export declare const createAppSlice: StateCreator<Dash5LayoutState, [
18
+ ], [
19
+ ], Dash5LayoutState>;
20
+ export declare const gomtmContext: import("react").Context<(Omit<Omit<Omit<import("zustand").StoreApi<Dash5LayoutState>, "persist"> & {
21
+ persist: {
22
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<Dash5LayoutState, {
23
+ [k: string]: unknown;
24
+ }>>) => void;
25
+ clearStorage: () => void;
26
+ rehydrate: () => Promise<void> | void;
27
+ hasHydrated: () => boolean;
28
+ onHydrate: (fn: (state: Dash5LayoutState) => void) => () => void;
29
+ onFinishHydration: (fn: (state: Dash5LayoutState) => void) => () => void;
30
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<Dash5LayoutState, {
31
+ [k: string]: unknown;
32
+ }>>;
33
+ };
34
+ }, "setState"> & {
35
+ setState<A extends string | {
36
+ type: string;
37
+ }>(partial: Dash5LayoutState | Partial<Dash5LayoutState> | ((state: Dash5LayoutState) => Dash5LayoutState | Partial<Dash5LayoutState>), replace?: boolean | undefined, action?: A | undefined): void;
38
+ }, "setState"> & {
39
+ setState(nextStateOrUpdater: Dash5LayoutState | Partial<Dash5LayoutState> | ((state: import("immer").WritableDraft<Dash5LayoutState>) => void), shouldReplace?: boolean | undefined, action?: string | {
40
+ type: string;
41
+ } | undefined): void;
42
+ }) | null>;
43
+ type AppProviderProps = React.PropsWithChildren<Dash5LayoutProps>;
44
+ export declare const Dash5LayoutProvider: (props: AppProviderProps) => import("react/jsx-runtime").JSX.Element;
45
+ export declare function useDash5Store(): Dash5LayoutState;
46
+ export declare function useDash5Store<T>(selector: (state: Dash5LayoutState) => T): T;
47
+ export {};
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext, useMemo } from "react";
4
+ import { createStore, useStore } from "zustand";
5
+ import { devtools, persist } from "zustand/middleware";
6
+ import { immer } from "zustand/middleware/immer";
7
+ import { useShallow } from "zustand/react/shallow";
8
+ export const createAppSlice = (set, get, init) => {
9
+ return {
10
+ isDev: false,
11
+ isCollapsed: false,
12
+ defaultLayout: [30, 70],
13
+ postion: "fullScreen",
14
+ ...init,
15
+ setHasHydrated: (_hasHydrated) => set({ _hasHydrated }),
16
+ setIsSideCollapsed: (isSideCollapsed) => set({ isSideCollapsed }),
17
+ setSiderComponent: (siderComponent) => set({ siderComponent }),
18
+ };
19
+ };
20
+ const createMtAppStore = (initProps) => {
21
+ const initialState = { ...initProps };
22
+ return createStore()(persist(devtools(immer((...a) => ({
23
+ ...createAppSlice(...a),
24
+ ...initialState,
25
+ })), {
26
+ name: "Dash5Layout",
27
+ }), {
28
+ name: "Dash5Layout",
29
+ skipHydration: true,
30
+ version: 1,
31
+ onRehydrateStorage: () => (state, error) => {
32
+ state?.setHasHydrated(true);
33
+ },
34
+ partialize: (state) => {
35
+ return Object.fromEntries(Object.entries(state).filter(([key]) => {
36
+ return ![
37
+ "cookieStr",
38
+ "children",
39
+ "openFab",
40
+ "userInfo",
41
+ "_hasHydrated",
42
+ "socket",
43
+ "session",
44
+ ].includes(key);
45
+ }));
46
+ },
47
+ }));
48
+ };
49
+ export const gomtmContext = createContext(null);
50
+ export const Dash5LayoutProvider = (props) => {
51
+ const { children, ...etc } = props;
52
+ const mystore = useMemo(() => createMtAppStore(etc), [etc]);
53
+ return (_jsx(gomtmContext.Provider, { value: mystore, children: children }));
54
+ };
55
+ const DEFAULT_USE_SHALLOW = true;
56
+ export function useDash5Store(selector) {
57
+ const store = useContext(gomtmContext);
58
+ if (!store)
59
+ throw new Error("useDash5Store must in Dash5LayoutProvider");
60
+ if (selector) {
61
+ return useStore(store, DEFAULT_USE_SHALLOW ? useShallow(selector) : selector);
62
+ }
63
+ return useStore(store);
64
+ }
@@ -0,0 +1 @@
1
+ export declare const Header: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Home, LineChart, Package, Package2, PanelLeft, ShoppingCart, Users2 } from "lucide-react";
4
+ import { cn } from "mtxuilib/lib/utils";
5
+ import { Button } from "mtxuilib/ui/button";
6
+ import { Sheet, SheetContent, SheetTrigger } from "mtxuilib/ui/sheet";
7
+ import Link from "next/link";
8
+ import { Suspense } from "react";
9
+ export const Header = () => {
10
+ return (_jsxs("header", { className: cn("bg-background sticky top-0 z-30 flex h-14 items-center gap-4 border-b px-4 pt-1 sm:static sm:h-auto sm:border-0 sm:bg-transparent sm:px-6"), children: [_jsxs(Sheet, { children: [_jsx(SheetTrigger, { asChild: true, children: _jsxs(Button, { size: "icon", variant: "outline", className: "sm:hidden", children: [_jsx(PanelLeft, { className: "h-5 w-5" }), _jsx("span", { className: "sr-only", children: "Toggle Menu" })] }) }), _jsx(SheetContent, { side: "left", className: "sm:max-w-xs", children: _jsxs("nav", { className: "grid gap-6 text-lg font-medium", children: [_jsxs(Link, { href: "#", className: "bg-primary text-primary-foreground group flex h-10 w-10 shrink-0 items-center justify-center gap-2 rounded-full text-lg font-semibold md:text-base", children: [_jsx(Package2, { className: "h-5 w-5 transition-all group-hover:scale-110" }), _jsx("span", { className: "sr-only", children: "Acme Inc" })] }), _jsxs(Link, { href: "#", className: "text-muted-foreground hover:text-foreground flex items-center gap-4 px-2.5", children: [_jsx(Home, { className: "h-5 w-5" }), "Dashboard"] }), _jsxs(Link, { href: "#", className: "text-foreground flex items-center gap-4 px-2.5", children: [_jsx(ShoppingCart, { className: "h-5 w-5" }), "Orders"] }), _jsxs(Link, { href: "#", className: "text-muted-foreground hover:text-foreground flex items-center gap-4 px-2.5", children: [_jsx(Package, { className: "h-5 w-5" }), "Products"] }), _jsxs(Link, { href: "#", className: "text-muted-foreground hover:text-foreground flex items-center gap-4 px-2.5", children: [_jsx(Users2, { className: "h-5 w-5" }), "Customers"] }), _jsxs(Link, { href: "#", className: "text-muted-foreground hover:text-foreground flex items-center gap-4 px-2.5", children: [_jsx(LineChart, { className: "h-5 w-5" }), "Settings"] })] }) })] }), _jsx("div", { className: "flex-1" }), _jsx(Suspense, {})] }));
11
+ };
@@ -0,0 +1,3 @@
1
+ import { type PropsWithChildren } from "react";
2
+ import { type Dash5LayoutProps } from "./dash5.store";
3
+ export declare function Dash5Layout(props: PropsWithChildren<Dash5LayoutProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from "mtxuilib/lib/utils";
4
+ import { useRef } from "react";
5
+ import { Users2 } from "lucide-react";
6
+ import { ScreenPanel } from "../../ui/mt/ScreenPanel";
7
+ import { ResizableHandle, ResizablePanel, ResizablePanelGroup, } from "../../ui/resizable";
8
+ import { Dash5LayoutProvider, useDash5Store, } from "./dash5.store";
9
+ import { Header } from "./header";
10
+ import { Nav } from "./nav";
11
+ const childrenDashRouters = [
12
+ {
13
+ label: "dashboard",
14
+ },
15
+ { label: "home" },
16
+ ];
17
+ export function Dash5Layout(props) {
18
+ const position = props.postion || "fullScreen";
19
+ return (_jsx(Dash5LayoutProvider, { ...props, children: position === "fullScreen" ? (_jsx(ScreenPanel, { children: _jsx(DashLayoutInner, { children: props.children }) })) : (_jsx(DashLayoutInner, { children: props.children })) }));
20
+ }
21
+ const DashLayoutInner = (props) => {
22
+ const isSideCollapsed = useDash5Store((x) => x.isSideCollapsed);
23
+ const defaultLayout = useDash5Store((x) => x.defaultLayout);
24
+ const navCollapsedSize = useDash5Store((x) => x.navCollapsedSize);
25
+ const setIsSideCollapsed = useDash5Store((x) => x.setIsSideCollapsed);
26
+ const navPanelRef = useRef(null);
27
+ return (_jsxs(ResizablePanelGroup, { direction: "horizontal", onLayout: (sizes) => {
28
+ document.cookie = `react-resizable-panels:layout=${JSON.stringify(sizes)}`;
29
+ }, className: "h-full max-h-[940px] items-stretch", children: [_jsx(ResizablePanel, { ref: navPanelRef, defaultSize: defaultLayout[0], collapsedSize: navCollapsedSize, collapsible: true, minSize: 12, maxSize: 20, onCollapse: () => {
30
+ setIsSideCollapsed(true);
31
+ }, onExpand: () => {
32
+ setIsSideCollapsed(false);
33
+ }, className: cn(isSideCollapsed &&
34
+ "min-w-[50px] transition-all duration-300 ease-in-out", "hidden sm:flex sm:flex-col"), children: _jsx(Nav, { isCollapsed: isSideCollapsed || false, links: childrenDashRouters?.map((x) => {
35
+ return {
36
+ title: x.label || "no-title",
37
+ label: x.label || "no-label",
38
+ icon: Users2,
39
+ variant: "ghost",
40
+ };
41
+ }) }) }), _jsx(ResizableHandle, { withHandle: true, className: "hidden md:flex" }), _jsx(ResizablePanel, { defaultSize: defaultLayout[1], minSize: 30, children: _jsx("div", { className: "bg-muted/40 flex min-h-screen w-full flex-col", children: _jsxs("div", { className: cn("flex min-h-dvh flex-col"), children: [_jsx(Header, {}), _jsx("div", { className: "flex p-1", children: _jsx("main", { className: cn("flex h-full min-h-full flex-1", "flex-col px-1"), children: props.children }) }), _jsx("div", { className: "bg-slate-50" })] }) }) })] }));
42
+ };
@@ -0,0 +1,12 @@
1
+ import type { LucideIcon } from "lucide-react";
2
+ interface NavProps {
3
+ isCollapsed: boolean;
4
+ links: {
5
+ title: string;
6
+ label?: string;
7
+ icon: LucideIcon;
8
+ variant: "default" | "ghost";
9
+ }[];
10
+ }
11
+ export declare function Nav({ links, isCollapsed }: NavProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import Link from "next/link";
4
+ import { cn } from "../../lib/utils";
5
+ import { buttonVariants } from "../../ui/button";
6
+ import { MtButton } from "../../ui/mt/Button";
7
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../../ui/tooltip";
8
+ import { useDash5Store } from "./dash5.store";
9
+ export function Nav({ links, isCollapsed }) {
10
+ const isSideCollapsed = useDash5Store((x) => x.isSideCollapsed);
11
+ const setIsSideCollapsed = useDash5Store((x) => x.setIsSideCollapsed);
12
+ return (_jsxs("div", { "data-collapsed": isCollapsed, className: "group flex flex-col gap-4 py-2 data-[collapsed=true]:py-2", children: [_jsx("nav", { className: "grid gap-1 px-2 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2", children: links.map((link, index) => isCollapsed ? (_jsxs(Tooltip, { delayDuration: 0, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs(Link, { href: "#", className: cn(buttonVariants({ variant: link.variant, size: "icon" }), "h-9 w-9", link.variant === "default" &&
13
+ "dark:bg-muted dark:text-muted-foreground dark:hover:bg-muted dark:hover:text-white"), children: [_jsx(link.icon, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: link.title })] }) }), _jsxs(TooltipContent, { side: "right", className: "flex items-center gap-4", children: [link.title, link.label && (_jsx("span", { className: "ml-auto text-muted-foreground", children: link.label }))] })] }, index)) : (_jsxs(Link, { href: "#", className: cn(buttonVariants({ variant: link.variant, size: "sm" }), link.variant === "default" &&
14
+ "dark:bg-muted dark:text-white dark:hover:bg-muted dark:hover:text-white", "justify-start"), children: [_jsx(link.icon, { className: "mr-2 h-4 w-4" }), link.title, link.label && (_jsx("span", { className: cn("ml-auto", link.variant === "default" &&
15
+ "text-background dark:text-white"), children: link.label }))] }, index))) }), _jsxs("div", { className: "mt-auto pb-4", children: [_jsx(CollapseButton, {}), _jsx(Test1Button, {})] })] }));
16
+ }
17
+ const CollapseButton = () => {
18
+ const isSideCollapsed = useDash5Store((x) => x.isSideCollapsed);
19
+ const setIsSideCollapsed = useDash5Store((x) => x.setIsSideCollapsed);
20
+ return (_jsx(_Fragment, { children: _jsx("button", { onClick: () => setIsSideCollapsed(!isSideCollapsed), className: "flex w-full items-center justify-center p-2 text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800 transition-colors", "aria-label": isSideCollapsed ? "Expand sidebar" : "Collapse sidebar", children: isSideCollapsed ? (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 5l7 7-7 7M5 5l7 7-7 7" }) })) : (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M11 19l-7-7 7-7m8 14l-7-7 7-7" }) })) }) }));
21
+ };
22
+ const Test1Button = () => {
23
+ const state = useDash5Store();
24
+ return (_jsx(MtButton, { onClick: () => {
25
+ console.log(state);
26
+ }, children: "\u6D4B\u8BD51" }));
27
+ };
@@ -1,3 +1,3 @@
1
- export type Renderable<TProps> = React.ReactNode | React.ComponentType<TProps>;
1
+ export type Renderable<TProps = any> = React.ReactNode | React.ComponentType<TProps>;
2
2
  export declare function flexRender<TProps extends object>(Comp: Renderable<TProps>, props: TProps): React.ReactNode | JSX.Element;
3
3
  export declare function isReactComponent<TProps>(component: unknown): component is React.ComponentType<TProps>;
@@ -0,0 +1,11 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import React from "react";
3
+ declare const iconButtonVariants: (props?: ({
4
+ variant?: "primary" | "secondary" | "default" | null | undefined;
5
+ size?: "lg" | "sm" | "default" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof iconButtonVariants> {
8
+ asChild?: boolean;
9
+ }
10
+ export declare const IconButton: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
+ export {};
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Slot } from "@radix-ui/react-slot";
4
+ import { cva } from "class-variance-authority";
5
+ import React from "react";
6
+ import { cn } from "../../lib/utils";
7
+ const iconButtonVariants = cva("inline-flex items-center justify-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", {
8
+ variants: {
9
+ variant: {
10
+ default: "bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground",
11
+ primary: "bg-primary text-primary-foreground hover:bg-primary/90",
12
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
13
+ },
14
+ size: {
15
+ default: "h-10 w-10",
16
+ sm: "h-8 w-8",
17
+ lg: "h-12 w-12",
18
+ },
19
+ },
20
+ defaultVariants: {
21
+ variant: "default",
22
+ size: "default",
23
+ },
24
+ });
25
+ export const IconButton = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
26
+ const Comp = asChild ? Slot : "button";
27
+ return (_jsx(Comp, { className: cn(iconButtonVariants({ variant, size, className })), ref: ref, ...props }));
28
+ });
29
+ IconButton.displayName = "IconButton";
@@ -19,5 +19,5 @@ export const ScreenPanel = (props) => {
19
19
  }
20
20
  return (_jsx("div", { className: "relative", children: _jsxs("div", { ref: scrollRef, className: cn("fixed left-0 top-0 z-30 mx-auto max-h-full min-h-full w-full overflow-auto ", "bg-background/95 supports-[backdrop-filter]:bg-background/60 backdrop-blur", className), children: [onOpenChange && (_jsx("div", { className: "flex justify-end gap-2", children: _jsx(MtButton, { variant: "ghost", onClick: () => {
21
21
  onOpenChange(false);
22
- }, children: "X" }) })), _jsx("div", { className: cn("relative mx-auto p-2 md:p-4 lg:p-6"), children: children })] }) }));
22
+ }, children: "X" }) })), children] }) }));
23
23
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mtxuilib",
3
3
  "private": false,
4
- "version": "0.1.259",
4
+ "version": "0.1.260",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },