@turingpaper/ui 0.0.13 → 0.0.14

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/card.mjs CHANGED
@@ -1,64 +1,42 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import * as o from "react";
3
- import { cn as t } from "./utils.mjs";
4
- const s = o.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d(
5
- "div",
6
- {
7
- ref: r,
8
- className: t(
9
- "rounded-lg border bg-card text-card-foreground shadow-sm",
10
- a
11
- ),
12
- ...e
13
- }
14
- ));
15
- s.displayName = "Card";
16
- const i = o.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d(
17
- "div",
18
- {
19
- ref: r,
20
- className: t("flex flex-col space-y-1.5 p-6", a),
21
- ...e
22
- }
23
- ));
1
+ import { cn as e } from "./utils.mjs";
2
+ import * as t from "react";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/components/card.tsx
5
+ var r = t.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ n("div", {
6
+ ref: i,
7
+ className: e("rounded-lg border bg-card text-card-foreground shadow-sm", t),
8
+ ...r
9
+ }));
10
+ r.displayName = "Card";
11
+ var i = t.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ n("div", {
12
+ ref: i,
13
+ className: e("flex flex-col space-y-1.5 p-6", t),
14
+ ...r
15
+ }));
24
16
  i.displayName = "CardHeader";
25
- const m = o.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d(
26
- "div",
27
- {
28
- ref: r,
29
- className: t(
30
- "text-2xl font-semibold leading-none tracking-tight",
31
- a
32
- ),
33
- ...e
34
- }
35
- ));
36
- m.displayName = "CardTitle";
37
- const c = o.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d(
38
- "div",
39
- {
40
- ref: r,
41
- className: t("text-sm text-muted-foreground", a),
42
- ...e
43
- }
44
- ));
45
- c.displayName = "CardDescription";
46
- const l = o.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d("div", { ref: r, className: t("p-6 pt-0", a), ...e }));
47
- l.displayName = "CardContent";
48
- const n = o.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d(
49
- "div",
50
- {
51
- ref: r,
52
- className: t("flex items-center p-6 pt-0", a),
53
- ...e
54
- }
55
- ));
56
- n.displayName = "CardFooter";
57
- export {
58
- s as Card,
59
- l as CardContent,
60
- c as CardDescription,
61
- n as CardFooter,
62
- i as CardHeader,
63
- m as CardTitle
64
- };
17
+ var a = t.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ n("div", {
18
+ ref: i,
19
+ className: e("text-2xl font-semibold leading-none tracking-tight", t),
20
+ ...r
21
+ }));
22
+ a.displayName = "CardTitle";
23
+ var o = t.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ n("div", {
24
+ ref: i,
25
+ className: e("text-sm text-muted-foreground", t),
26
+ ...r
27
+ }));
28
+ o.displayName = "CardDescription";
29
+ var s = t.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ n("div", {
30
+ ref: i,
31
+ className: e("p-6 pt-0", t),
32
+ ...r
33
+ }));
34
+ s.displayName = "CardContent";
35
+ var c = t.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ n("div", {
36
+ ref: i,
37
+ className: e("flex items-center p-6 pt-0", t),
38
+ ...r
39
+ }));
40
+ c.displayName = "CardFooter";
41
+ //#endregion
42
+ export { r as Card, s as CardContent, o as CardDescription, c as CardFooter, i as CardHeader, a as CardTitle };
package/dist/chart.mjs CHANGED
@@ -1,208 +1,127 @@
1
- import { jsx as s, jsxs as g, Fragment as T } from "react/jsx-runtime";
2
- import * as f from "react";
3
- import * as w from "recharts";
4
- import { cn as i } from "./utils.mjs";
5
- const P = { light: "", dark: ".dark" }, N = f.createContext(null);
6
- function j() {
7
- const a = f.useContext(N);
8
- if (!a)
9
- throw new Error("useChart must be used within a <ChartContainer />");
10
- return a;
1
+ import { cn as e } from "./utils.mjs";
2
+ import * as t from "react";
3
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ import * as a from "recharts";
5
+ //#region src/components/chart.tsx
6
+ var o = {
7
+ light: "",
8
+ dark: ".dark"
9
+ }, s = t.createContext(null);
10
+ function c() {
11
+ let e = t.useContext(s);
12
+ if (!e) throw Error("useChart must be used within a <ChartContainer />");
13
+ return e;
11
14
  }
12
- const I = f.forwardRef(({ id: a, className: e, children: n, config: r, ...c }, d) => {
13
- const l = f.useId(), o = `chart-${a || l.replace(/:/g, "")}`;
14
- return /* @__PURE__ */ s(N.Provider, { value: { config: r }, children: /* @__PURE__ */ g(
15
- "div",
16
- {
17
- "data-chart": o,
18
- ref: d,
19
- className: i(
20
- "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
21
- e
22
- ),
23
- ...c,
24
- children: [
25
- /* @__PURE__ */ s(S, { id: o, config: r }),
26
- /* @__PURE__ */ s(w.ResponsiveContainer, { children: n })
27
- ]
28
- }
29
- ) });
15
+ var l = t.forwardRef(({ id: n, className: o, children: c, config: l, ...d }, f) => {
16
+ let p = t.useId(), m = `chart-${n || p.replace(/:/g, "")}`;
17
+ return /* @__PURE__ */ r(s.Provider, {
18
+ value: { config: l },
19
+ children: /* @__PURE__ */ i("div", {
20
+ "data-chart": m,
21
+ ref: f,
22
+ className: e("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none", o),
23
+ ...d,
24
+ children: [/* @__PURE__ */ r(u, {
25
+ id: m,
26
+ config: l
27
+ }), /* @__PURE__ */ r(a.ResponsiveContainer, { children: c })]
28
+ })
29
+ });
30
30
  });
31
- I.displayName = "Chart";
32
- const S = ({ id: a, config: e }) => {
33
- const n = Object.entries(e).filter(
34
- ([, r]) => r.theme || r.color
35
- );
36
- return n.length ? /* @__PURE__ */ s(
37
- "style",
38
- {
39
- dangerouslySetInnerHTML: {
40
- __html: Object.entries(P).map(
41
- ([r, c]) => `
42
- ${c} [data-chart=${a}] {
43
- ${n.map(([d, l]) => {
44
- const o = l.theme?.[r] || l.color;
45
- return o ? ` --color-${d}: ${o};` : null;
46
- }).join(`
47
- `)}
31
+ l.displayName = "Chart";
32
+ var u = ({ id: e, config: t }) => {
33
+ let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
34
+ return n.length ? /* @__PURE__ */ r("style", { dangerouslySetInnerHTML: { __html: Object.entries(o).map(([t, r]) => `
35
+ ${r} [data-chart=${e}] {
36
+ ${n.map(([e, n]) => {
37
+ let r = n.theme?.[t] || n.color;
38
+ return r ? ` --color-${e}: ${r};` : null;
39
+ }).join("\n")}
48
40
  }
49
- `
50
- ).join(`
51
- `)
52
- }
53
- }
54
- ) : null;
55
- }, O = w.Tooltip, E = f.forwardRef(
56
- ({
57
- active: a,
58
- payload: e,
59
- className: n,
60
- indicator: r = "dot",
61
- hideLabel: c = !1,
62
- hideIndicator: d = !1,
63
- label: l,
64
- labelFormatter: o,
65
- labelClassName: m,
66
- formatter: h,
67
- color: $,
68
- nameKey: L,
69
- labelKey: x
70
- }, R) => {
71
- const { config: p } = j(), k = f.useMemo(() => {
72
- if (c || !e?.length)
73
- return null;
74
- const [t] = e, b = `${x || t?.dataKey || t?.name || "value"}`, C = _(p, t, b), u = !x && typeof l == "string" ? p[l]?.label || l : C?.label;
75
- return o ? /* @__PURE__ */ s("div", { className: i("font-medium", m), children: o(u, e) }) : u ? /* @__PURE__ */ s("div", { className: i("font-medium", m), children: u }) : null;
76
- }, [
77
- l,
78
- o,
79
- e,
80
- c,
81
- m,
82
- p,
83
- x
84
- ]);
85
- if (!a || !e?.length)
86
- return null;
87
- const v = e.length === 1 && r !== "dot";
88
- return /* @__PURE__ */ g(
89
- "div",
90
- {
91
- ref: R,
92
- className: i(
93
- "grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
94
- n
95
- ),
96
- children: [
97
- v ? null : k,
98
- /* @__PURE__ */ s("div", { className: "grid gap-1.5", children: e.filter((t) => t.type !== "none").map((t, b) => {
99
- const C = `${L || t.name || t.dataKey || "value"}`, u = _(p, t, C), y = $ || t.payload.fill || t.color;
100
- return /* @__PURE__ */ s(
101
- "div",
102
- {
103
- className: i(
104
- "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
105
- r === "dot" && "items-center"
106
- ),
107
- children: h && t?.value !== void 0 && t.name ? h(t.value, t.name, t, b, t.payload) : /* @__PURE__ */ g(T, { children: [
108
- u?.icon ? /* @__PURE__ */ s(u.icon, {}) : !d && /* @__PURE__ */ s(
109
- "div",
110
- {
111
- className: i(
112
- "shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
113
- {
114
- "h-2.5 w-2.5": r === "dot",
115
- "w-1": r === "line",
116
- "w-0 border-[1.5px] border-dashed bg-transparent": r === "dashed",
117
- "my-0.5": v && r === "dashed"
118
- }
119
- ),
120
- style: {
121
- "--color-bg": y,
122
- "--color-border": y
123
- }
124
- }
125
- ),
126
- /* @__PURE__ */ g(
127
- "div",
128
- {
129
- className: i(
130
- "flex flex-1 justify-between leading-none",
131
- v ? "items-end" : "items-center"
132
- ),
133
- children: [
134
- /* @__PURE__ */ g("div", { className: "grid gap-1.5", children: [
135
- v ? k : null,
136
- /* @__PURE__ */ s("span", { className: "text-muted-foreground", children: u?.label || t.name })
137
- ] }),
138
- t.value && /* @__PURE__ */ s("span", { className: "font-mono font-medium tabular-nums text-foreground", children: t.value.toLocaleString() })
139
- ]
140
- }
141
- )
142
- ] })
143
- },
144
- t.dataKey
145
- );
146
- }) })
147
- ]
148
- }
149
- );
150
- }
151
- );
152
- E.displayName = "ChartTooltip";
153
- const q = w.Legend, K = f.forwardRef(
154
- ({ className: a, hideIcon: e = !1, payload: n, verticalAlign: r = "bottom", nameKey: c }, d) => {
155
- const { config: l } = j();
156
- return n?.length ? /* @__PURE__ */ s(
157
- "div",
158
- {
159
- ref: d,
160
- className: i(
161
- "flex items-center justify-center gap-4",
162
- r === "top" ? "pb-3" : "pt-3",
163
- a
164
- ),
165
- children: n.filter((o) => o.type !== "none").map((o) => {
166
- const m = `${c || o.dataKey || "value"}`, h = _(l, o, m);
167
- return /* @__PURE__ */ g(
168
- "div",
169
- {
170
- className: i(
171
- "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
172
- ),
173
- children: [
174
- h?.icon && !e ? /* @__PURE__ */ s(h.icon, {}) : /* @__PURE__ */ s(
175
- "div",
176
- {
177
- className: "h-2 w-2 shrink-0 rounded-[2px]",
178
- style: {
179
- backgroundColor: o.color
180
- }
181
- }
182
- ),
183
- h?.label
184
- ]
185
- },
186
- o.value
187
- );
188
- })
189
- }
190
- ) : null;
191
- }
192
- );
193
- K.displayName = "ChartLegend";
194
- function _(a, e, n) {
195
- if (typeof e != "object" || e === null)
196
- return;
197
- const r = "payload" in e && typeof e.payload == "object" && e.payload !== null ? e.payload : void 0;
198
- let c = n;
199
- return n in e && typeof e[n] == "string" ? c = e[n] : r && n in r && typeof r[n] == "string" && (c = r[n]), c in a ? a[c] : a[n];
41
+ `).join("\n") } }) : null;
42
+ }, d = a.Tooltip, f = t.forwardRef(({ active: a, payload: o, className: s, indicator: l = "dot", hideLabel: u = !1, hideIndicator: d = !1, label: f, labelFormatter: p, labelClassName: m, formatter: g, color: _, nameKey: v, labelKey: y }, b) => {
43
+ let { config: x } = c(), S = t.useMemo(() => {
44
+ if (u || !o?.length) return null;
45
+ let [t] = o, n = h(x, t, `${y || t?.dataKey || t?.name || "value"}`), i = !y && typeof f == "string" ? x[f]?.label || f : n?.label;
46
+ return p ? /* @__PURE__ */ r("div", {
47
+ className: e("font-medium", m),
48
+ children: p(i, o)
49
+ }) : i ? /* @__PURE__ */ r("div", {
50
+ className: e("font-medium", m),
51
+ children: i
52
+ }) : null;
53
+ }, [
54
+ f,
55
+ p,
56
+ o,
57
+ u,
58
+ m,
59
+ x,
60
+ y
61
+ ]);
62
+ if (!a || !o?.length) return null;
63
+ let C = o.length === 1 && l !== "dot";
64
+ return /* @__PURE__ */ i("div", {
65
+ ref: b,
66
+ className: e("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", s),
67
+ children: [C ? null : S, /* @__PURE__ */ r("div", {
68
+ className: "grid gap-1.5",
69
+ children: o.filter((e) => e.type !== "none").map((t, a) => {
70
+ let o = h(x, t, `${v || t.name || t.dataKey || "value"}`), s = _ || t.payload.fill || t.color;
71
+ return /* @__PURE__ */ r("div", {
72
+ className: e("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground", l === "dot" && "items-center"),
73
+ children: g && t?.value !== void 0 && t.name ? g(t.value, t.name, t, a, t.payload) : /* @__PURE__ */ i(n, { children: [o?.icon ? /* @__PURE__ */ r(o.icon, {}) : !d && /* @__PURE__ */ r("div", {
74
+ className: e("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]", {
75
+ "h-2.5 w-2.5": l === "dot",
76
+ "w-1": l === "line",
77
+ "w-0 border-[1.5px] border-dashed bg-transparent": l === "dashed",
78
+ "my-0.5": C && l === "dashed"
79
+ }),
80
+ style: {
81
+ "--color-bg": s,
82
+ "--color-border": s
83
+ }
84
+ }), /* @__PURE__ */ i("div", {
85
+ className: e("flex flex-1 justify-between leading-none", C ? "items-end" : "items-center"),
86
+ children: [/* @__PURE__ */ i("div", {
87
+ className: "grid gap-1.5",
88
+ children: [C ? S : null, /* @__PURE__ */ r("span", {
89
+ className: "text-muted-foreground",
90
+ children: o?.label || t.name
91
+ })]
92
+ }), t.value && /* @__PURE__ */ r("span", {
93
+ className: "font-mono font-medium tabular-nums text-foreground",
94
+ children: t.value.toLocaleString()
95
+ })]
96
+ })] })
97
+ }, t.dataKey);
98
+ })
99
+ })]
100
+ });
101
+ });
102
+ f.displayName = "ChartTooltip";
103
+ var p = a.Legend, m = t.forwardRef(({ className: t, hideIcon: n = !1, payload: a, verticalAlign: o = "bottom", nameKey: s }, l) => {
104
+ let { config: u } = c();
105
+ return a?.length ? /* @__PURE__ */ r("div", {
106
+ ref: l,
107
+ className: e("flex items-center justify-center gap-4", o === "top" ? "pb-3" : "pt-3", t),
108
+ children: a.filter((e) => e.type !== "none").map((t) => {
109
+ let a = h(u, t, `${s || t.dataKey || "value"}`);
110
+ return /* @__PURE__ */ i("div", {
111
+ className: e("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),
112
+ children: [a?.icon && !n ? /* @__PURE__ */ r(a.icon, {}) : /* @__PURE__ */ r("div", {
113
+ className: "h-2 w-2 shrink-0 rounded-[2px]",
114
+ style: { backgroundColor: t.color }
115
+ }), a?.label]
116
+ }, t.value);
117
+ })
118
+ }) : null;
119
+ });
120
+ m.displayName = "ChartLegend";
121
+ function h(e, t, n) {
122
+ if (typeof t != "object" || !t) return;
123
+ let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
124
+ return n in t && typeof t[n] == "string" ? i = t[n] : r && n in r && typeof r[n] == "string" && (i = r[n]), i in e ? e[i] : e[n];
200
125
  }
201
- export {
202
- I as ChartContainer,
203
- q as ChartLegend,
204
- K as ChartLegendContent,
205
- S as ChartStyle,
206
- O as ChartTooltip,
207
- E as ChartTooltipContent
208
- };
126
+ //#endregion
127
+ export { l as ChartContainer, p as ChartLegend, m as ChartLegendContent, u as ChartStyle, d as ChartTooltip, f as ChartTooltipContent };
package/dist/checkbox.mjs CHANGED
@@ -1,27 +1,18 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import * as c from "react";
1
+ import { cn as e } from "./utils.mjs";
2
+ import * as t from "react";
3
+ import { jsx as n } from "react/jsx-runtime";
3
4
  import { Checkbox as r } from "radix-ui";
4
- import { Check as s } from "lucide-react";
5
- import { cn as o } from "./utils.mjs";
6
- const d = c.forwardRef(({ className: i, ...t }, a) => /* @__PURE__ */ e(
7
- r.Root,
8
- {
9
- ref: a,
10
- className: o(
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
- i
13
- ),
14
- ...t,
15
- children: /* @__PURE__ */ e(
16
- r.Indicator,
17
- {
18
- className: o("grid place-content-center text-current"),
19
- children: /* @__PURE__ */ e(s, { className: "h-4 w-4" })
20
- }
21
- )
22
- }
23
- ));
24
- d.displayName = r.Root.displayName;
25
- export {
26
- d as Checkbox
27
- };
5
+ import { Check as i } from "lucide-react";
6
+ //#region src/components/checkbox.tsx
7
+ var a = t.forwardRef(({ className: t, ...a }, o) => /* @__PURE__ */ n(r.Root, {
8
+ ref: o,
9
+ className: e("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", t),
10
+ ...a,
11
+ children: /* @__PURE__ */ n(r.Indicator, {
12
+ className: e("grid place-content-center text-current"),
13
+ children: /* @__PURE__ */ n(i, { className: "h-4 w-4" })
14
+ })
15
+ }));
16
+ a.displayName = r.Root.displayName;
17
+ //#endregion
18
+ export { a as Checkbox };
@@ -1,7 +1,6 @@
1
- import { Collapsible as l } from "radix-ui";
2
- const e = l.Root, s = l.CollapsibleTrigger, i = l.CollapsibleContent;
3
- export {
4
- e as Collapsible,
5
- i as CollapsibleContent,
6
- s as CollapsibleTrigger
7
- };
1
+ "use client";
2
+ import { Collapsible as e } from "radix-ui";
3
+ //#region src/components/collapsible.tsx
4
+ var t = e.Root, n = e.CollapsibleTrigger, r = e.CollapsibleContent;
5
+ //#endregion
6
+ export { t as Collapsible, r as CollapsibleContent, n as CollapsibleTrigger };