tekivex-ui 2.5.2 → 2.5.4

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.
Files changed (85) hide show
  1. package/dist/TkxForm-DSMDo2Ol.js +388 -0
  2. package/dist/TkxForm-DwV_n-eE.cjs +12 -0
  3. package/dist/charts.cjs +1 -1
  4. package/dist/charts.js +324 -301
  5. package/dist/headless.cjs +1 -1
  6. package/dist/headless.js +396 -195
  7. package/dist/i18n.cjs +1 -0
  8. package/dist/i18n.js +757 -0
  9. package/dist/index.cjs +27 -22
  10. package/dist/index.d.ts +2 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +4994 -5089
  13. package/dist/quantum.cjs +91 -0
  14. package/dist/quantum.js +2312 -0
  15. package/dist/realtime.cjs +25 -0
  16. package/dist/realtime.js +944 -0
  17. package/dist/security-C369oOWH.cjs +1 -0
  18. package/dist/security-CzAmaMqa.js +97 -0
  19. package/dist/src/charts/TkxDonutChart.d.ts.map +1 -1
  20. package/dist/src/charts/TkxPieChart.d.ts.map +1 -1
  21. package/dist/src/components/TkxDataGrid.d.ts +9 -1
  22. package/dist/src/components/TkxDataGrid.d.ts.map +1 -1
  23. package/dist/src/components/TkxDropdown.d.ts +41 -0
  24. package/dist/src/components/TkxDropdown.d.ts.map +1 -0
  25. package/dist/src/components/TkxLiveFeed.d.ts +891 -0
  26. package/dist/src/components/TkxLiveFeed.d.ts.map +1 -0
  27. package/dist/src/components/TkxLiveLog.d.ts +892 -0
  28. package/dist/src/components/TkxLiveLog.d.ts.map +1 -0
  29. package/dist/src/components/TkxLiveMetrics.d.ts +24 -0
  30. package/dist/src/components/TkxLiveMetrics.d.ts.map +1 -0
  31. package/dist/src/components/TkxPlayground.d.ts +15 -0
  32. package/dist/src/components/TkxPlayground.d.ts.map +1 -0
  33. package/dist/src/components/TkxQuantumForm.d.ts +20 -0
  34. package/dist/src/components/TkxQuantumForm.d.ts.map +1 -0
  35. package/dist/src/components/TkxRealTimeChart.d.ts +27 -0
  36. package/dist/src/components/TkxRealTimeChart.d.ts.map +1 -0
  37. package/dist/src/components/TkxTable.d.ts +11 -1
  38. package/dist/src/components/TkxTable.d.ts.map +1 -1
  39. package/dist/src/components/TkxThemeBuilder.d.ts +9 -0
  40. package/dist/src/components/TkxThemeBuilder.d.ts.map +1 -0
  41. package/dist/src/components/index.d.ts +1 -0
  42. package/dist/src/components/index.d.ts.map +1 -1
  43. package/dist/src/engine/index.d.ts +2 -0
  44. package/dist/src/engine/index.d.ts.map +1 -1
  45. package/dist/src/engine/quantum-ai.d.ts +201 -0
  46. package/dist/src/engine/quantum-ai.d.ts.map +1 -0
  47. package/dist/src/engine/tkx.d.ts.map +1 -1
  48. package/dist/src/headless/index.d.ts +6 -0
  49. package/dist/src/headless/index.d.ts.map +1 -1
  50. package/dist/src/headless/useInfiniteQuery.d.ts +35 -0
  51. package/dist/src/headless/useInfiniteQuery.d.ts.map +1 -0
  52. package/dist/src/headless/useSSE.d.ts +36 -0
  53. package/dist/src/headless/useSSE.d.ts.map +1 -0
  54. package/dist/src/headless/useWebSocket.d.ts +33 -0
  55. package/dist/src/headless/useWebSocket.d.ts.map +1 -0
  56. package/dist/src/quantum/index.d.ts +9 -0
  57. package/dist/src/quantum/index.d.ts.map +1 -0
  58. package/dist/src/realtime/index.d.ts +9 -0
  59. package/dist/src/realtime/index.d.ts.map +1 -0
  60. package/dist/{TkxForm-BWK4LqY3.js → tkx-BJ10JtMv.js} +372 -721
  61. package/dist/tkx-BeNyC0w7.cjs +4 -0
  62. package/package.json +16 -1
  63. package/src/charts/TkxDonutChart.tsx +15 -2
  64. package/src/charts/TkxPieChart.tsx +17 -2
  65. package/src/components/TkxDataGrid.tsx +72 -0
  66. package/src/components/TkxDropdown.tsx +802 -0
  67. package/src/components/TkxLiveFeed.tsx +329 -0
  68. package/src/components/TkxLiveLog.tsx +470 -0
  69. package/src/components/TkxLiveMetrics.tsx +291 -0
  70. package/src/components/TkxPlayground.tsx +736 -0
  71. package/src/components/TkxQuantumForm.tsx +592 -0
  72. package/src/components/TkxRealTimeChart.tsx +381 -0
  73. package/src/components/TkxTable.tsx +351 -77
  74. package/src/components/TkxThemeBuilder.tsx +685 -0
  75. package/src/components/index.ts +4 -0
  76. package/src/engine/index.ts +2 -0
  77. package/src/engine/quantum-ai.ts +1045 -0
  78. package/src/engine/tkx.ts +95 -4
  79. package/src/headless/index.ts +6 -0
  80. package/src/headless/useInfiniteQuery.ts +153 -0
  81. package/src/headless/useSSE.ts +165 -0
  82. package/src/headless/useWebSocket.ts +229 -0
  83. package/src/quantum/index.ts +39 -0
  84. package/src/realtime/index.ts +21 -0
  85. package/dist/TkxForm-ljQjX7KD.cjs +0 -15
@@ -0,0 +1,388 @@
1
+ import { useRef as f, useEffect as j, useCallback as d, useState as K, useMemo as A, cloneElement as X, useContext as O, createContext as Z } from "react";
2
+ import { G as ee, i as te, w as re, x as ne, u as Q } from "./index-eT_U4qB2.js";
3
+ import { jsx as N, jsxs as T, Fragment as se } from "react/jsx-runtime";
4
+ import { s as G } from "./security-CzAmaMqa.js";
5
+ import { t as g, c as S } from "./tkx-BJ10JtMv.js";
6
+ function pe() {
7
+ const [e, r] = K(() => typeof window > "u" ? !1 : ne());
8
+ return j(() => {
9
+ if (typeof window > "u") return;
10
+ const t = window.matchMedia("(prefers-reduced-motion: reduce)"), s = (i) => r(i.matches);
11
+ return t.addEventListener("change", s), () => t.removeEventListener("change", s);
12
+ }, []), e;
13
+ }
14
+ function Fe() {
15
+ const [e, r] = K(() => typeof window > "u" ? !1 : re());
16
+ return j(() => {
17
+ if (typeof window > "u") return;
18
+ const t = window.matchMedia("(forced-colors: active)"), s = (i) => r(i.matches);
19
+ return t.addEventListener("change", s), () => t.removeEventListener("change", s);
20
+ }, []), e;
21
+ }
22
+ function ge(e) {
23
+ const r = f(null);
24
+ return j(() => {
25
+ if (!e || !r.current) return;
26
+ const t = te(r.current);
27
+ return t.activate(), () => t.deactivate();
28
+ }, [e]), r;
29
+ }
30
+ function ye() {
31
+ const e = f(null);
32
+ return j(() => {
33
+ if (!(typeof document > "u"))
34
+ return e.current = ee(), () => {
35
+ var r;
36
+ (r = e.current) == null || r.destroy();
37
+ };
38
+ }, []), d((r, t = "polite") => {
39
+ var s;
40
+ (s = e.current) == null || s.announce(r, t);
41
+ }, []);
42
+ }
43
+ function ve(e, r = !0) {
44
+ const t = f(e);
45
+ t.current = e, j(() => {
46
+ if (!r || typeof document > "u") return;
47
+ const s = (i) => {
48
+ i.key === "Escape" && t.current();
49
+ };
50
+ return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
51
+ }, [r]);
52
+ }
53
+ function we(e, r) {
54
+ const t = f(r);
55
+ t.current = r, j(() => {
56
+ const s = (i) => {
57
+ !e.current || e.current.contains(i.target) || t.current();
58
+ };
59
+ return document.addEventListener("pointerdown", s), () => document.removeEventListener("pointerdown", s);
60
+ }, [e]);
61
+ }
62
+ const W = Z(null);
63
+ function oe() {
64
+ const e = O(W);
65
+ if (!e)
66
+ throw new Error("TkxFormField must be used inside a <TkxForm>. Wrap your fields in a TkxForm component.");
67
+ return e;
68
+ }
69
+ async function _(e, r) {
70
+ for (const t of r) {
71
+ if (t.required && (e == null || e === "" || Array.isArray(e) && e.length === 0))
72
+ return t.message ?? "This field is required";
73
+ if (!(e == null || e === "")) {
74
+ if (t.min !== void 0) {
75
+ if (typeof e == "string" && e.length < t.min)
76
+ return t.message ?? `Must be at least ${t.min} characters`;
77
+ if (typeof e == "number" && e < t.min)
78
+ return t.message ?? `Must be at least ${t.min}`;
79
+ }
80
+ if (t.max !== void 0) {
81
+ if (typeof e == "string" && e.length > t.max)
82
+ return t.message ?? `Must be no more than ${t.max} characters`;
83
+ if (typeof e == "number" && e > t.max)
84
+ return t.message ?? `Must be no more than ${t.max}`;
85
+ }
86
+ if (t.pattern && typeof e == "string" && !t.pattern.test(e))
87
+ return t.message ?? "Invalid format";
88
+ if (t.validator) {
89
+ const s = await t.validator(e);
90
+ if (s)
91
+ return s;
92
+ }
93
+ }
94
+ }
95
+ return null;
96
+ }
97
+ function ce(e, r) {
98
+ const t = e ? [...e] : [];
99
+ return r && !t.some((s) => s.required) && t.unshift({ required: !0, message: "This field is required" }), t;
100
+ }
101
+ function ie(e) {
102
+ return e.some((r) => r.required);
103
+ }
104
+ function Ee() {
105
+ const e = O(W), r = f({}), t = f({}), s = f({}), i = A(() => ({
106
+ getFieldValue: (u) => r.current[u],
107
+ setFieldValue: (u, E) => {
108
+ r.current[u] = E;
109
+ },
110
+ getFieldsValue: () => ({ ...r.current }),
111
+ setFieldsValue: (u) => {
112
+ Object.assign(r.current, u);
113
+ },
114
+ validateFields: () => Promise.resolve({ ...r.current }),
115
+ validateField: (u) => Promise.resolve(!0),
116
+ resetFields: () => {
117
+ r.current = {}, t.current = {}, s.current = {};
118
+ },
119
+ getFieldError: (u) => t.current[u] ?? null,
120
+ isFieldTouched: (u) => s.current[u] ?? !1
121
+ }), []);
122
+ return e ? e.instance : i;
123
+ }
124
+ function ue({
125
+ onSubmit: e,
126
+ onValuesChange: r,
127
+ initialValues: t = {},
128
+ layout: s = "vertical",
129
+ disabled: i = !1,
130
+ children: u,
131
+ className: E,
132
+ style: L,
133
+ form: b
134
+ }) {
135
+ const m = Q(), [v, p] = K({
136
+ values: { ...t },
137
+ errors: {},
138
+ touched: {}
139
+ }), H = f(t), h = f({}), x = f(v);
140
+ x.current = v;
141
+ const M = d((n, o) => {
142
+ h.current[n] = o;
143
+ }, []), I = d((n) => {
144
+ delete h.current[n];
145
+ }, []), q = d((n, o) => {
146
+ p((c) => {
147
+ const a = {
148
+ ...c,
149
+ values: { ...c.values, [n]: o }
150
+ };
151
+ return r == null || r({ [n]: o }, a.values), a;
152
+ });
153
+ }, [r]), z = d((n, o) => {
154
+ p((c) => ({
155
+ ...c,
156
+ errors: { ...c.errors, [n]: o }
157
+ }));
158
+ }, []), w = d((n) => {
159
+ p((o) => ({
160
+ ...o,
161
+ touched: { ...o.touched, [n]: !0 }
162
+ }));
163
+ }, []), R = d(async (n) => {
164
+ const o = h.current[n];
165
+ if (!o) return !0;
166
+ const c = x.current.values[n], a = await _(c, o.rules);
167
+ return p((F) => ({
168
+ ...F,
169
+ errors: { ...F.errors, [n]: a },
170
+ touched: { ...F.touched, [n]: !0 }
171
+ })), a === null;
172
+ }, []), k = d(async () => {
173
+ const n = Object.keys(h.current), o = await Promise.all(
174
+ n.map(async (l) => {
175
+ const y = h.current[l], U = x.current.values[l], V = await _(U, y.rules);
176
+ return { name: l, error: V };
177
+ })
178
+ ), c = {}, a = {};
179
+ let F = !1;
180
+ for (const { name: l, error: y } of o)
181
+ c[l] = y, a[l] = !0, y && (F = !0);
182
+ if (p((l) => ({
183
+ ...l,
184
+ errors: { ...l.errors, ...c },
185
+ touched: { ...l.touched, ...a }
186
+ })), F) {
187
+ const l = Object.fromEntries(
188
+ o.filter((y) => y.error).map((y) => [y.name, y.error])
189
+ );
190
+ return Promise.reject(l);
191
+ }
192
+ return { ...x.current.values };
193
+ }, []), P = d(() => {
194
+ p({
195
+ values: { ...H.current },
196
+ errors: {},
197
+ touched: {}
198
+ });
199
+ }, []), Y = A(() => ({
200
+ getFieldValue: (n) => x.current.values[n],
201
+ setFieldValue: q,
202
+ getFieldsValue: () => ({ ...x.current.values }),
203
+ setFieldsValue: (n) => {
204
+ p((o) => {
205
+ const c = { ...o.values, ...n };
206
+ return r == null || r(n, c), { ...o, values: c };
207
+ });
208
+ },
209
+ validateFields: k,
210
+ validateField: R,
211
+ resetFields: P,
212
+ getFieldError: (n) => x.current.errors[n] ?? null,
213
+ isFieldTouched: (n) => !!x.current.touched[n]
214
+ }), [q, k, R, P, r]), C = d(async (n) => {
215
+ n.preventDefault();
216
+ try {
217
+ const o = await k();
218
+ await (e == null ? void 0 : e(o));
219
+ } catch {
220
+ }
221
+ }, [k, e]), $ = s === "inline" ? g("flex flex-row flex-wrap items-end gap-4") : g("flex flex-col gap-5"), B = b ?? Y, D = A(() => ({
222
+ state: v,
223
+ initialValues: H.current,
224
+ layout: s,
225
+ disabled: i,
226
+ fieldMeta: h,
227
+ setFieldValue: q,
228
+ setFieldError: z,
229
+ setFieldTouched: w,
230
+ registerField: M,
231
+ unregisterField: I,
232
+ validateField: R,
233
+ instance: B
234
+ }), [v, s, i, q, z, w, M, I, R, B]);
235
+ return /* @__PURE__ */ N(W.Provider, { value: D, children: /* @__PURE__ */ N(
236
+ "form",
237
+ {
238
+ noValidate: !0,
239
+ role: "form",
240
+ "aria-label": "Form",
241
+ onSubmit: C,
242
+ className: S($, E),
243
+ style: {
244
+ color: m.text,
245
+ ...L
246
+ },
247
+ children: u
248
+ }
249
+ ) });
250
+ }
251
+ ue.displayName = "TkxForm";
252
+ function ae({
253
+ name: e,
254
+ label: r,
255
+ rules: t,
256
+ help: s,
257
+ required: i,
258
+ children: u,
259
+ className: E,
260
+ style: L
261
+ }) {
262
+ const b = Q(), m = oe(), { state: v, layout: p, disabled: H } = m, h = A(() => ce(t, i), [t, i]), x = ie(h), M = f({ rules: h });
263
+ M.current.rules = h;
264
+ const I = f(!1);
265
+ I.current || (m.registerField(e, M.current), I.current = !0), A(() => {
266
+ m.registerField(e, M.current);
267
+ }, [h, e, m]);
268
+ const q = v.values[e], z = v.touched[e] ? v.errors[e] ?? null : null, w = z ? G(z) : null, R = r ? G(r) : void 0, k = s ? G(s) : void 0, P = d(
269
+ (c) => {
270
+ let a;
271
+ if (c !== null && typeof c == "object" && "target" in c) {
272
+ const F = c.target;
273
+ a = F.type === "checkbox" ? F.checked : F.value;
274
+ } else
275
+ a = c;
276
+ m.setFieldValue(e, a);
277
+ },
278
+ [m, e]
279
+ ), Y = d(() => {
280
+ m.setFieldTouched(e), m.validateField(e);
281
+ }, [m, e]), C = X(u, {
282
+ value: q ?? "",
283
+ onChange: P,
284
+ onBlur: Y,
285
+ error: w ?? void 0,
286
+ isInvalid: !!w,
287
+ isRequired: x,
288
+ disabled: H || u.props.disabled,
289
+ name: e
290
+ }), $ = p === "horizontal", B = p === "inline", D = /* @__PURE__ */ N("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ N("path", { d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }), n = R ? /* @__PURE__ */ T(
291
+ "label",
292
+ {
293
+ className: g(
294
+ "text-sm font-medium font-sans",
295
+ $ ? "min-w-[140px] pt-2.5" : ""
296
+ ),
297
+ style: { color: b.text },
298
+ children: [
299
+ R,
300
+ x && /* @__PURE__ */ N("span", { "aria-hidden": "true", className: g("ml-1"), style: { color: b.danger }, children: "*" })
301
+ ]
302
+ }
303
+ ) : null, o = /* @__PURE__ */ T(se, { children: [
304
+ k && !w && /* @__PURE__ */ N("span", { className: g("text-xs mt-0.5"), style: { color: b.textMuted }, children: k }),
305
+ w && /* @__PURE__ */ T(
306
+ "span",
307
+ {
308
+ role: "alert",
309
+ className: g("text-xs flex items-center gap-1 mt-0.5"),
310
+ style: {
311
+ color: b.danger,
312
+ animation: "tkxFormErrorReveal 200ms ease-out"
313
+ },
314
+ children: [
315
+ D,
316
+ w
317
+ ]
318
+ }
319
+ )
320
+ ] });
321
+ return B ? /* @__PURE__ */ T(
322
+ "div",
323
+ {
324
+ className: S(g("flex flex-col gap-1"), E),
325
+ style: L,
326
+ children: [
327
+ n,
328
+ C,
329
+ o
330
+ ]
331
+ }
332
+ ) : $ ? /* @__PURE__ */ T(
333
+ "div",
334
+ {
335
+ className: S(g("flex flex-row gap-4 items-start"), E),
336
+ style: L,
337
+ children: [
338
+ n,
339
+ /* @__PURE__ */ T("div", { className: g("flex flex-col gap-1 flex-1 min-w-0"), children: [
340
+ C,
341
+ o
342
+ ] })
343
+ ]
344
+ }
345
+ ) : /* @__PURE__ */ T(
346
+ "div",
347
+ {
348
+ className: S(g("flex flex-col gap-1"), E),
349
+ style: L,
350
+ children: [
351
+ n,
352
+ C,
353
+ o
354
+ ]
355
+ }
356
+ );
357
+ }
358
+ ae.displayName = "TkxFormField";
359
+ let J = !1;
360
+ function le() {
361
+ if (J || typeof document > "u") return;
362
+ J = !0;
363
+ const e = document.createElement("style");
364
+ e.setAttribute("data-tkx-form", ""), e.textContent = `
365
+ @keyframes tkxFormErrorReveal {
366
+ from {
367
+ opacity: 0;
368
+ transform: translateY(-4px);
369
+ }
370
+ to {
371
+ opacity: 1;
372
+ transform: translateY(0);
373
+ }
374
+ }
375
+ `, document.head.appendChild(e);
376
+ }
377
+ le();
378
+ export {
379
+ ue as T,
380
+ ye as a,
381
+ ge as b,
382
+ ve as c,
383
+ we as d,
384
+ ae as e,
385
+ Fe as f,
386
+ Ee as g,
387
+ pe as u
388
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";const n=require("react"),C=require("./index-BINBzXuY.cjs"),l=require("react/jsx-runtime"),$=require("./security-C369oOWH.cjs"),d=require("./tkx-BeNyC0w7.cjs");function G(){const[e,r]=n.useState(()=>typeof window>"u"?!1:C.prefersReducedMotion());return n.useEffect(()=>{if(typeof window>"u")return;const t=window.matchMedia("(prefers-reduced-motion: reduce)"),o=i=>r(i.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[]),e}function J(){const[e,r]=n.useState(()=>typeof window>"u"?!1:C.prefersHighContrast());return n.useEffect(()=>{if(typeof window>"u")return;const t=window.matchMedia("(forced-colors: active)"),o=i=>r(i.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[]),e}function Q(e){const r=n.useRef(null);return n.useEffect(()=>{if(!e||!r.current)return;const t=C.createFocusTrap(r.current);return t.activate(),()=>t.deactivate()},[e]),r}function U(){const e=n.useRef(null);return n.useEffect(()=>{if(!(typeof document>"u"))return e.current=C.createAnnouncer(),()=>{var r;(r=e.current)==null||r.destroy()}},[]),n.useCallback((r,t="polite")=>{var o;(o=e.current)==null||o.announce(r,t)},[])}function V(e,r=!0){const t=n.useRef(e);t.current=e,n.useEffect(()=>{if(!r||typeof document>"u")return;const o=i=>{i.key==="Escape"&&t.current()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[r])}function X(e,r){const t=n.useRef(r);t.current=r,n.useEffect(()=>{const o=i=>{!e.current||e.current.contains(i.target)||t.current()};return document.addEventListener("pointerdown",o),()=>document.removeEventListener("pointerdown",o)},[e])}const B=n.createContext(null);function Z(){const e=n.useContext(B);if(!e)throw new Error("TkxFormField must be used inside a <TkxForm>. Wrap your fields in a TkxForm component.");return e}async function K(e,r){for(const t of r){if(t.required&&(e==null||e===""||Array.isArray(e)&&e.length===0))return t.message??"This field is required";if(!(e==null||e==="")){if(t.min!==void 0){if(typeof e=="string"&&e.length<t.min)return t.message??`Must be at least ${t.min} characters`;if(typeof e=="number"&&e<t.min)return t.message??`Must be at least ${t.min}`}if(t.max!==void 0){if(typeof e=="string"&&e.length>t.max)return t.message??`Must be no more than ${t.max} characters`;if(typeof e=="number"&&e>t.max)return t.message??`Must be no more than ${t.max}`}if(t.pattern&&typeof e=="string"&&!t.pattern.test(e))return t.message??"Invalid format";if(t.validator){const o=await t.validator(e);if(o)return o}}}return null}function ee(e,r){const t=e?[...e]:[];return r&&!t.some(o=>o.required)&&t.unshift({required:!0,message:"This field is required"}),t}function te(e){return e.some(r=>r.required)}function re(){const e=n.useContext(B),r=n.useRef({}),t=n.useRef({}),o=n.useRef({}),i=n.useMemo(()=>({getFieldValue:a=>r.current[a],setFieldValue:(a,v)=>{r.current[a]=v},getFieldsValue:()=>({...r.current}),setFieldsValue:a=>{Object.assign(r.current,a)},validateFields:()=>Promise.resolve({...r.current}),validateField:a=>Promise.resolve(!0),resetFields:()=>{r.current={},t.current={},o.current={}},getFieldError:a=>t.current[a]??null,isFieldTouched:a=>o.current[a]??!1}),[]);return e?e.instance:i}function D({onSubmit:e,onValuesChange:r,initialValues:t={},layout:o="vertical",disabled:i=!1,children:a,className:v,style:M,form:b}){const x=C.useTheme(),[y,p]=n.useState({values:{...t},errors:{},touched:{}}),z=n.useRef(t),h=n.useRef({}),F=n.useRef(y);F.current=y;const T=n.useCallback((s,c)=>{h.current[s]=c},[]),q=n.useCallback(s=>{delete h.current[s]},[]),j=n.useCallback((s,c)=>{p(u=>{const f={...u,values:{...u.values,[s]:c}};return r==null||r({[s]:c},f.values),f})},[r]),N=n.useCallback((s,c)=>{p(u=>({...u,errors:{...u.errors,[s]:c}}))},[]),R=n.useCallback(s=>{p(c=>({...c,touched:{...c.touched,[s]:!0}}))},[]),w=n.useCallback(async s=>{const c=h.current[s];if(!c)return!0;const u=F.current.values[s],f=await K(u,c.rules);return p(g=>({...g,errors:{...g.errors,[s]:f},touched:{...g.touched,[s]:!0}})),f===null},[]),E=n.useCallback(async()=>{const s=Object.keys(h.current),c=await Promise.all(s.map(async m=>{const k=h.current[m],W=F.current.values[m],_=await K(W,k.rules);return{name:m,error:_}})),u={},f={};let g=!1;for(const{name:m,error:k}of c)u[m]=k,f[m]=!0,k&&(g=!0);if(p(m=>({...m,errors:{...m.errors,...u},touched:{...m.touched,...f}})),g){const m=Object.fromEntries(c.filter(k=>k.error).map(k=>[k.name,k.error]));return Promise.reject(m)}return{...F.current.values}},[]),I=n.useCallback(()=>{p({values:{...z.current},errors:{},touched:{}})},[]),S=n.useMemo(()=>({getFieldValue:s=>F.current.values[s],setFieldValue:j,getFieldsValue:()=>({...F.current.values}),setFieldsValue:s=>{p(c=>{const u={...c.values,...s};return r==null||r(s,u),{...c,values:u}})},validateFields:E,validateField:w,resetFields:I,getFieldError:s=>F.current.errors[s]??null,isFieldTouched:s=>!!F.current.touched[s]}),[j,E,w,I,r]),L=n.useCallback(async s=>{s.preventDefault();try{const c=await E();await(e==null?void 0:e(c))}catch{}},[E,e]),A=o==="inline"?d.tkx("flex flex-row flex-wrap items-end gap-4"):d.tkx("flex flex-col gap-5"),H=b??S,P=n.useMemo(()=>({state:y,initialValues:z.current,layout:o,disabled:i,fieldMeta:h,setFieldValue:j,setFieldError:N,setFieldTouched:R,registerField:T,unregisterField:q,validateField:w,instance:H}),[y,o,i,j,N,R,T,q,w,H]);return l.jsx(B.Provider,{value:P,children:l.jsx("form",{noValidate:!0,role:"form","aria-label":"Form",onSubmit:L,className:d.cx(A,v),style:{color:x.text,...M},children:a})})}D.displayName="TkxForm";function O({name:e,label:r,rules:t,help:o,required:i,children:a,className:v,style:M}){const b=C.useTheme(),x=Z(),{state:y,layout:p,disabled:z}=x,h=n.useMemo(()=>ee(t,i),[t,i]),F=te(h),T=n.useRef({rules:h});T.current.rules=h;const q=n.useRef(!1);q.current||(x.registerField(e,T.current),q.current=!0),n.useMemo(()=>{x.registerField(e,T.current)},[h,e,x]);const j=y.values[e],N=y.touched[e]?y.errors[e]??null:null,R=N?$.sanitizeString(N):null,w=r?$.sanitizeString(r):void 0,E=o?$.sanitizeString(o):void 0,I=n.useCallback(u=>{let f;if(u!==null&&typeof u=="object"&&"target"in u){const g=u.target;f=g.type==="checkbox"?g.checked:g.value}else f=u;x.setFieldValue(e,f)},[x,e]),S=n.useCallback(()=>{x.setFieldTouched(e),x.validateField(e)},[x,e]),L=n.cloneElement(a,{value:j??"",onChange:I,onBlur:S,error:R??void 0,isInvalid:!!R,isRequired:F,disabled:z||a.props.disabled,name:e}),A=p==="horizontal",H=p==="inline",P=l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:l.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),s=w?l.jsxs("label",{className:d.tkx("text-sm font-medium font-sans",A?"min-w-[140px] pt-2.5":""),style:{color:b.text},children:[w,F&&l.jsx("span",{"aria-hidden":"true",className:d.tkx("ml-1"),style:{color:b.danger},children:"*"})]}):null,c=l.jsxs(l.Fragment,{children:[E&&!R&&l.jsx("span",{className:d.tkx("text-xs mt-0.5"),style:{color:b.textMuted},children:E}),R&&l.jsxs("span",{role:"alert",className:d.tkx("text-xs flex items-center gap-1 mt-0.5"),style:{color:b.danger,animation:"tkxFormErrorReveal 200ms ease-out"},children:[P,R]})]});return H?l.jsxs("div",{className:d.cx(d.tkx("flex flex-col gap-1"),v),style:M,children:[s,L,c]}):A?l.jsxs("div",{className:d.cx(d.tkx("flex flex-row gap-4 items-start"),v),style:M,children:[s,l.jsxs("div",{className:d.tkx("flex flex-col gap-1 flex-1 min-w-0"),children:[L,c]})]}):l.jsxs("div",{className:d.cx(d.tkx("flex flex-col gap-1"),v),style:M,children:[s,L,c]})}O.displayName="TkxFormField";let Y=!1;function ne(){if(Y||typeof document>"u")return;Y=!0;const e=document.createElement("style");e.setAttribute("data-tkx-form",""),e.textContent=`
2
+ @keyframes tkxFormErrorReveal {
3
+ from {
4
+ opacity: 0;
5
+ transform: translateY(-4px);
6
+ }
7
+ to {
8
+ opacity: 1;
9
+ transform: translateY(0);
10
+ }
11
+ }
12
+ `,document.head.appendChild(e)}ne();exports.TkxForm=D;exports.TkxFormField=O;exports.useAnnounce=U;exports.useClickOutside=X;exports.useEscapeKey=V;exports.useFocusTrap=Q;exports.useHighContrast=J;exports.useReducedMotion=G;exports.useTkxForm=re;
package/dist/charts.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("recharts"),b=require("./index-BINBzXuY.cjs");function C(r){return[r.primary,r.secondary,r.info,r.success,r.warning,r.danger,"#a855f7","#f97316","#14b8a6","#e879f9"]}const v={top:10,right:30,bottom:10,left:0};function T(r){return{contentStyle:{backgroundColor:r.surface,border:`1px solid ${r.border}`,borderRadius:8,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",color:r.text,fontSize:13},labelStyle:{color:r.textMuted,fontWeight:600,marginBottom:4},itemStyle:{color:r.text},cursor:{fill:`${r.primary}15`}}}function A({data:r,series:S,xKey:h,height:m=300,margin:d=v,showGrid:x=!0,showLegend:u=!0,showTooltip:j=!0,smooth:a=!0,xTickFormatter:y,yTickFormatter:i,yDomain:o,ariaLabel:c="Area chart"}){const l=b.useTheme(),f=C(l),n=T(l),g={fill:l.textMuted,fontSize:12};return e.jsx("div",{role:"img","aria-label":c,style:{width:"100%",height:m},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.AreaChart,{data:r,margin:d,children:[x&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:l.border,vertical:!1}),e.jsx(t.XAxis,{dataKey:h,tick:g,axisLine:{stroke:l.border},tickLine:!1,tickFormatter:y}),e.jsx(t.YAxis,{tick:g,axisLine:!1,tickLine:!1,tickFormatter:i,domain:o}),j&&e.jsx(t.Tooltip,{contentStyle:n.contentStyle,labelStyle:n.labelStyle,itemStyle:n.itemStyle,cursor:n.cursor}),u&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:l.textMuted,paddingTop:8}}),S.map((k,p)=>{const s=k.color??f[p%f.length];return e.jsx(t.Area,{type:a?"monotone":"linear",dataKey:k.key,name:k.label??k.key,stroke:s,strokeWidth:2,fill:s,fillOpacity:k.fillOpacity??.2,stackId:k.stacked?"stack":void 0,dot:!1,activeDot:{r:5,strokeWidth:0}},k.key)})]})})})}function z({data:r,series:S,xKey:h,height:m=300,margin:d=v,showGrid:x=!0,showLegend:u=!0,showTooltip:j=!0,layout:a="horizontal",barSize:y,xTickFormatter:i,yTickFormatter:o,ariaLabel:c="Bar chart"}){const l=b.useTheme(),f=C(l),n=T(l),g={fill:l.textMuted,fontSize:12},k=a==="vertical";return e.jsx("div",{role:"img","aria-label":c,style:{width:"100%",height:m},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.BarChart,{data:r,margin:d,layout:a,children:[x&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:l.border,vertical:k,horizontal:!k}),k?e.jsxs(e.Fragment,{children:[e.jsx(t.YAxis,{dataKey:h,type:"category",tick:g,axisLine:!1,tickLine:!1,tickFormatter:i,width:100}),e.jsx(t.XAxis,{type:"number",tick:g,axisLine:{stroke:l.border},tickLine:!1,tickFormatter:o})]}):e.jsxs(e.Fragment,{children:[e.jsx(t.XAxis,{dataKey:h,tick:g,axisLine:{stroke:l.border},tickLine:!1,tickFormatter:i}),e.jsx(t.YAxis,{tick:g,axisLine:!1,tickLine:!1,tickFormatter:o})]}),j&&e.jsx(t.Tooltip,{contentStyle:n.contentStyle,labelStyle:n.labelStyle,itemStyle:n.itemStyle,cursor:{fill:`${l.surfaceAlt}`}}),u&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:l.textMuted,paddingTop:8}}),S.map((p,s)=>{const L=p.color??f[s%f.length];return e.jsx(t.Bar,{dataKey:p.key,name:p.label??p.key,fill:L,stackId:p.stackId,maxBarSize:y??40,radius:p.radius??[4,4,0,0]},p.key)})]})})})}function M({data:r,series:S,xKey:h,height:m=300,margin:d=v,showGrid:x=!0,showLegend:u=!0,showTooltip:j=!0,smooth:a=!0,referenceLines:y=[],xTickFormatter:i,yTickFormatter:o,yDomain:c,connectNulls:l=!1,ariaLabel:f="Line chart"}){const n=b.useTheme(),g=C(n),k=T(n),p={fill:n.textMuted,fontSize:12};return e.jsx("div",{role:"img","aria-label":f,style:{width:"100%",height:m},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.LineChart,{data:r,margin:d,children:[x&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:n.border,vertical:!1}),e.jsx(t.XAxis,{dataKey:h,tick:p,axisLine:{stroke:n.border},tickLine:!1,tickFormatter:i}),e.jsx(t.YAxis,{tick:p,axisLine:!1,tickLine:!1,tickFormatter:o,domain:c}),j&&e.jsx(t.Tooltip,{contentStyle:k.contentStyle,labelStyle:k.labelStyle,itemStyle:k.itemStyle,cursor:{stroke:n.border,strokeWidth:1}}),u&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:n.textMuted,paddingTop:8}}),y.map((s,L)=>e.jsx(t.ReferenceLine,{y:s.y,x:s.x,label:s.label?{value:s.label,fill:n.textMuted,fontSize:11}:void 0,stroke:s.color??n.border,strokeDasharray:s.dashed?"4 4":void 0},L)),S.map((s,L)=>{const w=s.color??g[L%g.length];return e.jsx(t.Line,{type:a?"monotone":"linear",dataKey:s.key,name:s.label??s.key,stroke:w,strokeWidth:s.strokeWidth??2,strokeDasharray:s.dashed?"6 3":void 0,dot:s.dot??!1,activeDot:{r:5,strokeWidth:0,fill:w},connectNulls:l},s.key)})]})})})}function R({data:r,height:S=300,showLegend:h=!0,showTooltip:m=!0,showLabels:d=!1,outerRadius:x="70%",startAngle:u=90,ariaLabel:j="Pie chart"}){const a=b.useTheme(),y=C(a),i=T(a);return e.jsx("div",{role:"img","aria-label":j,style:{width:"100%",height:S},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.PieChart,{children:[m&&e.jsx(t.Tooltip,{contentStyle:i.contentStyle,labelStyle:i.labelStyle,itemStyle:i.itemStyle}),h&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:a.textMuted}}),e.jsx(t.Pie,{data:r,dataKey:"value",nameKey:"name",outerRadius:x,startAngle:u,endAngle:u-360,label:d?({name:o,percent:c})=>`${o} (${(c*100).toFixed(0)}%)`:void 0,labelLine:d,strokeWidth:2,stroke:a.bg,children:r.map((o,c)=>e.jsx(t.Cell,{fill:o.color??y[c%y.length]},o.name))})]})})})}function D({data:r,height:S=300,showLegend:h=!0,showTooltip:m=!0,centerLabel:d,centerSublabel:x,innerRadius:u="55%",outerRadius:j="75%",startAngle:a=90,ariaLabel:y="Donut chart"}){const i=b.useTheme(),o=C(i),c=T(i);return e.jsxs("div",{role:"img","aria-label":y,style:{width:"100%",height:S},children:[e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.PieChart,{children:[m&&e.jsx(t.Tooltip,{contentStyle:c.contentStyle,labelStyle:c.labelStyle,itemStyle:c.itemStyle}),h&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:i.textMuted}}),e.jsx(t.Pie,{data:r,dataKey:"value",nameKey:"name",innerRadius:u,outerRadius:j,startAngle:a,endAngle:a-360,strokeWidth:3,stroke:i.bg,label:!1,labelLine:!1,children:r.map((l,f)=>e.jsx(t.Cell,{fill:l.color??o[f%o.length]},l.name))}),(d||x)&&e.jsx("text",{})]})}),(d||x)&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",pointerEvents:"none",marginTop:h?-24:0},children:[d&&e.jsx("span",{style:{fontSize:22,fontWeight:700,color:i.text,lineHeight:1},children:d}),x&&e.jsx("span",{style:{fontSize:13,color:i.textMuted,marginTop:4},children:x})]})]})}function K({series:r,height:S=300,margin:h=v,showGrid:m=!0,showLegend:d=!0,showTooltip:x=!0,xTickFormatter:u,yTickFormatter:j,zRange:a=[20,400],ariaLabel:y="Scatter chart"}){const i=b.useTheme(),o=C(i),c=T(i),l={fill:i.textMuted,fontSize:12};return e.jsx("div",{role:"img","aria-label":y,style:{width:"100%",height:S},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.ScatterChart,{margin:h,children:[m&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:i.border}),e.jsx(t.XAxis,{type:"number",dataKey:"x",tick:l,axisLine:{stroke:i.border},tickLine:!1,tickFormatter:u}),e.jsx(t.YAxis,{type:"number",dataKey:"y",tick:l,axisLine:!1,tickLine:!1,tickFormatter:j}),e.jsx(t.ZAxis,{type:"number",dataKey:"z",range:a}),x&&e.jsx(t.Tooltip,{contentStyle:c.contentStyle,labelStyle:c.labelStyle,itemStyle:c.itemStyle,cursor:{strokeDasharray:"3 3"}}),d&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:i.textMuted,paddingTop:8}}),r.map((f,n)=>e.jsx(t.Scatter,{name:f.name,data:f.data,fill:f.color??o[n%o.length],fillOpacity:.8},f.name??n))]})})})}function F({data:r,series:S,angleKey:h,height:m=300,showLegend:d=!0,showTooltip:x=!0,outerRadius:u="70%",ariaLabel:j="Radar chart"}){const a=b.useTheme(),y=C(a),i=T(a);return e.jsx("div",{role:"img","aria-label":j,style:{width:"100%",height:m},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.RadarChart,{data:r,outerRadius:u,children:[e.jsx(t.PolarGrid,{stroke:a.border}),e.jsx(t.PolarAngleAxis,{dataKey:h,tick:{fill:a.textMuted,fontSize:12}}),e.jsx(t.PolarRadiusAxis,{tick:{fill:a.textMuted,fontSize:10},axisLine:!1,tickLine:!1}),x&&e.jsx(t.Tooltip,{contentStyle:i.contentStyle,labelStyle:i.labelStyle,itemStyle:i.itemStyle}),d&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:a.textMuted}}),S.map((o,c)=>{const l=o.color??y[c%y.length];return e.jsx(t.Radar,{name:o.label??o.key,dataKey:o.key,stroke:l,fill:l,fillOpacity:o.fillOpacity??.2,strokeWidth:2},o.key)})]})})})}exports.TkxAreaChart=A;exports.TkxBarChart=z;exports.TkxDonutChart=D;exports.TkxLineChart=M;exports.TkxPieChart=R;exports.TkxRadarChart=F;exports.TkxScatterChart=K;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("recharts"),g=require("./index-BINBzXuY.cjs"),L=require("react");function C(i){return[i.primary,i.secondary,i.info,i.success,i.warning,i.danger,"#a855f7","#f97316","#14b8a6","#e879f9"]}const A={top:10,right:30,bottom:10,left:0};function T(i){return{contentStyle:{backgroundColor:i.surface,border:`1px solid ${i.border}`,borderRadius:8,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",color:i.text,fontSize:13},labelStyle:{color:i.textMuted,fontWeight:600,marginBottom:4},itemStyle:{color:i.text},cursor:{fill:`${i.primary}15`}}}function z({data:i,series:m,xKey:y,height:S=300,margin:d=A,showGrid:h=!0,showLegend:f=!0,showTooltip:p=!0,smooth:l=!0,xTickFormatter:u,yTickFormatter:o,yDomain:n,ariaLabel:x="Area chart"}){const r=g.useTheme(),c=C(r),a=T(r),j={fill:r.textMuted,fontSize:12};return e.jsx("div",{role:"img","aria-label":x,style:{width:"100%",height:S},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.AreaChart,{data:i,margin:d,children:[h&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:r.border,vertical:!1}),e.jsx(t.XAxis,{dataKey:y,tick:j,axisLine:{stroke:r.border},tickLine:!1,tickFormatter:u}),e.jsx(t.YAxis,{tick:j,axisLine:!1,tickLine:!1,tickFormatter:o,domain:n}),p&&e.jsx(t.Tooltip,{contentStyle:a.contentStyle,labelStyle:a.labelStyle,itemStyle:a.itemStyle,cursor:a.cursor}),f&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:r.textMuted,paddingTop:8}}),m.map((k,b)=>{const s=k.color??c[b%c.length];return e.jsx(t.Area,{type:l?"monotone":"linear",dataKey:k.key,name:k.label??k.key,stroke:s,strokeWidth:2,fill:s,fillOpacity:k.fillOpacity??.2,stackId:k.stacked?"stack":void 0,dot:!1,activeDot:{r:5,strokeWidth:0}},k.key)})]})})})}function M({data:i,series:m,xKey:y,height:S=300,margin:d=A,showGrid:h=!0,showLegend:f=!0,showTooltip:p=!0,layout:l="horizontal",barSize:u,xTickFormatter:o,yTickFormatter:n,ariaLabel:x="Bar chart"}){const r=g.useTheme(),c=C(r),a=T(r),j={fill:r.textMuted,fontSize:12},k=l==="vertical";return e.jsx("div",{role:"img","aria-label":x,style:{width:"100%",height:S},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.BarChart,{data:i,margin:d,layout:l,children:[h&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:r.border,vertical:k,horizontal:!k}),k?e.jsxs(e.Fragment,{children:[e.jsx(t.YAxis,{dataKey:y,type:"category",tick:j,axisLine:!1,tickLine:!1,tickFormatter:o,width:100}),e.jsx(t.XAxis,{type:"number",tick:j,axisLine:{stroke:r.border},tickLine:!1,tickFormatter:n})]}):e.jsxs(e.Fragment,{children:[e.jsx(t.XAxis,{dataKey:y,tick:j,axisLine:{stroke:r.border},tickLine:!1,tickFormatter:o}),e.jsx(t.YAxis,{tick:j,axisLine:!1,tickLine:!1,tickFormatter:n})]}),p&&e.jsx(t.Tooltip,{contentStyle:a.contentStyle,labelStyle:a.labelStyle,itemStyle:a.itemStyle,cursor:{fill:`${r.surfaceAlt}`}}),f&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:r.textMuted,paddingTop:8}}),m.map((b,s)=>{const v=b.color??c[s%c.length];return e.jsx(t.Bar,{dataKey:b.key,name:b.label??b.key,fill:v,stackId:b.stackId,maxBarSize:u??40,radius:b.radius??[4,4,0,0]},b.key)})]})})})}function R({data:i,series:m,xKey:y,height:S=300,margin:d=A,showGrid:h=!0,showLegend:f=!0,showTooltip:p=!0,smooth:l=!0,referenceLines:u=[],xTickFormatter:o,yTickFormatter:n,yDomain:x,connectNulls:r=!1,ariaLabel:c="Line chart"}){const a=g.useTheme(),j=C(a),k=T(a),b={fill:a.textMuted,fontSize:12};return e.jsx("div",{role:"img","aria-label":c,style:{width:"100%",height:S},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.LineChart,{data:i,margin:d,children:[h&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:a.border,vertical:!1}),e.jsx(t.XAxis,{dataKey:y,tick:b,axisLine:{stroke:a.border},tickLine:!1,tickFormatter:o}),e.jsx(t.YAxis,{tick:b,axisLine:!1,tickLine:!1,tickFormatter:n,domain:x}),p&&e.jsx(t.Tooltip,{contentStyle:k.contentStyle,labelStyle:k.labelStyle,itemStyle:k.itemStyle,cursor:{stroke:a.border,strokeWidth:1}}),f&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:a.textMuted,paddingTop:8}}),u.map((s,v)=>e.jsx(t.ReferenceLine,{y:s.y,x:s.x,label:s.label?{value:s.label,fill:a.textMuted,fontSize:11}:void 0,stroke:s.color??a.border,strokeDasharray:s.dashed?"4 4":void 0},v)),m.map((s,v)=>{const w=s.color??j[v%j.length];return e.jsx(t.Line,{type:l?"monotone":"linear",dataKey:s.key,name:s.label??s.key,stroke:w,strokeWidth:s.strokeWidth??2,strokeDasharray:s.dashed?"6 3":void 0,dot:s.dot??!1,activeDot:{r:5,strokeWidth:0,fill:w},connectNulls:r},s.key)})]})})})}function F({data:i,height:m=300,showLegend:y=!0,showTooltip:S=!0,showLabels:d=!1,outerRadius:h="70%",startAngle:f=90,ariaLabel:p="Pie chart"}){const l=g.useTheme(),u=C(l),o=T(l),[n,x]=L.useState(!1);return L.useEffect(()=>{const r=requestAnimationFrame(()=>x(!0));return()=>cancelAnimationFrame(r)},[]),e.jsx("div",{role:"img","aria-label":p,style:{width:"100%",minWidth:240,height:m,position:"relative"},children:n&&e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",debounce:50,children:e.jsxs(t.PieChart,{children:[S&&e.jsx(t.Tooltip,{contentStyle:o.contentStyle,labelStyle:o.labelStyle,itemStyle:o.itemStyle}),y&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:l.textMuted}}),e.jsx(t.Pie,{data:i,dataKey:"value",nameKey:"name",outerRadius:h,startAngle:f,endAngle:f-360,label:d?({name:r,percent:c})=>`${r} (${(c*100).toFixed(0)}%)`:void 0,labelLine:d,strokeWidth:2,stroke:l.bg,children:i.map((r,c)=>e.jsx(t.Cell,{fill:r.color??u[c%u.length]},r.name))})]})})})}function D({data:i,height:m=300,showLegend:y=!0,showTooltip:S=!0,centerLabel:d,centerSublabel:h,innerRadius:f="55%",outerRadius:p="75%",startAngle:l=90,ariaLabel:u="Donut chart"}){const o=g.useTheme(),n=C(o),x=T(o),[r,c]=L.useState(!1);return L.useEffect(()=>{const a=requestAnimationFrame(()=>c(!0));return()=>cancelAnimationFrame(a)},[]),e.jsxs("div",{role:"img","aria-label":u,style:{width:"100%",minWidth:240,height:m,position:"relative"},children:[r&&e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",debounce:50,children:e.jsxs(t.PieChart,{children:[S&&e.jsx(t.Tooltip,{contentStyle:x.contentStyle,labelStyle:x.labelStyle,itemStyle:x.itemStyle}),y&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:o.textMuted}}),e.jsx(t.Pie,{data:i,dataKey:"value",nameKey:"name",innerRadius:f,outerRadius:p,startAngle:l,endAngle:l-360,strokeWidth:3,stroke:o.bg,label:!1,labelLine:!1,children:i.map((a,j)=>e.jsx(t.Cell,{fill:a.color??n[j%n.length]},a.name))}),(d||h)&&e.jsx("text",{})]})}),(d||h)&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",pointerEvents:"none",marginTop:y?-24:0},children:[d&&e.jsx("span",{style:{fontSize:22,fontWeight:700,color:o.text,lineHeight:1},children:d}),h&&e.jsx("span",{style:{fontSize:13,color:o.textMuted,marginTop:4},children:h})]})]})}function K({series:i,height:m=300,margin:y=A,showGrid:S=!0,showLegend:d=!0,showTooltip:h=!0,xTickFormatter:f,yTickFormatter:p,zRange:l=[20,400],ariaLabel:u="Scatter chart"}){const o=g.useTheme(),n=C(o),x=T(o),r={fill:o.textMuted,fontSize:12};return e.jsx("div",{role:"img","aria-label":u,style:{width:"100%",height:m},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.ScatterChart,{margin:y,children:[S&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:o.border}),e.jsx(t.XAxis,{type:"number",dataKey:"x",tick:r,axisLine:{stroke:o.border},tickLine:!1,tickFormatter:f}),e.jsx(t.YAxis,{type:"number",dataKey:"y",tick:r,axisLine:!1,tickLine:!1,tickFormatter:p}),e.jsx(t.ZAxis,{type:"number",dataKey:"z",range:l}),h&&e.jsx(t.Tooltip,{contentStyle:x.contentStyle,labelStyle:x.labelStyle,itemStyle:x.itemStyle,cursor:{strokeDasharray:"3 3"}}),d&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:o.textMuted,paddingTop:8}}),i.map((c,a)=>e.jsx(t.Scatter,{name:c.name,data:c.data,fill:c.color??n[a%n.length],fillOpacity:.8},c.name??a))]})})})}function W({data:i,series:m,angleKey:y,height:S=300,showLegend:d=!0,showTooltip:h=!0,outerRadius:f="70%",ariaLabel:p="Radar chart"}){const l=g.useTheme(),u=C(l),o=T(l);return e.jsx("div",{role:"img","aria-label":p,style:{width:"100%",height:S},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.RadarChart,{data:i,outerRadius:f,children:[e.jsx(t.PolarGrid,{stroke:l.border}),e.jsx(t.PolarAngleAxis,{dataKey:y,tick:{fill:l.textMuted,fontSize:12}}),e.jsx(t.PolarRadiusAxis,{tick:{fill:l.textMuted,fontSize:10},axisLine:!1,tickLine:!1}),h&&e.jsx(t.Tooltip,{contentStyle:o.contentStyle,labelStyle:o.labelStyle,itemStyle:o.itemStyle}),d&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:l.textMuted}}),m.map((n,x)=>{const r=n.color??u[x%u.length];return e.jsx(t.Radar,{name:n.label??n.key,dataKey:n.key,stroke:r,fill:r,fillOpacity:n.fillOpacity??.2,strokeWidth:2},n.key)})]})})})}exports.TkxAreaChart=z;exports.TkxBarChart=M;exports.TkxDonutChart=D;exports.TkxLineChart=R;exports.TkxPieChart=F;exports.TkxRadarChart=W;exports.TkxScatterChart=K;