@turingpaper/ui 0.0.1-test.8 → 0.0.2
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/badge.mjs +7 -7
- package/dist/button.mjs +7 -7
- package/dist/checkbox.mjs +4 -4
- package/dist/components/mermaid-diagram.d.ts +8 -0
- package/dist/dialog.mjs +36 -36
- package/dist/map.mjs +2 -2
- package/dist/mermaid-diagram.mjs +144 -0
- package/dist/provider.mjs +24 -11
- package/dist/radio-group.mjs +6 -6
- package/dist/select.mjs +16 -16
- package/dist/sheet.mjs +14 -14
- package/dist/slider.mjs +7 -7
- package/dist/styles.css +1 -1
- package/dist/switch.mjs +4 -4
- package/dist/tabs.mjs +22 -22
- package/dist/toggle.mjs +9 -9
- package/package.json +7 -1
package/dist/badge.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { cva as n } from "class-variance-authority";
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
5
|
-
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring
|
|
3
|
+
import { cn as i } from "./utils.mjs";
|
|
4
|
+
const a = n(
|
|
5
|
+
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus-visible:outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
|
|
6
6
|
{
|
|
7
7
|
variants: {
|
|
8
8
|
variant: {
|
|
@@ -17,10 +17,10 @@ const i = n(
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
);
|
|
20
|
-
function
|
|
21
|
-
return /* @__PURE__ */ o("div", { className: a(
|
|
20
|
+
function c({ className: r, variant: e, ...t }) {
|
|
21
|
+
return /* @__PURE__ */ o("div", { className: i(a({ variant: e }), r), ...t });
|
|
22
22
|
}
|
|
23
23
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
c as Badge,
|
|
25
|
+
a as badgeVariants
|
|
26
26
|
};
|
package/dist/button.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import * as d from "react";
|
|
|
3
3
|
import { Slot as u } from "radix-ui";
|
|
4
4
|
import { cva as c } from "class-variance-authority";
|
|
5
5
|
import { cn as f } from "./utils.mjs";
|
|
6
|
-
const
|
|
7
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium
|
|
6
|
+
const m = c(
|
|
7
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
@@ -27,21 +27,21 @@ const g = c(
|
|
|
27
27
|
size: "default"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
),
|
|
30
|
+
), g = d.forwardRef(
|
|
31
31
|
({ className: e, variant: r, size: t, asChild: o = !1, ...n }, i) => {
|
|
32
32
|
const s = o ? u.Root : "button";
|
|
33
33
|
return /* @__PURE__ */ a(
|
|
34
34
|
s,
|
|
35
35
|
{
|
|
36
|
-
className: f(
|
|
36
|
+
className: f(m({ variant: r, size: t, className: e })),
|
|
37
37
|
ref: i,
|
|
38
38
|
...n
|
|
39
39
|
}
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
);
|
|
43
|
-
|
|
43
|
+
g.displayName = "Button";
|
|
44
44
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
g as Button,
|
|
46
|
+
m as buttonVariants
|
|
47
47
|
};
|
package/dist/checkbox.mjs
CHANGED
|
@@ -3,12 +3,12 @@ import * as c from "react";
|
|
|
3
3
|
import { Checkbox as r } from "radix-ui";
|
|
4
4
|
import { Check as s } from "lucide-react";
|
|
5
5
|
import { cn as o } from "./utils.mjs";
|
|
6
|
-
const
|
|
6
|
+
const d = c.forwardRef(({ className: i, ...t }, a) => /* @__PURE__ */ e(
|
|
7
7
|
r.Root,
|
|
8
8
|
{
|
|
9
9
|
ref: a,
|
|
10
10
|
className: o(
|
|
11
|
-
"grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary
|
|
11
|
+
"grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary focus-visible:outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
12
12
|
i
|
|
13
13
|
),
|
|
14
14
|
...t,
|
|
@@ -21,7 +21,7 @@ const n = c.forwardRef(({ className: i, ...t }, a) => /* @__PURE__ */ e(
|
|
|
21
21
|
)
|
|
22
22
|
}
|
|
23
23
|
));
|
|
24
|
-
|
|
24
|
+
d.displayName = r.Root.displayName;
|
|
25
25
|
export {
|
|
26
|
-
|
|
26
|
+
d as Checkbox
|
|
27
27
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RenderOptions } from 'beautiful-mermaid';
|
|
2
|
+
export interface MermaidDiagramProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
code: string;
|
|
5
|
+
filename?: string;
|
|
6
|
+
options?: RenderOptions;
|
|
7
|
+
}
|
|
8
|
+
export declare const MermaidDiagram: import('react').ForwardRefExoticComponent<Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof MermaidDiagramProps> & MermaidDiagramProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
package/dist/dialog.mjs
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { jsx as o, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { Dialog as
|
|
2
|
+
import * as l from "react";
|
|
3
|
+
import { Dialog as e } from "radix-ui";
|
|
4
4
|
import { X as c } from "lucide-react";
|
|
5
|
-
import { cn as
|
|
6
|
-
const
|
|
7
|
-
|
|
5
|
+
import { cn as i } from "./utils.mjs";
|
|
6
|
+
const v = e.Root, h = e.Trigger, m = e.Portal, w = e.Close, d = l.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
|
|
7
|
+
e.Overlay,
|
|
8
8
|
{
|
|
9
9
|
ref: s,
|
|
10
|
-
className:
|
|
10
|
+
className: i(
|
|
11
11
|
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
12
|
-
|
|
12
|
+
a
|
|
13
13
|
),
|
|
14
14
|
...t
|
|
15
15
|
}
|
|
16
16
|
));
|
|
17
|
-
d.displayName =
|
|
18
|
-
const
|
|
17
|
+
d.displayName = e.Overlay.displayName;
|
|
18
|
+
const p = l.forwardRef(({ className: a, children: t, ...s }, r) => /* @__PURE__ */ n(m, { children: [
|
|
19
19
|
/* @__PURE__ */ o(d, {}),
|
|
20
20
|
/* @__PURE__ */ n(
|
|
21
|
-
|
|
21
|
+
e.Content,
|
|
22
22
|
{
|
|
23
23
|
ref: r,
|
|
24
|
-
className:
|
|
24
|
+
className: i(
|
|
25
25
|
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
26
|
-
|
|
26
|
+
a
|
|
27
27
|
),
|
|
28
28
|
...s,
|
|
29
29
|
children: [
|
|
30
30
|
t,
|
|
31
|
-
/* @__PURE__ */ n(
|
|
31
|
+
/* @__PURE__ */ n(e.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
32
32
|
/* @__PURE__ */ o(c, { className: "h-4 w-4" }),
|
|
33
33
|
/* @__PURE__ */ o("span", { className: "sr-only", children: "Close" })
|
|
34
34
|
] })
|
|
@@ -36,65 +36,65 @@ const f = i.forwardRef(({ className: e, children: t, ...s }, r) => /* @__PURE__
|
|
|
36
36
|
}
|
|
37
37
|
)
|
|
38
38
|
] }));
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
className:
|
|
39
|
+
p.displayName = e.Content.displayName;
|
|
40
|
+
const f = ({
|
|
41
|
+
className: a,
|
|
42
42
|
...t
|
|
43
43
|
}) => /* @__PURE__ */ o(
|
|
44
44
|
"div",
|
|
45
45
|
{
|
|
46
|
-
className:
|
|
46
|
+
className: i(
|
|
47
47
|
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
48
|
-
|
|
48
|
+
a
|
|
49
49
|
),
|
|
50
50
|
...t
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
|
-
|
|
53
|
+
f.displayName = "DialogHeader";
|
|
54
54
|
const g = ({
|
|
55
|
-
className:
|
|
55
|
+
className: a,
|
|
56
56
|
...t
|
|
57
57
|
}) => /* @__PURE__ */ o(
|
|
58
58
|
"div",
|
|
59
59
|
{
|
|
60
|
-
className:
|
|
60
|
+
className: i(
|
|
61
61
|
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
62
|
-
|
|
62
|
+
a
|
|
63
63
|
),
|
|
64
64
|
...t
|
|
65
65
|
}
|
|
66
66
|
);
|
|
67
67
|
g.displayName = "DialogFooter";
|
|
68
|
-
const u =
|
|
69
|
-
|
|
68
|
+
const u = l.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
|
|
69
|
+
e.Title,
|
|
70
70
|
{
|
|
71
71
|
ref: s,
|
|
72
|
-
className:
|
|
72
|
+
className: i(
|
|
73
73
|
"text-lg font-semibold leading-none tracking-tight",
|
|
74
|
-
|
|
74
|
+
a
|
|
75
75
|
),
|
|
76
76
|
...t
|
|
77
77
|
}
|
|
78
78
|
));
|
|
79
|
-
u.displayName =
|
|
80
|
-
const y =
|
|
81
|
-
|
|
79
|
+
u.displayName = e.Title.displayName;
|
|
80
|
+
const y = l.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
|
|
81
|
+
e.Description,
|
|
82
82
|
{
|
|
83
83
|
ref: s,
|
|
84
|
-
className:
|
|
84
|
+
className: i("text-sm text-muted-foreground", a),
|
|
85
85
|
...t
|
|
86
86
|
}
|
|
87
87
|
));
|
|
88
|
-
y.displayName =
|
|
88
|
+
y.displayName = e.Description.displayName;
|
|
89
89
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
v as Dialog,
|
|
91
|
+
w as DialogClose,
|
|
92
|
+
p as DialogContent,
|
|
93
93
|
y as DialogDescription,
|
|
94
94
|
g as DialogFooter,
|
|
95
|
-
|
|
95
|
+
f as DialogHeader,
|
|
96
96
|
d as DialogOverlay,
|
|
97
97
|
m as DialogPortal,
|
|
98
98
|
u as DialogTitle,
|
|
99
|
-
|
|
99
|
+
h as DialogTrigger
|
|
100
100
|
};
|
package/dist/map.mjs
CHANGED
|
@@ -254,7 +254,7 @@ function Pe({
|
|
|
254
254
|
{
|
|
255
255
|
type: "button",
|
|
256
256
|
onClick: p,
|
|
257
|
-
className: "
|
|
257
|
+
className: "absolute top-1 right-1 z-10 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
|
|
258
258
|
"aria-label": "Close popup",
|
|
259
259
|
children: [
|
|
260
260
|
/* @__PURE__ */ f(K, { className: "h-4 w-4" }),
|
|
@@ -492,7 +492,7 @@ function ze({
|
|
|
492
492
|
{
|
|
493
493
|
type: "button",
|
|
494
494
|
onClick: c,
|
|
495
|
-
className: "
|
|
495
|
+
className: "absolute top-1 right-1 z-10 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
|
|
496
496
|
"aria-label": "Close popup",
|
|
497
497
|
children: [
|
|
498
498
|
/* @__PURE__ */ f(K, { className: "h-4 w-4" }),
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { jsx as r, jsxs as v } from "react/jsx-runtime";
|
|
2
|
+
import { cn as b } from "./utils.mjs";
|
|
3
|
+
import { forwardRef as p, useMemo as f, useState as x, useCallback as h } from "react";
|
|
4
|
+
import { THEMES as S, renderMermaidSVG as w } from "beautiful-mermaid";
|
|
5
|
+
import { TransformWrapper as C, TransformComponent as k, useControls as E } from "react-zoom-pan-pinch";
|
|
6
|
+
import { ZoomIn as N, ZoomOut as O, RotateCcw as T, Check as y, Copy as I, Download as z } from "lucide-react";
|
|
7
|
+
const R = "script, foreignObject, iframe, object, embed", M = /^on/i;
|
|
8
|
+
function j(e) {
|
|
9
|
+
let t;
|
|
10
|
+
try {
|
|
11
|
+
t = new DOMParser().parseFromString(e, "image/svg+xml");
|
|
12
|
+
} catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const o = t.documentElement;
|
|
16
|
+
if (o.tagName !== "svg" || t.querySelector("parsererror") || o.querySelectorAll(R).length > 0) return null;
|
|
17
|
+
const n = o.querySelectorAll("*");
|
|
18
|
+
for (const s of n)
|
|
19
|
+
for (const a of s.attributes)
|
|
20
|
+
if (M.test(a.name)) return null;
|
|
21
|
+
return e;
|
|
22
|
+
}
|
|
23
|
+
const L = {
|
|
24
|
+
...S["github-light"],
|
|
25
|
+
transparent: !0
|
|
26
|
+
};
|
|
27
|
+
function _(e) {
|
|
28
|
+
if (!e) return "mermaid-diagram.svg";
|
|
29
|
+
const t = Math.max(e.lastIndexOf("/"), e.lastIndexOf("\\")), o = t >= 0 ? e.substring(t + 1) : e, n = o.lastIndexOf(".");
|
|
30
|
+
return `${(n > 0 ? o.substring(0, n) : o).replace(/[^a-zA-Z0-9_-]/g, "") || "mermaid-diagram"}.svg`;
|
|
31
|
+
}
|
|
32
|
+
const G = p(({ className: e, code: t, filename: o, options: n, ...s }, a) => {
|
|
33
|
+
const i = f(() => _(o), [o]), { svg: l, error: u } = f(() => {
|
|
34
|
+
if (!t.trim())
|
|
35
|
+
return { svg: null, error: "Empty diagram" };
|
|
36
|
+
let d;
|
|
37
|
+
try {
|
|
38
|
+
d = w(t, { ...L, ...n });
|
|
39
|
+
} catch (c) {
|
|
40
|
+
return {
|
|
41
|
+
svg: null,
|
|
42
|
+
error: c instanceof Error ? c.message : "Invalid diagram"
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return j(d) ? { svg: d, error: null } : { svg: null, error: "Invalid SVG" };
|
|
46
|
+
}, [t, n]);
|
|
47
|
+
return u ? /* @__PURE__ */ r(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
ref: a,
|
|
51
|
+
className: b(
|
|
52
|
+
"flex items-center justify-center text-muted-foreground text-sm",
|
|
53
|
+
e
|
|
54
|
+
),
|
|
55
|
+
...s,
|
|
56
|
+
children: u
|
|
57
|
+
}
|
|
58
|
+
) : /* @__PURE__ */ r(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
ref: a,
|
|
62
|
+
className: b("relative w-full h-full overflow-hidden", e),
|
|
63
|
+
...s,
|
|
64
|
+
children: /* @__PURE__ */ v(
|
|
65
|
+
C,
|
|
66
|
+
{
|
|
67
|
+
initialScale: 1,
|
|
68
|
+
minScale: 0.25,
|
|
69
|
+
maxScale: 4,
|
|
70
|
+
centerOnInit: !0,
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ r(A, { code: t, svg: l, svgFilename: i }),
|
|
73
|
+
/* @__PURE__ */ r(
|
|
74
|
+
k,
|
|
75
|
+
{
|
|
76
|
+
wrapperClass: "!w-full !h-full",
|
|
77
|
+
contentClass: "!w-full",
|
|
78
|
+
children: /* @__PURE__ */ r(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
className: "w-full [&>svg]:w-full [&>svg]:h-auto",
|
|
82
|
+
dangerouslySetInnerHTML: { __html: l }
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}), A = ({ code: e, svg: t, svgFilename: o }) => {
|
|
93
|
+
const { zoomIn: n, zoomOut: s, resetTransform: a } = E(), [i, l] = x(!1), u = h(async () => {
|
|
94
|
+
await navigator.clipboard.writeText(e), l(!0), setTimeout(() => l(!1), 2e3);
|
|
95
|
+
}, [e]), d = h(() => {
|
|
96
|
+
const g = new Blob([t], { type: "image/svg+xml" }), c = URL.createObjectURL(g), m = document.createElement("a");
|
|
97
|
+
m.href = c, m.download = o, m.click(), URL.revokeObjectURL(c);
|
|
98
|
+
}, [t, o]);
|
|
99
|
+
return /* @__PURE__ */ v("div", { className: "absolute top-2 right-2 z-10 flex gap-1", children: [
|
|
100
|
+
/* @__PURE__ */ r(
|
|
101
|
+
"button",
|
|
102
|
+
{
|
|
103
|
+
onClick: () => n(),
|
|
104
|
+
className: "p-1.5 rounded-md bg-background/80 border border-border hover:bg-muted text-foreground",
|
|
105
|
+
children: /* @__PURE__ */ r(N, { size: 16 })
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
/* @__PURE__ */ r(
|
|
109
|
+
"button",
|
|
110
|
+
{
|
|
111
|
+
onClick: () => s(),
|
|
112
|
+
className: "p-1.5 rounded-md bg-background/80 border border-border hover:bg-muted text-foreground",
|
|
113
|
+
children: /* @__PURE__ */ r(O, { size: 16 })
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ r(
|
|
117
|
+
"button",
|
|
118
|
+
{
|
|
119
|
+
onClick: () => a(),
|
|
120
|
+
className: "p-1.5 rounded-md bg-background/80 border border-border hover:bg-muted text-foreground",
|
|
121
|
+
children: /* @__PURE__ */ r(T, { size: 16 })
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ r(
|
|
125
|
+
"button",
|
|
126
|
+
{
|
|
127
|
+
onClick: u,
|
|
128
|
+
className: "p-1.5 rounded-md bg-background/80 border border-border hover:bg-muted text-foreground",
|
|
129
|
+
children: i ? /* @__PURE__ */ r(y, { size: 16 }) : /* @__PURE__ */ r(I, { size: 16 })
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
/* @__PURE__ */ r(
|
|
133
|
+
"button",
|
|
134
|
+
{
|
|
135
|
+
onClick: d,
|
|
136
|
+
className: "p-1.5 rounded-md bg-background/80 border border-border hover:bg-muted text-foreground",
|
|
137
|
+
children: /* @__PURE__ */ r(z, { size: 16 })
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] });
|
|
141
|
+
};
|
|
142
|
+
export {
|
|
143
|
+
G as MermaidDiagram
|
|
144
|
+
};
|