mtxuilib 0.1.261 → 0.1.262
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,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
1
2
|
import { type StateCreator } from "zustand";
|
|
2
3
|
import type { Renderable } from "../../lib/render";
|
|
3
4
|
export type Dash5LayoutProps = {
|
|
@@ -12,7 +13,7 @@ export interface Dash5LayoutState extends Dash5LayoutProps {
|
|
|
12
13
|
setHasHydrated: (_hasHydrated: boolean) => void;
|
|
13
14
|
defaultLayout: number[];
|
|
14
15
|
setIsSideCollapsed: (isSideCollapsed: boolean) => void;
|
|
15
|
-
setSiderComponent: (siderComponent:
|
|
16
|
+
setSiderComponent: (siderComponent: ReactNode) => void;
|
|
16
17
|
}
|
|
17
18
|
export declare const createAppSlice: StateCreator<Dash5LayoutState, [
|
|
18
19
|
], [
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
import { Dialog } from "../../dialog";
|
|
3
|
+
interface MtDialogProps extends ComponentProps<typeof Dialog> {
|
|
4
|
+
title?: React.ReactNode;
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
actions?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function MtDialog(props: React.PropsWithChildren<MtDialogProps>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { useMediaQuery } from "../../../hooks/use-media-query";
|
|
4
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "../../dialog";
|
|
5
|
+
import { Drawer, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, } from "../../drawer";
|
|
6
|
+
export function MtDialog(props) {
|
|
7
|
+
const [open, setOpen] = useState(props.open || false);
|
|
8
|
+
const isDesktop = useMediaQuery("(min-width: 768px)");
|
|
9
|
+
const handleOpenChange = (open) => {
|
|
10
|
+
setOpen(open);
|
|
11
|
+
props.onOpenChange?.(open);
|
|
12
|
+
};
|
|
13
|
+
if (isDesktop) {
|
|
14
|
+
return (_jsx(Dialog, { open: open, onOpenChange: handleOpenChange, children: _jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: props.title }), props.description && (_jsx(DialogDescription, { children: props.description }))] }), props.children, props.actions && _jsx(DialogFooter, { children: props.actions })] }) }));
|
|
15
|
+
}
|
|
16
|
+
return (_jsx(Drawer, { open: open, onOpenChange: handleOpenChange, children: _jsxs(DrawerContent, { children: [_jsxs(DrawerHeader, { className: "text-left", children: [_jsx(DrawerTitle, { children: props.title }), props.description && (_jsx(DrawerDescription, { children: props.description }))] }), props.children, props.actions && (_jsx(DrawerFooter, { className: "pt-2", children: props.actions }))] }) }));
|
|
17
|
+
}
|