mtxuilib 0.1.423 → 0.1.425
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/lib/utils.d.ts +3 -0
- package/dist/lib/utils.js +34 -0
- package/dist/ui/mt/Dialog.d.ts +57 -0
- package/dist/ui/mt/Dialog.js +55 -0
- package/dist/ui/mt/IconButton.d.ts +20 -9
- package/dist/ui/mt/IconButton.js +26 -26
- package/dist/ui/mt/LoadingDots.d.ts +5 -0
- package/dist/ui/mt/LoadingDots.js +12 -0
- package/dist/ui/mt/utils/easings.d.ts +1 -0
- package/dist/ui/mt/utils/easings.js +2 -0
- package/package.json +14 -14
- package/dist/ui/mt/mt-tree-view/MtTreeViewExample.d.ts +0 -1
- package/dist/ui/mt/mt-tree-view/MtTreeViewExample.js +0 -2
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ClassValue } from "clsx";
|
|
2
2
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
+
type ClassNamesArg = undefined | string | Record<string, boolean> | ClassNamesArg[];
|
|
4
|
+
export declare function classNames(...args: ClassNamesArg[]): string;
|
|
3
5
|
export declare function newUniqueId(): string;
|
|
4
6
|
export declare function formatDate(input: string | number): string;
|
|
5
7
|
export declare const randomString: (length: number) => string;
|
|
@@ -39,3 +41,4 @@ export declare const getMessageFromCode: (resultCode: string) => "Invalid creden
|
|
|
39
41
|
export declare const copyClipboard: (obj: any) => void;
|
|
40
42
|
export declare function isObject(object: any): boolean;
|
|
41
43
|
export declare function deepEqual(object1: Record<string, any>, object2: Record<string, any>): boolean;
|
|
44
|
+
export {};
|
package/dist/lib/utils.js
CHANGED
|
@@ -4,6 +4,40 @@ import { twMerge } from "tailwind-merge";
|
|
|
4
4
|
export function cn(...inputs) {
|
|
5
5
|
return twMerge(clsx(inputs));
|
|
6
6
|
}
|
|
7
|
+
export function classNames(...args) {
|
|
8
|
+
let classes = "";
|
|
9
|
+
for (const arg of args) {
|
|
10
|
+
classes = appendClass(classes, parseValue(arg));
|
|
11
|
+
}
|
|
12
|
+
return classes;
|
|
13
|
+
}
|
|
14
|
+
function parseValue(arg) {
|
|
15
|
+
if (typeof arg === "string" || typeof arg === "number") {
|
|
16
|
+
return arg;
|
|
17
|
+
}
|
|
18
|
+
if (typeof arg !== "object") {
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(arg)) {
|
|
22
|
+
return classNames(...arg);
|
|
23
|
+
}
|
|
24
|
+
let classes = "";
|
|
25
|
+
for (const key in arg) {
|
|
26
|
+
if (arg[key]) {
|
|
27
|
+
classes = appendClass(classes, key);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return classes;
|
|
31
|
+
}
|
|
32
|
+
function appendClass(value, newClass) {
|
|
33
|
+
if (!newClass) {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
if (value) {
|
|
37
|
+
return `${value} ${newClass}`;
|
|
38
|
+
}
|
|
39
|
+
return value + newClass;
|
|
40
|
+
}
|
|
7
41
|
export function newUniqueId() {
|
|
8
42
|
return randomString(10);
|
|
9
43
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as RadixDialog from "@radix-ui/react-dialog";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import { type ReactNode } from "react";
|
|
4
|
+
export { Close as DialogClose, Root as DialogRoot, } from "@radix-ui/react-dialog";
|
|
5
|
+
export declare const dialogBackdropVariants: {
|
|
6
|
+
closed: {
|
|
7
|
+
opacity: number;
|
|
8
|
+
transition: {
|
|
9
|
+
duration: number;
|
|
10
|
+
ease: (t: number) => number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
open: {
|
|
14
|
+
opacity: number;
|
|
15
|
+
transition: {
|
|
16
|
+
duration: number;
|
|
17
|
+
ease: (t: number) => number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare const dialogVariants: {
|
|
22
|
+
closed: {
|
|
23
|
+
x: string;
|
|
24
|
+
y: string;
|
|
25
|
+
scale: number;
|
|
26
|
+
opacity: number;
|
|
27
|
+
transition: {
|
|
28
|
+
duration: number;
|
|
29
|
+
ease: (t: number) => number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
open: {
|
|
33
|
+
x: string;
|
|
34
|
+
y: string;
|
|
35
|
+
scale: number;
|
|
36
|
+
opacity: number;
|
|
37
|
+
transition: {
|
|
38
|
+
duration: number;
|
|
39
|
+
ease: (t: number) => number;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
interface DialogButtonProps {
|
|
44
|
+
type: "primary" | "secondary" | "danger";
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
onClick?: (event: React.UIEvent) => void;
|
|
47
|
+
}
|
|
48
|
+
export declare const DialogButton: React.MemoExoticComponent<({ type, children, onClick }: DialogButtonProps) => import("react/jsx-runtime").JSX.Element>;
|
|
49
|
+
export declare const DialogTitle: React.MemoExoticComponent<({ className, children, ...props }: RadixDialog.DialogTitleProps) => import("react/jsx-runtime").JSX.Element>;
|
|
50
|
+
export declare const DialogDescription: React.MemoExoticComponent<({ className, children, ...props }: RadixDialog.DialogDescriptionProps) => import("react/jsx-runtime").JSX.Element>;
|
|
51
|
+
interface DialogProps {
|
|
52
|
+
children: ReactNode | ReactNode[];
|
|
53
|
+
className?: string;
|
|
54
|
+
onBackdrop?: (event: React.UIEvent) => void;
|
|
55
|
+
onClose?: (event: React.UIEvent) => void;
|
|
56
|
+
}
|
|
57
|
+
export declare const Dialog: React.MemoExoticComponent<({ className, children, onBackdrop, onClose }: DialogProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as RadixDialog from "@radix-ui/react-dialog";
|
|
4
|
+
import { motion } from "framer-motion";
|
|
5
|
+
import { classNames } from "mtxuilib/lib/utils";
|
|
6
|
+
import { memo } from "react";
|
|
7
|
+
import { IconButton } from "./IconButton";
|
|
8
|
+
import { cubicEasingFn } from "./utils/easings";
|
|
9
|
+
export { Close as DialogClose, Root as DialogRoot, } from "@radix-ui/react-dialog";
|
|
10
|
+
const transition = {
|
|
11
|
+
duration: 0.15,
|
|
12
|
+
ease: cubicEasingFn,
|
|
13
|
+
};
|
|
14
|
+
export const dialogBackdropVariants = {
|
|
15
|
+
closed: {
|
|
16
|
+
opacity: 0,
|
|
17
|
+
transition,
|
|
18
|
+
},
|
|
19
|
+
open: {
|
|
20
|
+
opacity: 1,
|
|
21
|
+
transition,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export const dialogVariants = {
|
|
25
|
+
closed: {
|
|
26
|
+
x: "-50%",
|
|
27
|
+
y: "-40%",
|
|
28
|
+
scale: 0.96,
|
|
29
|
+
opacity: 0,
|
|
30
|
+
transition,
|
|
31
|
+
},
|
|
32
|
+
open: {
|
|
33
|
+
x: "-50%",
|
|
34
|
+
y: "-50%",
|
|
35
|
+
scale: 1,
|
|
36
|
+
opacity: 1,
|
|
37
|
+
transition,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export const DialogButton = memo(({ type, children, onClick }) => {
|
|
41
|
+
return (_jsx("button", { type: "button", className: classNames("inline-flex h-[35px] items-center justify-center rounded-lg px-4 text-sm leading-none focus:outline-none", {
|
|
42
|
+
"bg-bolt-elements-button-primary-background text-bolt-elements-button-primary-text hover:bg-bolt-elements-button-primary-backgroundHover": type === "primary",
|
|
43
|
+
"bg-bolt-elements-button-secondary-background text-bolt-elements-button-secondary-text hover:bg-bolt-elements-button-secondary-backgroundHover": type === "secondary",
|
|
44
|
+
"bg-bolt-elements-button-danger-background text-bolt-elements-button-danger-text hover:bg-bolt-elements-button-danger-backgroundHover": type === "danger",
|
|
45
|
+
}), onClick: onClick, children: children }));
|
|
46
|
+
});
|
|
47
|
+
export const DialogTitle = memo(({ className, children, ...props }) => {
|
|
48
|
+
return (_jsx(RadixDialog.Title, { className: classNames("px-5 py-4 flex items-center justify-between border-b border-bolt-elements-borderColor text-lg font-semibold leading-6 text-bolt-elements-textPrimary", className), ...props, children: children }));
|
|
49
|
+
});
|
|
50
|
+
export const DialogDescription = memo(({ className, children, ...props }) => {
|
|
51
|
+
return (_jsx(RadixDialog.Description, { className: classNames("px-5 py-4 text-bolt-elements-textPrimary text-md", className), ...props, children: children }));
|
|
52
|
+
});
|
|
53
|
+
export const Dialog = memo(({ className, children, onBackdrop, onClose }) => {
|
|
54
|
+
return (_jsxs(RadixDialog.Portal, { children: [_jsx(RadixDialog.Overlay, { onClick: onBackdrop, asChild: true, children: _jsx(motion.div, { className: "bg-black/50 fixed inset-0 z-max", initial: "closed", animate: "open", exit: "closed", variants: dialogBackdropVariants }) }), _jsx(RadixDialog.Content, { asChild: true, children: _jsxs(motion.div, { className: classNames("fixed top-[50%] left-[50%] z-max max-h-[85vh] w-[90vw] max-w-[450px] translate-x-[-50%] translate-y-[-50%] border border-bolt-elements-borderColor rounded-lg bg-bolt-elements-background-depth-2 shadow-lg focus:outline-none overflow-hidden", className), initial: "closed", animate: "open", exit: "closed", variants: dialogVariants, children: [children, _jsx(RadixDialog.Close, { asChild: true, onClick: onClose, children: _jsx(IconButton, { icon: "i-ph:x", className: "absolute top-[10px] right-[10px]" }) })] }) })] }));
|
|
55
|
+
});
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import type React from "react";
|
|
2
|
+
type IconSize = "sm" | "md" | "lg" | "xl" | "xxl";
|
|
3
|
+
interface BaseIconButtonProps {
|
|
4
|
+
size?: IconSize;
|
|
5
|
+
className?: string;
|
|
6
|
+
iconClassName?: string;
|
|
7
|
+
disabledClassName?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
9
11
|
}
|
|
10
|
-
|
|
12
|
+
type IconButtonWithoutChildrenProps = {
|
|
13
|
+
icon: string;
|
|
14
|
+
children?: undefined;
|
|
15
|
+
} & BaseIconButtonProps;
|
|
16
|
+
type IconButtonWithChildrenProps = {
|
|
17
|
+
icon?: undefined;
|
|
18
|
+
children: string | JSX.Element | JSX.Element[];
|
|
19
|
+
} & BaseIconButtonProps;
|
|
20
|
+
type IconButtonProps = IconButtonWithoutChildrenProps | IconButtonWithChildrenProps;
|
|
21
|
+
export declare const IconButton: React.MemoExoticComponent<({ icon, size, className, iconClassName, disabledClassName, disabled, title, onClick, children, }: IconButtonProps) => import("react/jsx-runtime").JSX.Element>;
|
|
11
22
|
export {};
|
package/dist/ui/mt/IconButton.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
},
|
|
3
|
+
import { classNames } from "mtxuilib/lib/utils";
|
|
4
|
+
import { memo } from "react";
|
|
5
|
+
export const IconButton = memo(({ icon, size = "xl", className, iconClassName, disabledClassName, disabled = false, title, onClick, children, }) => {
|
|
6
|
+
return (_jsx("button", { type: "button", className: classNames("flex items-center text-bolt-elements-item-contentDefault bg-transparent enabled:hover:text-bolt-elements-item-contentActive rounded-md p-1 enabled:hover:bg-bolt-elements-item-backgroundActive disabled:cursor-not-allowed", {
|
|
7
|
+
[classNames("opacity-30", disabledClassName)]: disabled,
|
|
8
|
+
}, className), title: title, disabled: disabled, onClick: (event) => {
|
|
9
|
+
if (disabled) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
onClick?.(event);
|
|
13
|
+
}, children: children ? (children) : (_jsx("div", { className: classNames(icon, getIconSize(size), iconClassName) })) }));
|
|
24
14
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
15
|
+
function getIconSize(size) {
|
|
16
|
+
if (size === "sm") {
|
|
17
|
+
return "text-sm";
|
|
18
|
+
}
|
|
19
|
+
if (size === "md") {
|
|
20
|
+
return "text-md";
|
|
21
|
+
}
|
|
22
|
+
if (size === "lg") {
|
|
23
|
+
return "text-lg";
|
|
24
|
+
}
|
|
25
|
+
if (size === "xl") {
|
|
26
|
+
return "text-xl";
|
|
27
|
+
}
|
|
28
|
+
return "text-2xl";
|
|
29
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useEffect, useState } from 'react';
|
|
3
|
+
export const LoadingDots = memo(({ text }) => {
|
|
4
|
+
const [dotCount, setDotCount] = useState(0);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const interval = setInterval(() => {
|
|
7
|
+
setDotCount((prevDotCount) => (prevDotCount + 1) % 4);
|
|
8
|
+
}, 500);
|
|
9
|
+
return () => clearInterval(interval);
|
|
10
|
+
}, []);
|
|
11
|
+
return (_jsx("div", { className: "flex justify-center items-center h-full", children: _jsxs("div", { className: "relative", children: [_jsx("span", { children: text }), _jsx("span", { className: "absolute left-[calc(100%-12px)]", children: '.'.repeat(dotCount) }), _jsx("span", { className: "invisible", children: "..." })] }) }));
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cubicEasingFn: (t: number) => number;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mtxuilib",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.425",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -83,8 +83,7 @@
|
|
|
83
83
|
"build": "rimraf ./dist/ && bunx tsc -p tsconfig.json --outDir dist --jsx \"react-jsx\" --incremental false --noEmit false --removeComments true --declaration true && cp -r src/styles dist/styles"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@ai-sdk/openai": "^0.0.
|
|
87
|
-
"@bufbuild/protobuf": "^1.10.0",
|
|
86
|
+
"@ai-sdk/openai": "^0.0.66",
|
|
88
87
|
"@headlessui/react": "^2.1.2",
|
|
89
88
|
"@hookform/resolvers": "^3.9.0",
|
|
90
89
|
"@radix-ui/react-accessible-icon": "^1.1.0",
|
|
@@ -124,8 +123,7 @@
|
|
|
124
123
|
"@vercel/analytics": "^1.3.1",
|
|
125
124
|
"@vercel/kv": "^2.0.0",
|
|
126
125
|
"@vercel/og": "^0.6.2",
|
|
127
|
-
"ai": "^3.
|
|
128
|
-
"bun": "^1.1.26",
|
|
126
|
+
"ai": "^3.4.9",
|
|
129
127
|
"class-variance-authority": "^0.7.0",
|
|
130
128
|
"clsx": "^2.1.1",
|
|
131
129
|
"cmdk": "0.2.1",
|
|
@@ -197,13 +195,11 @@
|
|
|
197
195
|
"@changesets/get-github-info": "^0.6.0",
|
|
198
196
|
"@cloudflare/kv-asset-handler": "^0.3.4",
|
|
199
197
|
"@cloudflare/workers-types": "^4.20240806.0",
|
|
200
|
-
"@connectrpc/protoc-gen-connect-es": "^1.4.0",
|
|
201
198
|
"@edge-runtime/ponyfill": "^2.4.2",
|
|
202
199
|
"@jest/globals": "^29.7.0",
|
|
203
200
|
"@jest/types": "^29.6.3",
|
|
204
201
|
"@netlify/plugin-nextjs": "^4.41.3",
|
|
205
202
|
"@playwright/test": "^1.46.0",
|
|
206
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
|
|
207
203
|
"@shikijs/compat": "^1.12.1",
|
|
208
204
|
"@tailwindcss/forms": "^0.5.7",
|
|
209
205
|
"@tailwindcss/typography": "^0.5.14",
|
|
@@ -240,9 +236,6 @@
|
|
|
240
236
|
"eslint-plugin-testing-library": "latest",
|
|
241
237
|
"eslint-plugin-unused-imports": "latest",
|
|
242
238
|
"extract-files": "^13.0.0",
|
|
243
|
-
"jest": "^29.7.0",
|
|
244
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
245
|
-
"jest-environment-node": "^29.7.0",
|
|
246
239
|
"playwright": "^1.46.0",
|
|
247
240
|
"postcss": "^8.4.41",
|
|
248
241
|
"postcss-loader": "^6.2.1",
|
|
@@ -251,16 +244,23 @@
|
|
|
251
244
|
"react-refresh": "^0.14.2",
|
|
252
245
|
"react-test-renderer": "^18.3.1",
|
|
253
246
|
"rimraf": "^5.0.10",
|
|
254
|
-
"sass": "^1.77.8",
|
|
255
|
-
"sass-loader": "^13.3.3",
|
|
256
247
|
"shiki": "^1.12.1",
|
|
257
248
|
"sirv": "^2.0.4",
|
|
258
249
|
"style-loader": "^3.3.4",
|
|
259
250
|
"tailwind-merge": "^2.5.2",
|
|
260
251
|
"tailwindcss": "^3.4.9",
|
|
261
252
|
"tailwindcss-animate": "^1.0.7",
|
|
262
|
-
"ts-node": "^10.9.2",
|
|
263
|
-
"tsc-alias": "^1.8.10",
|
|
264
253
|
"typescript": "^5.5.4"
|
|
254
|
+
},
|
|
255
|
+
"other": {
|
|
256
|
+
"sass": "^1.77.8",
|
|
257
|
+
"sass-loader": "^13.3.3",
|
|
258
|
+
"jest": "^29.7.0",
|
|
259
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
260
|
+
"jest-environment-node": "^29.7.0",
|
|
261
|
+
"bun": "^1.1.26",
|
|
262
|
+
"@bufbuild/protobuf": "^1.10.0",
|
|
263
|
+
"tsc-alias": "^1.8.10",
|
|
264
|
+
"ts-node": "^10.9.2"
|
|
265
265
|
}
|
|
266
266
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|