mtxuilib 0.1.342 → 0.1.343
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.
- package/dist/ui/mt/MtForm.d.ts +1 -0
- package/dist/ui/mt/MtForm.js +2 -0
- package/dist/ui/mt/NavTag.js +3 -2
- package/dist/ui/mt/dialog/MtDialog.d.ts +4 -2
- package/dist/ui/mt/dialog/MtDialog.js +10 -11
- package/package.json +1 -1
- package/dist/common/SlntTree/SlntChildrenTabs.d.ts +0 -1
- package/dist/common/SlntTree/SlntChildrenTabs.js +0 -26
package/dist/ui/mt/MtForm.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export declare const MtForm: <TFieldValues extends import("react-hook-form").FieldValues, TContext = any, TTransformedValues extends import("react-hook-form").FieldValues | undefined = undefined>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => import("react").JSX.Element;
|
|
2
|
+
export declare const MtInput: import("react").ForwardRefExoticComponent<import("../input").InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
package/dist/ui/mt/MtForm.js
CHANGED
package/dist/ui/mt/NavTag.js
CHANGED
|
@@ -11,12 +11,13 @@ export const NavTabs = ({ items, enableGobackBtn }) => {
|
|
|
11
11
|
const segment = useSelectedLayoutSegment();
|
|
12
12
|
const segments = useSelectedLayoutSegments();
|
|
13
13
|
const pathname = usePathname();
|
|
14
|
-
const
|
|
14
|
+
const segPath = segments.join("/");
|
|
15
|
+
const basePath = segPath ? pathname.slice(0, -segPath.length - 1) : pathname;
|
|
15
16
|
const go = useGo();
|
|
16
17
|
return (_jsxs("div", { className: "flex", children: [enableGobackBtn && (_jsx(MtButton, { variant: "ghost", onClick: () => {
|
|
17
18
|
go.goParent();
|
|
18
19
|
}, children: _jsx(ChevronLeft, { className: "mr-2 size-4" }) })), items?.map((item, i) => {
|
|
19
|
-
const href = `${urlJoinPaths(
|
|
20
|
+
const href = `${urlJoinPaths(basePath, item.routeName)}`;
|
|
20
21
|
return (_jsx(TabItem, { activate: (segment || "") === item.routeName, children: _jsx(MtLink, { href: href, children: item.label }) }, i));
|
|
21
22
|
})] }));
|
|
22
23
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Dialog } from "../../dialog";
|
|
1
|
+
import type { ComponentProps, PropsWithChildren } from "react";
|
|
2
|
+
import { Dialog, DialogContent } from "../../dialog";
|
|
3
|
+
import { DrawerContent } from "../../drawer";
|
|
3
4
|
interface MtDialogProps extends ComponentProps<typeof Dialog> {
|
|
4
5
|
title?: React.ReactNode;
|
|
5
6
|
description?: React.ReactNode;
|
|
6
7
|
actions?: React.ReactNode;
|
|
7
8
|
}
|
|
8
9
|
export declare function MtDialog(props: React.PropsWithChildren<MtDialogProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function MtDialogContent(props: PropsWithChildren<ComponentProps<typeof DialogContent> & ComponentProps<typeof DrawerContent>>): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { useIsDesktop } from "../../../hooks/use-media-query";
|
|
4
|
-
import { Dialog, DialogContent
|
|
5
|
-
import { Drawer, DrawerContent
|
|
3
|
+
import { Dialog, DialogContent } from "../../dialog";
|
|
4
|
+
import { Drawer, DrawerContent } from "../../drawer";
|
|
6
5
|
export function MtDialog(props) {
|
|
7
|
-
const
|
|
6
|
+
const { ...restProps } = props;
|
|
8
7
|
const isDesktop = useIsDesktop();
|
|
9
|
-
const handleOpenChange = (open) => {
|
|
10
|
-
setOpen(open);
|
|
11
|
-
props.onOpenChange?.(open);
|
|
12
|
-
};
|
|
13
8
|
if (isDesktop) {
|
|
14
|
-
return
|
|
9
|
+
return _jsx(Dialog, { ...restProps });
|
|
15
10
|
}
|
|
16
|
-
return
|
|
11
|
+
return _jsx(Drawer, { ...restProps });
|
|
12
|
+
}
|
|
13
|
+
export function MtDialogContent(props) {
|
|
14
|
+
const isDesktop = useIsDesktop();
|
|
15
|
+
return (_jsxs(_Fragment, { children: [isDesktop && _jsx(DialogContent, { ...props }), !isDesktop && _jsx(DrawerContent, { ...props })] }));
|
|
17
16
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const SlntChildrenTabs: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { urlJoinPaths } from "mtxlib/http/url";
|
|
4
|
-
import { usePathname, useSelectedLayoutSegment, useSelectedLayoutSegments, } from "next/navigation";
|
|
5
|
-
import { cn } from "../../lib/utils";
|
|
6
|
-
import { MtLink } from "../mtlink";
|
|
7
|
-
import { useMenuTreeStore } from "./SlntTreeNode";
|
|
8
|
-
export const SlntChildrenTabs = () => {
|
|
9
|
-
const parentData = useMenuTreeStore((x) => x.menuNode);
|
|
10
|
-
const pathName = usePathname();
|
|
11
|
-
const segments = useSelectedLayoutSegments();
|
|
12
|
-
const segment = useSelectedLayoutSegment();
|
|
13
|
-
const basePath = pathName.slice(0, -segments.join("/").length);
|
|
14
|
-
const basePath3 = `/${segments.join("/")}`;
|
|
15
|
-
return (_jsx("div", { className: "flex gap-1 ", children: parentData?.children?.map((item, i) => {
|
|
16
|
-
let href = `${urlJoinPaths(basePath, item.routeName || "")}`;
|
|
17
|
-
if (!segments?.length) {
|
|
18
|
-
href = urlJoinPaths(pathName, item.routeName || "");
|
|
19
|
-
}
|
|
20
|
-
return (_jsx(TabItem, { activate: segment == item.routeName, children: _jsx(MtLink, { variant: "ghost", href: href, children: item.label }, i) }, i));
|
|
21
|
-
}) }));
|
|
22
|
-
};
|
|
23
|
-
const TabItem = (props) => {
|
|
24
|
-
const { activate, ...etc } = props;
|
|
25
|
-
return (_jsx("div", { "data-state": activate && "active", className: cn("ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow"), ...etc }));
|
|
26
|
-
};
|