tekivex-ui 2.5.11 → 2.5.13
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/TkxForm-1KDzoniV.cjs +12 -0
- package/dist/TkxForm-9-W3Nl6m.js +314 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +543 -507
- package/dist/chunk-Bmb41Sf3.cjs +1 -0
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +428 -447
- package/dist/hooks-6pRsPOyG.js +58 -0
- package/dist/hooks-mivgRljH.cjs +1 -0
- package/dist/i18n.cjs +1 -1
- package/dist/i18n.js +728 -752
- package/dist/index.cjs +26 -26
- package/dist/index.js +16102 -16619
- package/dist/quantum.cjs +14 -16
- package/dist/quantum.js +2473 -2279
- package/dist/realtime.cjs +4 -10
- package/dist/realtime.js +804 -958
- package/dist/src/components/TkxClock.d.ts.map +1 -1
- package/dist/src/components/TkxForm.d.ts.map +1 -1
- package/dist/src/components/TkxLiveFeed.d.ts +1 -1
- package/dist/src/components/TkxLiveLog.d.ts +1 -1
- package/dist/src/components/TkxRealTimeChart.d.ts +1 -1
- package/dist/src/components/TkxTooltip.d.ts.map +1 -1
- package/dist/src/components/TkxTypography.d.ts +5 -5
- package/dist/src/components/TkxTypography.d.ts.map +1 -1
- package/dist/tekivex-ui.css +2 -0
- package/dist/themes-BbJanqiC.js +498 -0
- package/dist/themes-CMq2vWXj.cjs +2 -0
- package/dist/tkx-0oAwZqgL.cjs +4 -0
- package/dist/tkx-DQkvHdE5.js +1172 -0
- package/package.json +18 -19
- package/src/charts/TkxPieChart.tsx +1 -1
- package/src/components/TkxClock.tsx +2 -2
- package/src/components/TkxForm.tsx +4 -2
- package/src/components/TkxTooltip.tsx +7 -5
- package/src/components/TkxTypography.tsx +2 -2
- package/dist/TkxForm-2tGLCPH6.js +0 -326
- package/dist/TkxForm-C2VqR2wC.cjs +0 -12
- package/dist/index-BgHMZe4Z.js +0 -66
- package/dist/index-Bt5y50Qa.cjs +0 -1
- package/dist/index-DnqXtpwV.cjs +0 -2
- package/dist/index-iUUHRxqJ.js +0 -515
- package/dist/security-C-ZPGoyG.js +0 -97
- package/dist/security-Uf0mjv8o.cjs +0 -1
- package/dist/style.css +0 -1
- package/dist/tkx-BtHzWKTl.js +0 -1112
- package/dist/tkx-C7GvVUE9.cjs +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tekivex-ui",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.13",
|
|
4
4
|
"description": "Production-grade React component library — 70+ components, WCAG 2.1 AAA, WAI-ARIA 1.2, built-in charts, headless primitives, zero-runtime CSS engine, TypeScript-first.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -70,34 +70,33 @@
|
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"react": ">=18.0.0",
|
|
72
72
|
"react-dom": ">=18.0.0",
|
|
73
|
-
"recharts": ">=2.0.0"
|
|
73
|
+
"recharts": ">=2.0.0 || >=3.0.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependenciesMeta": {
|
|
76
76
|
"recharts": {
|
|
77
77
|
"optional": true
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
"dependencies": {},
|
|
81
80
|
"devDependencies": {
|
|
82
81
|
"@testing-library/jest-dom": "^6.6.3",
|
|
83
82
|
"@testing-library/react": "^16.1.0",
|
|
84
83
|
"@testing-library/user-event": "^14.5.2",
|
|
85
|
-
"@types/react": "^
|
|
86
|
-
"@types/react-dom": "^
|
|
87
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
88
|
-
"@typescript-eslint/parser": "^8.
|
|
89
|
-
"@vitejs/plugin-react": "^
|
|
90
|
-
"@vitest/coverage-v8": "^
|
|
91
|
-
"eslint": "^9.
|
|
92
|
-
"eslint-plugin-react-hooks": "^
|
|
93
|
-
"jsdom": "^
|
|
94
|
-
"prettier": "^3.
|
|
95
|
-
"react": "^
|
|
96
|
-
"react-dom": "^
|
|
97
|
-
"recharts": "^
|
|
98
|
-
"typescript": "^5.
|
|
99
|
-
"vite": "^
|
|
100
|
-
"vitest": "^
|
|
84
|
+
"@types/react": "^19.2.14",
|
|
85
|
+
"@types/react-dom": "^19.2.3",
|
|
86
|
+
"@typescript-eslint/eslint-plugin": "^8.58.2",
|
|
87
|
+
"@typescript-eslint/parser": "^8.58.2",
|
|
88
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
89
|
+
"@vitest/coverage-v8": "^4.1.4",
|
|
90
|
+
"eslint": "^9.39.4",
|
|
91
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
92
|
+
"jsdom": "^29.0.2",
|
|
93
|
+
"prettier": "^3.8.3",
|
|
94
|
+
"react": "^19.2.5",
|
|
95
|
+
"react-dom": "^19.2.5",
|
|
96
|
+
"recharts": "^3.8.1",
|
|
97
|
+
"typescript": "^5.9.3",
|
|
98
|
+
"vite": "^8.0.9",
|
|
99
|
+
"vitest": "^4.1.4"
|
|
101
100
|
},
|
|
102
101
|
"keywords": [
|
|
103
102
|
"react",
|
|
@@ -81,7 +81,7 @@ export function TkxPieChart({
|
|
|
81
81
|
outerRadius={outerRadius}
|
|
82
82
|
startAngle={startAngle}
|
|
83
83
|
endAngle={startAngle - 360}
|
|
84
|
-
label={showLabels ? ({ name, percent }) => `${name} (${(percent * 100).toFixed(0)}%)` : undefined}
|
|
84
|
+
label={showLabels ? ({ name, percent }) => `${name} (${((percent ?? 0) * 100).toFixed(0)}%)` : undefined}
|
|
85
85
|
labelLine={showLabels}
|
|
86
86
|
strokeWidth={2}
|
|
87
87
|
stroke={theme.bg}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, {
|
|
2
2
|
useState,
|
|
3
3
|
useEffect,
|
|
4
4
|
useRef,
|
|
@@ -210,7 +210,7 @@ function AnalogFace({
|
|
|
210
210
|
const secondEnd = handPoint(secondAngle, r * 0.85);
|
|
211
211
|
const secondTailEnd = handPoint(secondAngle + 180, r * 0.2);
|
|
212
212
|
|
|
213
|
-
const tickMarks: JSX.Element[] = [];
|
|
213
|
+
const tickMarks: React.JSX.Element[] = [];
|
|
214
214
|
|
|
215
215
|
if (analogStyle === 'classic') {
|
|
216
216
|
// 12 hour ticks + minor ticks
|
|
@@ -523,14 +523,16 @@ export function TkxFormField({
|
|
|
523
523
|
}, [ctx, name]);
|
|
524
524
|
|
|
525
525
|
// ─── Clone child input with injected props ────────────────────────────
|
|
526
|
-
|
|
526
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
527
|
+
const typedChild = children as ReactElement<any>;
|
|
528
|
+
const childElement = cloneElement(typedChild, {
|
|
527
529
|
value: value ?? '',
|
|
528
530
|
onChange: handleChange,
|
|
529
531
|
onBlur: handleBlur,
|
|
530
532
|
error: safeError ?? undefined,
|
|
531
533
|
isInvalid: !!safeError,
|
|
532
534
|
isRequired,
|
|
533
|
-
disabled: disabled ||
|
|
535
|
+
disabled: disabled || typedChild.props.disabled,
|
|
534
536
|
name,
|
|
535
537
|
});
|
|
536
538
|
|
|
@@ -37,12 +37,14 @@ export function TkxTooltip({ content, children, placement = 'top', delay = 300 }
|
|
|
37
37
|
useEscapeKey(hide, visible);
|
|
38
38
|
useClickOutside(wrapperRef, hide);
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
const child = children as ReactElement<any>;
|
|
42
|
+
const trigger = cloneElement(child, {
|
|
41
43
|
'aria-describedby': visible ? tooltipId : undefined,
|
|
42
|
-
onMouseEnter: (e: React.MouseEvent) => {
|
|
43
|
-
onMouseLeave: (e: React.MouseEvent) => {
|
|
44
|
-
onFocus: (e: React.FocusEvent) => {
|
|
45
|
-
onBlur: (e: React.FocusEvent) => {
|
|
44
|
+
onMouseEnter: (e: React.MouseEvent) => { child.props.onMouseEnter?.(e); show(); },
|
|
45
|
+
onMouseLeave: (e: React.MouseEvent) => { child.props.onMouseLeave?.(e); hide(); },
|
|
46
|
+
onFocus: (e: React.FocusEvent) => { child.props.onFocus?.(e); show(); },
|
|
47
|
+
onBlur: (e: React.FocusEvent) => { child.props.onBlur?.(e); hide(); },
|
|
46
48
|
});
|
|
47
49
|
|
|
48
50
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, {
|
|
2
2
|
useState,
|
|
3
3
|
useCallback,
|
|
4
4
|
type ReactNode,
|
|
@@ -126,7 +126,7 @@ export function TkxTitle({
|
|
|
126
126
|
const color = useTypeColor(type);
|
|
127
127
|
const theme = useTheme();
|
|
128
128
|
const sizeConfig = TITLE_SIZES[level];
|
|
129
|
-
const tag = `h${level}` as keyof JSX.IntrinsicElements;
|
|
129
|
+
const tag = `h${level}` as keyof React.JSX.IntrinsicElements;
|
|
130
130
|
|
|
131
131
|
const safeChildren = typeof children === 'string' ? sanitizeString(children) : children;
|
|
132
132
|
const textContent = getTextContent(children);
|
package/dist/TkxForm-2tGLCPH6.js
DELETED
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
import { jsx as j, jsxs as R, Fragment as V } from "react/jsx-runtime";
|
|
2
|
-
import { useState as X, useRef as v, useCallback as m, useMemo as $, cloneElement as Z, useContext as J, createContext as O } from "react";
|
|
3
|
-
import { u as K } from "./index-iUUHRxqJ.js";
|
|
4
|
-
import { s as L } from "./security-C-ZPGoyG.js";
|
|
5
|
-
import { t as F, c as Y } from "./tkx-BtHzWKTl.js";
|
|
6
|
-
const W = O(null);
|
|
7
|
-
function ee() {
|
|
8
|
-
const e = J(W);
|
|
9
|
-
if (!e)
|
|
10
|
-
throw new Error("TkxFormField must be used inside a <TkxForm>. Wrap your fields in a TkxForm component.");
|
|
11
|
-
return e;
|
|
12
|
-
}
|
|
13
|
-
async function _(e, s) {
|
|
14
|
-
for (const t of s) {
|
|
15
|
-
if (t.required && (e == null || e === "" || Array.isArray(e) && e.length === 0))
|
|
16
|
-
return t.message ?? "This field is required";
|
|
17
|
-
if (!(e == null || e === "")) {
|
|
18
|
-
if (t.min !== void 0) {
|
|
19
|
-
if (typeof e == "string" && e.length < t.min)
|
|
20
|
-
return t.message ?? `Must be at least ${t.min} characters`;
|
|
21
|
-
if (typeof e == "number" && e < t.min)
|
|
22
|
-
return t.message ?? `Must be at least ${t.min}`;
|
|
23
|
-
}
|
|
24
|
-
if (t.max !== void 0) {
|
|
25
|
-
if (typeof e == "string" && e.length > t.max)
|
|
26
|
-
return t.message ?? `Must be no more than ${t.max} characters`;
|
|
27
|
-
if (typeof e == "number" && e > t.max)
|
|
28
|
-
return t.message ?? `Must be no more than ${t.max}`;
|
|
29
|
-
}
|
|
30
|
-
if (t.pattern && typeof e == "string" && !t.pattern.test(e))
|
|
31
|
-
return t.message ?? "Invalid format";
|
|
32
|
-
if (t.validator) {
|
|
33
|
-
const i = await t.validator(e);
|
|
34
|
-
if (i)
|
|
35
|
-
return i;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
function te(e, s) {
|
|
42
|
-
const t = e ? [...e] : [];
|
|
43
|
-
return s && !t.some((i) => i.required) && t.unshift({ required: !0, message: "This field is required" }), t;
|
|
44
|
-
}
|
|
45
|
-
function re(e) {
|
|
46
|
-
return e.some((s) => s.required);
|
|
47
|
-
}
|
|
48
|
-
function de() {
|
|
49
|
-
const e = J(W), s = v({}), t = v({}), i = v({}), b = $(() => ({
|
|
50
|
-
getFieldValue: (c) => s.current[c],
|
|
51
|
-
setFieldValue: (c, k) => {
|
|
52
|
-
s.current[c] = k;
|
|
53
|
-
},
|
|
54
|
-
getFieldsValue: () => ({ ...s.current }),
|
|
55
|
-
setFieldsValue: (c) => {
|
|
56
|
-
Object.assign(s.current, c);
|
|
57
|
-
},
|
|
58
|
-
validateFields: () => Promise.resolve({ ...s.current }),
|
|
59
|
-
validateField: (c) => Promise.resolve(!0),
|
|
60
|
-
resetFields: () => {
|
|
61
|
-
s.current = {}, t.current = {}, i.current = {};
|
|
62
|
-
},
|
|
63
|
-
getFieldError: (c) => t.current[c] ?? null,
|
|
64
|
-
isFieldTouched: (c) => i.current[c] ?? !1
|
|
65
|
-
}), []);
|
|
66
|
-
return e ? e.instance : b;
|
|
67
|
-
}
|
|
68
|
-
function se({
|
|
69
|
-
onSubmit: e,
|
|
70
|
-
onValuesChange: s,
|
|
71
|
-
initialValues: t = {},
|
|
72
|
-
layout: i = "vertical",
|
|
73
|
-
disabled: b = !1,
|
|
74
|
-
children: c,
|
|
75
|
-
className: k,
|
|
76
|
-
style: q,
|
|
77
|
-
form: E
|
|
78
|
-
}) {
|
|
79
|
-
const u = K(), [g, x] = X({
|
|
80
|
-
values: { ...t },
|
|
81
|
-
errors: {},
|
|
82
|
-
touched: {}
|
|
83
|
-
}), A = v(t), d = v({}), f = v(g);
|
|
84
|
-
f.current = g;
|
|
85
|
-
const M = m((r, n) => {
|
|
86
|
-
d.current[r] = n;
|
|
87
|
-
}, []), I = m((r) => {
|
|
88
|
-
delete d.current[r];
|
|
89
|
-
}, []), N = m((r, n) => {
|
|
90
|
-
x((o) => {
|
|
91
|
-
const l = {
|
|
92
|
-
...o,
|
|
93
|
-
values: { ...o.values, [r]: n }
|
|
94
|
-
};
|
|
95
|
-
return s == null || s({ [r]: n }, l.values), l;
|
|
96
|
-
});
|
|
97
|
-
}, [s]), z = m((r, n) => {
|
|
98
|
-
x((o) => ({
|
|
99
|
-
...o,
|
|
100
|
-
errors: { ...o.errors, [r]: n }
|
|
101
|
-
}));
|
|
102
|
-
}, []), y = m((r) => {
|
|
103
|
-
x((n) => ({
|
|
104
|
-
...n,
|
|
105
|
-
touched: { ...n.touched, [r]: !0 }
|
|
106
|
-
}));
|
|
107
|
-
}, []), w = m(async (r) => {
|
|
108
|
-
const n = d.current[r];
|
|
109
|
-
if (!n) return !0;
|
|
110
|
-
const o = f.current.values[r], l = await _(o, n.rules);
|
|
111
|
-
return x((h) => ({
|
|
112
|
-
...h,
|
|
113
|
-
errors: { ...h.errors, [r]: l },
|
|
114
|
-
touched: { ...h.touched, [r]: !0 }
|
|
115
|
-
})), l === null;
|
|
116
|
-
}, []), T = m(async () => {
|
|
117
|
-
const r = Object.keys(d.current), n = await Promise.all(
|
|
118
|
-
r.map(async (a) => {
|
|
119
|
-
const p = d.current[a], Q = f.current.values[a], U = await _(Q, p.rules);
|
|
120
|
-
return { name: a, error: U };
|
|
121
|
-
})
|
|
122
|
-
), o = {}, l = {};
|
|
123
|
-
let h = !1;
|
|
124
|
-
for (const { name: a, error: p } of n)
|
|
125
|
-
o[a] = p, l[a] = !0, p && (h = !0);
|
|
126
|
-
if (x((a) => ({
|
|
127
|
-
...a,
|
|
128
|
-
errors: { ...a.errors, ...o },
|
|
129
|
-
touched: { ...a.touched, ...l }
|
|
130
|
-
})), h) {
|
|
131
|
-
const a = Object.fromEntries(
|
|
132
|
-
n.filter((p) => p.error).map((p) => [p.name, p.error])
|
|
133
|
-
);
|
|
134
|
-
return Promise.reject(a);
|
|
135
|
-
}
|
|
136
|
-
return { ...f.current.values };
|
|
137
|
-
}, []), B = m(() => {
|
|
138
|
-
x({
|
|
139
|
-
values: { ...A.current },
|
|
140
|
-
errors: {},
|
|
141
|
-
touched: {}
|
|
142
|
-
});
|
|
143
|
-
}, []), C = $(() => ({
|
|
144
|
-
getFieldValue: (r) => f.current.values[r],
|
|
145
|
-
setFieldValue: N,
|
|
146
|
-
getFieldsValue: () => ({ ...f.current.values }),
|
|
147
|
-
setFieldsValue: (r) => {
|
|
148
|
-
x((n) => {
|
|
149
|
-
const o = { ...n.values, ...r };
|
|
150
|
-
return s == null || s(r, o), { ...n, values: o };
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
validateFields: T,
|
|
154
|
-
validateField: w,
|
|
155
|
-
resetFields: B,
|
|
156
|
-
getFieldError: (r) => f.current.errors[r] ?? null,
|
|
157
|
-
isFieldTouched: (r) => !!f.current.touched[r]
|
|
158
|
-
}), [N, T, w, B, s]), P = m(async (r) => {
|
|
159
|
-
r.preventDefault();
|
|
160
|
-
try {
|
|
161
|
-
const n = await T();
|
|
162
|
-
await (e == null ? void 0 : e(n));
|
|
163
|
-
} catch {
|
|
164
|
-
}
|
|
165
|
-
}, [T, e]), H = i === "inline" ? F("flex flex-row flex-wrap items-end gap-4") : F("flex flex-col gap-5"), S = E ?? C, D = $(() => ({
|
|
166
|
-
state: g,
|
|
167
|
-
initialValues: A.current,
|
|
168
|
-
layout: i,
|
|
169
|
-
disabled: b,
|
|
170
|
-
fieldMeta: d,
|
|
171
|
-
setFieldValue: N,
|
|
172
|
-
setFieldError: z,
|
|
173
|
-
setFieldTouched: y,
|
|
174
|
-
registerField: M,
|
|
175
|
-
unregisterField: I,
|
|
176
|
-
validateField: w,
|
|
177
|
-
instance: S
|
|
178
|
-
}), [g, i, b, N, z, y, M, I, w, S]);
|
|
179
|
-
return /* @__PURE__ */ j(W.Provider, { value: D, children: /* @__PURE__ */ j(
|
|
180
|
-
"form",
|
|
181
|
-
{
|
|
182
|
-
noValidate: !0,
|
|
183
|
-
role: "form",
|
|
184
|
-
"aria-label": "Form",
|
|
185
|
-
onSubmit: P,
|
|
186
|
-
className: Y(H, k),
|
|
187
|
-
style: {
|
|
188
|
-
color: u.text,
|
|
189
|
-
...q
|
|
190
|
-
},
|
|
191
|
-
children: c
|
|
192
|
-
}
|
|
193
|
-
) });
|
|
194
|
-
}
|
|
195
|
-
se.displayName = "TkxForm";
|
|
196
|
-
function ne({
|
|
197
|
-
name: e,
|
|
198
|
-
label: s,
|
|
199
|
-
rules: t,
|
|
200
|
-
help: i,
|
|
201
|
-
required: b,
|
|
202
|
-
children: c,
|
|
203
|
-
className: k,
|
|
204
|
-
style: q
|
|
205
|
-
}) {
|
|
206
|
-
const E = K(), u = ee(), { state: g, layout: x, disabled: A } = u, d = $(() => te(t, b), [t, b]), f = re(d), M = v({ rules: d });
|
|
207
|
-
M.current.rules = d;
|
|
208
|
-
const I = v(!1);
|
|
209
|
-
I.current || (u.registerField(e, M.current), I.current = !0), $(() => {
|
|
210
|
-
u.registerField(e, M.current);
|
|
211
|
-
}, [d, e, u]);
|
|
212
|
-
const N = g.values[e], z = g.touched[e] ? g.errors[e] ?? null : null, y = z ? L(z) : null, w = s ? L(s) : void 0, T = i ? L(i) : void 0, B = m(
|
|
213
|
-
(o) => {
|
|
214
|
-
let l;
|
|
215
|
-
if (o !== null && typeof o == "object" && "target" in o) {
|
|
216
|
-
const h = o.target;
|
|
217
|
-
l = h.type === "checkbox" ? h.checked : h.value;
|
|
218
|
-
} else
|
|
219
|
-
l = o;
|
|
220
|
-
u.setFieldValue(e, l);
|
|
221
|
-
},
|
|
222
|
-
[u, e]
|
|
223
|
-
), C = m(() => {
|
|
224
|
-
u.setFieldTouched(e), u.validateField(e);
|
|
225
|
-
}, [u, e]), P = Z(c, {
|
|
226
|
-
value: N ?? "",
|
|
227
|
-
onChange: B,
|
|
228
|
-
onBlur: C,
|
|
229
|
-
error: y ?? void 0,
|
|
230
|
-
isInvalid: !!y,
|
|
231
|
-
isRequired: f,
|
|
232
|
-
disabled: A || c.props.disabled,
|
|
233
|
-
name: e
|
|
234
|
-
}), H = x === "horizontal", S = x === "inline", D = /* @__PURE__ */ j("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ j("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" }) }), r = w ? /* @__PURE__ */ R(
|
|
235
|
-
"label",
|
|
236
|
-
{
|
|
237
|
-
className: F(
|
|
238
|
-
"text-sm font-medium font-sans",
|
|
239
|
-
H ? "min-w-[140px] pt-2.5" : ""
|
|
240
|
-
),
|
|
241
|
-
style: { color: E.text },
|
|
242
|
-
children: [
|
|
243
|
-
w,
|
|
244
|
-
f && /* @__PURE__ */ j("span", { "aria-hidden": "true", className: F("ml-1"), style: { color: E.danger }, children: "*" })
|
|
245
|
-
]
|
|
246
|
-
}
|
|
247
|
-
) : null, n = /* @__PURE__ */ R(V, { children: [
|
|
248
|
-
T && !y && /* @__PURE__ */ j("span", { className: F("text-xs mt-0.5"), style: { color: E.textMuted }, children: T }),
|
|
249
|
-
y && /* @__PURE__ */ R(
|
|
250
|
-
"span",
|
|
251
|
-
{
|
|
252
|
-
role: "alert",
|
|
253
|
-
className: F("text-xs flex items-center gap-1 mt-0.5"),
|
|
254
|
-
style: {
|
|
255
|
-
color: E.danger,
|
|
256
|
-
animation: "tkxFormErrorReveal 200ms ease-out"
|
|
257
|
-
},
|
|
258
|
-
children: [
|
|
259
|
-
D,
|
|
260
|
-
y
|
|
261
|
-
]
|
|
262
|
-
}
|
|
263
|
-
)
|
|
264
|
-
] });
|
|
265
|
-
return S ? /* @__PURE__ */ R(
|
|
266
|
-
"div",
|
|
267
|
-
{
|
|
268
|
-
className: Y(F("flex flex-col gap-1"), k),
|
|
269
|
-
style: q,
|
|
270
|
-
children: [
|
|
271
|
-
r,
|
|
272
|
-
P,
|
|
273
|
-
n
|
|
274
|
-
]
|
|
275
|
-
}
|
|
276
|
-
) : H ? /* @__PURE__ */ R(
|
|
277
|
-
"div",
|
|
278
|
-
{
|
|
279
|
-
className: Y(F("flex flex-row gap-4 items-start"), k),
|
|
280
|
-
style: q,
|
|
281
|
-
children: [
|
|
282
|
-
r,
|
|
283
|
-
/* @__PURE__ */ R("div", { className: F("flex flex-col gap-1 flex-1 min-w-0"), children: [
|
|
284
|
-
P,
|
|
285
|
-
n
|
|
286
|
-
] })
|
|
287
|
-
]
|
|
288
|
-
}
|
|
289
|
-
) : /* @__PURE__ */ R(
|
|
290
|
-
"div",
|
|
291
|
-
{
|
|
292
|
-
className: Y(F("flex flex-col gap-1"), k),
|
|
293
|
-
style: q,
|
|
294
|
-
children: [
|
|
295
|
-
r,
|
|
296
|
-
P,
|
|
297
|
-
n
|
|
298
|
-
]
|
|
299
|
-
}
|
|
300
|
-
);
|
|
301
|
-
}
|
|
302
|
-
ne.displayName = "TkxFormField";
|
|
303
|
-
let G = !1;
|
|
304
|
-
function oe() {
|
|
305
|
-
if (G || typeof document > "u") return;
|
|
306
|
-
G = !0;
|
|
307
|
-
const e = document.createElement("style");
|
|
308
|
-
e.setAttribute("data-tkx-form", ""), e.textContent = `
|
|
309
|
-
@keyframes tkxFormErrorReveal {
|
|
310
|
-
from {
|
|
311
|
-
opacity: 0;
|
|
312
|
-
transform: translateY(-4px);
|
|
313
|
-
}
|
|
314
|
-
to {
|
|
315
|
-
opacity: 1;
|
|
316
|
-
transform: translateY(0);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
`, document.head.appendChild(e);
|
|
320
|
-
}
|
|
321
|
-
oe();
|
|
322
|
-
export {
|
|
323
|
-
se as T,
|
|
324
|
-
ne as a,
|
|
325
|
-
de as u
|
|
326
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";const a=require("react/jsx-runtime"),s=require("react"),L=require("./index-DnqXtpwV.cjs"),B=require("./security-Uf0mjv8o.cjs"),u=require("./tkx-C7GvVUE9.cjs"),H=s.createContext(null);function K(){const e=s.useContext(H);if(!e)throw new Error("TkxFormField must be used inside a <TkxForm>. Wrap your fields in a TkxForm component.");return e}async function Y(e,n){for(const t of n){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 i=await t.validator(e);if(i)return i}}}return null}function Q(e,n){const t=e?[...e]:[];return n&&!t.some(i=>i.required)&&t.unshift({required:!0,message:"This field is required"}),t}function U(e){return e.some(n=>n.required)}function V(){const e=s.useContext(H),n=s.useRef({}),t=s.useRef({}),i=s.useRef({}),b=s.useMemo(()=>({getFieldValue:l=>n.current[l],setFieldValue:(l,R)=>{n.current[l]=R},getFieldsValue:()=>({...n.current}),setFieldsValue:l=>{Object.assign(n.current,l)},validateFields:()=>Promise.resolve({...n.current}),validateField:l=>Promise.resolve(!0),resetFields:()=>{n.current={},t.current={},i.current={}},getFieldError:l=>t.current[l]??null,isFieldTouched:l=>i.current[l]??!1}),[]);return e?e.instance:b}function W({onSubmit:e,onValuesChange:n,initialValues:t={},layout:i="vertical",disabled:b=!1,children:l,className:R,style:M,form:T}){const m=L.useTheme(),[y,F]=s.useState({values:{...t},errors:{},touched:{}}),z=s.useRef(t),x=s.useRef({}),h=s.useRef(y);h.current=y;const w=s.useCallback((r,o)=>{x.current[r]=o},[]),q=s.useCallback(r=>{delete x.current[r]},[]),E=s.useCallback((r,o)=>{F(c=>{const d={...c,values:{...c.values,[r]:o}};return n==null||n({[r]:o},d.values),d})},[n]),C=s.useCallback((r,o)=>{F(c=>({...c,errors:{...c.errors,[r]:o}}))},[]),p=s.useCallback(r=>{F(o=>({...o,touched:{...o.touched,[r]:!0}}))},[]),v=s.useCallback(async r=>{const o=x.current[r];if(!o)return!0;const c=h.current.values[r],d=await Y(c,o.rules);return F(k=>({...k,errors:{...k.errors,[r]:d},touched:{...k.touched,[r]:!0}})),d===null},[]),j=s.useCallback(async()=>{const r=Object.keys(x.current),o=await Promise.all(r.map(async f=>{const g=x.current[f],G=h.current.values[f],J=await Y(G,g.rules);return{name:f,error:J}})),c={},d={};let k=!1;for(const{name:f,error:g}of o)c[f]=g,d[f]=!0,g&&(k=!0);if(F(f=>({...f,errors:{...f.errors,...c},touched:{...f.touched,...d}})),k){const f=Object.fromEntries(o.filter(g=>g.error).map(g=>[g.name,g.error]));return Promise.reject(f)}return{...h.current.values}},[]),I=s.useCallback(()=>{F({values:{...z.current},errors:{},touched:{}})},[]),$=s.useMemo(()=>({getFieldValue:r=>h.current.values[r],setFieldValue:E,getFieldsValue:()=>({...h.current.values}),setFieldsValue:r=>{F(o=>{const c={...o.values,...r};return n==null||n(r,c),{...o,values:c}})},validateFields:j,validateField:v,resetFields:I,getFieldError:r=>h.current.errors[r]??null,isFieldTouched:r=>!!h.current.touched[r]}),[E,j,v,I,n]),N=s.useCallback(async r=>{r.preventDefault();try{const o=await j();await(e==null?void 0:e(o))}catch{}},[j,e]),P=i==="inline"?u.tkx("flex flex-row flex-wrap items-end gap-4"):u.tkx("flex flex-col gap-5"),S=T??$,A=s.useMemo(()=>({state:y,initialValues:z.current,layout:i,disabled:b,fieldMeta:x,setFieldValue:E,setFieldError:C,setFieldTouched:p,registerField:w,unregisterField:q,validateField:v,instance:S}),[y,i,b,E,C,p,w,q,v,S]);return a.jsx(H.Provider,{value:A,children:a.jsx("form",{noValidate:!0,role:"form","aria-label":"Form",onSubmit:N,className:u.cx(P,R),style:{color:m.text,...M},children:l})})}W.displayName="TkxForm";function _({name:e,label:n,rules:t,help:i,required:b,children:l,className:R,style:M}){const T=L.useTheme(),m=K(),{state:y,layout:F,disabled:z}=m,x=s.useMemo(()=>Q(t,b),[t,b]),h=U(x),w=s.useRef({rules:x});w.current.rules=x;const q=s.useRef(!1);q.current||(m.registerField(e,w.current),q.current=!0),s.useMemo(()=>{m.registerField(e,w.current)},[x,e,m]);const E=y.values[e],C=y.touched[e]?y.errors[e]??null:null,p=C?B.sanitizeString(C):null,v=n?B.sanitizeString(n):void 0,j=i?B.sanitizeString(i):void 0,I=s.useCallback(c=>{let d;if(c!==null&&typeof c=="object"&&"target"in c){const k=c.target;d=k.type==="checkbox"?k.checked:k.value}else d=c;m.setFieldValue(e,d)},[m,e]),$=s.useCallback(()=>{m.setFieldTouched(e),m.validateField(e)},[m,e]),N=s.cloneElement(l,{value:E??"",onChange:I,onBlur:$,error:p??void 0,isInvalid:!!p,isRequired:h,disabled:z||l.props.disabled,name:e}),P=F==="horizontal",S=F==="inline",A=a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:a.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"})}),r=v?a.jsxs("label",{className:u.tkx("text-sm font-medium font-sans",P?"min-w-[140px] pt-2.5":""),style:{color:T.text},children:[v,h&&a.jsx("span",{"aria-hidden":"true",className:u.tkx("ml-1"),style:{color:T.danger},children:"*"})]}):null,o=a.jsxs(a.Fragment,{children:[j&&!p&&a.jsx("span",{className:u.tkx("text-xs mt-0.5"),style:{color:T.textMuted},children:j}),p&&a.jsxs("span",{role:"alert",className:u.tkx("text-xs flex items-center gap-1 mt-0.5"),style:{color:T.danger,animation:"tkxFormErrorReveal 200ms ease-out"},children:[A,p]})]});return S?a.jsxs("div",{className:u.cx(u.tkx("flex flex-col gap-1"),R),style:M,children:[r,N,o]}):P?a.jsxs("div",{className:u.cx(u.tkx("flex flex-row gap-4 items-start"),R),style:M,children:[r,a.jsxs("div",{className:u.tkx("flex flex-col gap-1 flex-1 min-w-0"),children:[N,o]})]}):a.jsxs("div",{className:u.cx(u.tkx("flex flex-col gap-1"),R),style:M,children:[r,N,o]})}_.displayName="TkxFormField";let D=!1;function X(){if(D||typeof document>"u")return;D=!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)}X();exports.TkxForm=W;exports.TkxFormField=_;exports.useTkxForm=V;
|
package/dist/index-BgHMZe4Z.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { useRef as c, useEffect as o, useCallback as d, useState as s } from "react";
|
|
2
|
-
import { G as i, i as a, w as f, x as m } from "./index-iUUHRxqJ.js";
|
|
3
|
-
function h() {
|
|
4
|
-
const [n, e] = s(() => typeof window > "u" ? !1 : m());
|
|
5
|
-
return o(() => {
|
|
6
|
-
if (typeof window > "u") return;
|
|
7
|
-
const t = window.matchMedia("(prefers-reduced-motion: reduce)"), r = (u) => e(u.matches);
|
|
8
|
-
return t.addEventListener("change", r), () => t.removeEventListener("change", r);
|
|
9
|
-
}, []), n;
|
|
10
|
-
}
|
|
11
|
-
function l() {
|
|
12
|
-
const [n, e] = s(() => typeof window > "u" ? !1 : f());
|
|
13
|
-
return o(() => {
|
|
14
|
-
if (typeof window > "u") return;
|
|
15
|
-
const t = window.matchMedia("(forced-colors: active)"), r = (u) => e(u.matches);
|
|
16
|
-
return t.addEventListener("change", r), () => t.removeEventListener("change", r);
|
|
17
|
-
}, []), n;
|
|
18
|
-
}
|
|
19
|
-
function v(n) {
|
|
20
|
-
const e = c(null);
|
|
21
|
-
return o(() => {
|
|
22
|
-
if (!n || !e.current) return;
|
|
23
|
-
const t = a(e.current);
|
|
24
|
-
return t.activate(), () => t.deactivate();
|
|
25
|
-
}, [n]), e;
|
|
26
|
-
}
|
|
27
|
-
function y() {
|
|
28
|
-
const n = c(null);
|
|
29
|
-
return o(() => {
|
|
30
|
-
if (!(typeof document > "u"))
|
|
31
|
-
return n.current = i(), () => {
|
|
32
|
-
var e;
|
|
33
|
-
(e = n.current) == null || e.destroy();
|
|
34
|
-
};
|
|
35
|
-
}, []), d((e, t = "polite") => {
|
|
36
|
-
var r;
|
|
37
|
-
(r = n.current) == null || r.announce(e, t);
|
|
38
|
-
}, []);
|
|
39
|
-
}
|
|
40
|
-
function E(n, e = !0) {
|
|
41
|
-
const t = c(n);
|
|
42
|
-
t.current = n, o(() => {
|
|
43
|
-
if (!e || typeof document > "u") return;
|
|
44
|
-
const r = (u) => {
|
|
45
|
-
u.key === "Escape" && t.current();
|
|
46
|
-
};
|
|
47
|
-
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
48
|
-
}, [e]);
|
|
49
|
-
}
|
|
50
|
-
function g(n, e) {
|
|
51
|
-
const t = c(e);
|
|
52
|
-
t.current = e, o(() => {
|
|
53
|
-
const r = (u) => {
|
|
54
|
-
!n.current || n.current.contains(u.target) || t.current();
|
|
55
|
-
};
|
|
56
|
-
return document.addEventListener("pointerdown", r), () => document.removeEventListener("pointerdown", r);
|
|
57
|
-
}, [n]);
|
|
58
|
-
}
|
|
59
|
-
export {
|
|
60
|
-
y as a,
|
|
61
|
-
v as b,
|
|
62
|
-
E as c,
|
|
63
|
-
g as d,
|
|
64
|
-
l as e,
|
|
65
|
-
h as u
|
|
66
|
-
};
|
package/dist/index-Bt5y50Qa.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("react"),s=require("./index-DnqXtpwV.cjs");function o(){const[n,e]=u.useState(()=>typeof window>"u"?!1:s.prefersReducedMotion());return u.useEffect(()=>{if(typeof window>"u")return;const t=window.matchMedia("(prefers-reduced-motion: reduce)"),r=c=>e(c.matches);return t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[]),n}function i(){const[n,e]=u.useState(()=>typeof window>"u"?!1:s.prefersHighContrast());return u.useEffect(()=>{if(typeof window>"u")return;const t=window.matchMedia("(forced-colors: active)"),r=c=>e(c.matches);return t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[]),n}function d(n){const e=u.useRef(null);return u.useEffect(()=>{if(!n||!e.current)return;const t=s.createFocusTrap(e.current);return t.activate(),()=>t.deactivate()},[n]),e}function f(){const n=u.useRef(null);return u.useEffect(()=>{if(!(typeof document>"u"))return n.current=s.createAnnouncer(),()=>{var e;(e=n.current)==null||e.destroy()}},[]),u.useCallback((e,t="polite")=>{var r;(r=n.current)==null||r.announce(e,t)},[])}function a(n,e=!0){const t=u.useRef(n);t.current=n,u.useEffect(()=>{if(!e||typeof document>"u")return;const r=c=>{c.key==="Escape"&&t.current()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e])}function p(n,e){const t=u.useRef(e);t.current=e,u.useEffect(()=>{const r=c=>{!n.current||n.current.contains(c.target)||t.current()};return document.addEventListener("pointerdown",r),()=>document.removeEventListener("pointerdown",r)},[n])}exports.useAnnounce=f;exports.useClickOutside=p;exports.useEscapeKey=a;exports.useFocusTrap=d;exports.useHighContrast=i;exports.useReducedMotion=o;
|
package/dist/index-DnqXtpwV.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("react"),I=2166136261,W=16777619;function v(n){let e=I;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,W)>>>0;return e.toString(16).padStart(8,"0")}class ${constructor(e=512){this.cache=new Map,this.hits=0,this.misses=0,this.ceiling=Math.min(e,512)}get(e){if(!this.cache.has(e)){this.misses++;return}this.hits++;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}set(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size>=this.ceiling&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}has(e){return this.cache.has(e)}invalidate(e){e!==void 0?this.cache.delete(e):this.cache.clear()}get size(){return this.cache.size}get cacheHitRate(){const e=this.hits+this.misses;return e===0?0:this.hits/e*100}}const f=new $(512);function C(n,e){const t=f.get(n);if(t!==void 0)return t;const s=e();return f.set(n,s),s}const H=[];let b=!1;const m=[];let y=0,l=0;function _(){const n=H.splice(0),e=performance.now();for(const s of n)try{s()}catch{}const t=performance.now()-e;y+=t,l++,m.push({duration:t,timestamp:Date.now()}),m.length>100&&m.shift()}function R(n){H.push(n),b||(b=!0,queueMicrotask(()=>{_(),b=!1}))}function X(n){const e=n!==void 0?m.slice(-n):m.slice();return{avgRenderTime:l===0?0:y/l,cacheHitRate:f.cacheHitRate,renderCount:l,recent:e}}function Q(n){n!==void 0?f.invalidate(n):f.invalidate()}const Z={hash:v,memoize:C,batchUpdate:R,invalidate:Q,get avgRenderTime(){return l===0?0:y/l},get cacheHitRate(){return f.cacheHitRate},getMetrics:X},x=new Map;function j(n){return n.replace(/([A-Z])/g,"-$1").toLowerCase()}function J(n){return"tkx-"+v(n)}function D(n){const e=J(n);return x.has(e)||x.set(e,n),e}function z(n,...e){const t=n.reduce((r,a,i)=>r+a+(e[i]!==void 0?String(e[i]):""),"");return{className:D(t.trim()),styles:t.trim()}}function N(n){const e=Object.entries(n).map(([s,r])=>`${j(s)}: ${r};`).join(" ");return{className:D(e),styles:e}}const Y={xs:"480px",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function L(n,e){return`@media (min-width: ${Y[n]}) { ${e} }`}function F(n,e){const t=Object.entries(e).map(([s,r])=>{const a=Object.entries(r).map(([i,o])=>`${j(i)}: ${o};`).join(" ");return`${s} { ${a} }`}).join(" ");return`@keyframes ${n} { ${t} }`}function w(n,e){return e!==void 0?`--tkx-${n}: ${e};`:`var(--tkx-${n})`}function A(){return Array.from(x.entries()).map(([n,e])=>`.${n} { ${e} }`).join(`
|
|
2
|
-
`)}function O(){x.clear()}function B(){if(typeof document>"u")return;let n=document.getElementById("tkx-styles");n||(n=document.createElement("style"),n.id="tkx-styles",document.head.appendChild(n)),n.textContent=A()}const ee={css:z,fromObject:N,responsive:L,keyframes:F,cssVar:w,extractCSS:A,injectStyles:B,resetStyles:O};function te(n){if(!n||typeof n!="string")return[0,0,0];const e=n.replace("#",""),t=e.length===3?e.split("").map(i=>i+i).join(""):e,s=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),a=parseInt(t.slice(4,6),16);return[isNaN(s)?0:s,isNaN(r)?0:r,isNaN(a)?0:a]}function M(n){const[e,t,s]=te(n).map(r=>{const a=r/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4});return .2126*e+.7152*t+.0722*s}function d(n,e){const t=M(n),s=M(e),r=Math.max(t,s),a=Math.min(t,s);return(r+.05)/(a+.05)}function g(n,e,t=!1){return d(n,e)>=(t?3:4.5)}function E(n,e,t=!1){return d(n,e)>=(t?4.5:7)}function P(n,e){const s=e??["#ffffff","#000000"];return s.reduce((r,a)=>d(a,n)>d(r,n)?a:r,s[0])}function V(){const n=document.createElement("div"),e=document.createElement("div");for(const t of[n,e])t.setAttribute("aria-atomic","true"),t.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;",document.body.appendChild(t);return n.setAttribute("aria-live","polite"),e.setAttribute("aria-live","assertive"),{announce(t,s="polite"){const r=s==="assertive"?e:n;r.textContent="",setTimeout(()=>{r.textContent=t},0)},destroy(){n.remove(),e.remove()}}}const ne=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])',"details > summary"].join(", ");function K(n){let e=null,t=null;function s(){return Array.from(n.querySelectorAll(ne)).filter(r=>!r.closest("[hidden]")&&!r.closest('[aria-hidden="true"]'))}return{activate(){e=document.activeElement;const r=s();r.length>0&&r[0].focus(),t=a=>{if(a.key!=="Tab")return;const i=s();if(i.length===0)return;const o=i[0],p=i[i.length-1];a.shiftKey?document.activeElement===o&&(a.preventDefault(),p.focus()):document.activeElement===p&&(a.preventDefault(),o.focus())},n.addEventListener("keydown",t)},deactivate(){t&&n.removeEventListener("keydown",t),e instanceof HTMLElement&&e.focus(),e=null,t=null}}}function U(n,e,t,s){let r=e;switch(n.key){case"ArrowLeft":case"ArrowUp":n.preventDefault(),r=e===0?t-1:e-1;break;case"ArrowRight":case"ArrowDown":n.preventDefault(),r=e===t-1?0:e+1;break;case"Home":n.preventDefault(),r=0;break;case"End":n.preventDefault(),r=t-1;break;case"Enter":case" ":n.preventDefault(),s(e);return;default:return}s(r)}function re(n,e,t,s,r){let a=e;switch(n.key){case"ArrowUp":n.preventDefault(),a=e===0?t-1:e-1;break;case"ArrowDown":n.preventDefault(),a=e===t-1?0:e+1;break;case"Home":n.preventDefault(),a=0;break;case"End":n.preventDefault(),a=t-1;break;case"Enter":case" ":n.preventDefault(),s(e);return;case"Escape":n.preventDefault(),r==null||r();return;default:return}s(a)}function q(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function G(){return typeof window>"u"?!1:window.matchMedia("(forced-colors: active)").matches}function se(n,e="polite"){if(typeof document>"u")return;let t=document.getElementById("tkx-live-region");t||(t=document.createElement("div"),t.id="tkx-live-region",t.setAttribute("aria-live",e),t.setAttribute("aria-atomic","true"),t.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;",document.body.appendChild(t)),t.textContent="",setTimeout(()=>{t&&(t.textContent=n)},0)}const ae={contrastRatio:d,meetsAA:g,meetsAAA:E,getAccessibleForeground:P,createAnnouncer:V,createFocusTrap:K,handleTabsKeyboard:U,handleMenuKeyboard:re,prefersReducedMotion:q,prefersHighContrast:G,announce:se},ie=typeof window<"u"?u.useLayoutEffect:u.useEffect,k={bg:"#0a0a0f",surface:"#12121a",surfaceAlt:"#1a1a2e",border:"#2a2a3e",text:"#e8e8f4",textMuted:"#8888aa",primary:"#00f5d4",secondary:"#7b2ff7",danger:"#f72585",warning:"#ffbe0b",success:"#06d6a0",info:"#3a86ff"},oe={bg:"#f8f6f1",surface:"#ffffff",surfaceAlt:"#f0ede6",border:"#ddd8cc",text:"#1a1815",textMuted:"#6b6560",primary:"#0d7c5f",secondary:"#6930c3",danger:"#c1121f",warning:"#d4a017",success:"#0d7c5f",info:"#1d4ed8"},ce=/^#[0-9a-fA-F]{3,8}$/;function le(n,e){const t={...n,...e};for(const[s,r]of Object.entries(t))if(!ce.test(r))throw new Error(`Invalid hex color for theme token '${s}': ${r}`);return g(t.text,t.bg)||console.warn(`[TekiVex] Theme contrast warning: text (${t.text}) vs bg (${t.bg}) does not meet WCAG AA minimum (4.5:1)`),g(t.primary,t.bg)||console.warn(`[TekiVex] Theme contrast warning: primary (${t.primary}) vs bg (${t.bg}) does not meet WCAG AA minimum`),E(t.text,t.bg)||console.warn(`[TekiVex] Theme contrast warning: text (${t.text}) vs bg (${t.bg}) does not meet WCAG AAA minimum (7:1)`),t}const T=u.createContext(k);function ue({theme:n=k,children:e}){ie(()=>{const s=Object.entries(n).map(([a,i])=>w(a,i)).join(" ");let r=document.getElementById("tkx-theme");if(!r){r=document.createElement("style"),r.id="tkx-theme";const a=document.head.querySelector("style");a?document.head.insertBefore(r,a):document.head.appendChild(r)}r.textContent=`:root { ${s} }`},[n]);const t=Object.fromEntries(Object.entries(n).map(([s,r])=>[`--tkx-${s}`,r]));return u.createElement(T.Provider,{value:n},u.createElement("div",{style:{display:"contents",...t}},e))}function fe(){return u.useContext(T)}function de(n){const e=n.replace("#",""),t=parseInt(e.slice(0,2),16)/255,s=parseInt(e.slice(2,4),16)/255,r=parseInt(e.slice(4,6),16)/255,a=Math.max(t,s,r),i=Math.min(t,s,r);let o=0,p=0;const S=(a+i)/2;if(a!==i){const h=a-i;switch(p=S>.5?h/(2-a-i):h/(a+i),a){case t:o=((s-r)/h+(s<r?6:0))/6;break;case s:o=((r-t)/h+2)/6;break;case r:o=((t-s)/h+4)/6;break}}return[Math.round(o*360),Math.round(p*100),Math.round(S*100)]}function c(n,e,t){e/=100,t/=100;const s=e*Math.min(t,1-t),r=a=>{const i=(a+n/30)%12,o=t-s*Math.max(Math.min(i-3,9-i,1),-1);return Math.round(255*o).toString(16).padStart(2,"0")};return`#${r(0)}${r(8)}${r(4)}`}function pe(n){const[e,t]=de(n);return{50:c(e,Math.min(t,30),96),100:c(e,Math.min(t,40),90),200:c(e,Math.min(t,50),80),300:c(e,t,70),400:c(e,t,60),500:n,600:c(e,t,45),700:c(e,t,35),800:c(e,t,25),900:c(e,t,15)}}const he={xs:{fontSize:"0.75rem",lineHeight:"1rem"},sm:{fontSize:"0.875rem",lineHeight:"1.25rem"},base:{fontSize:"1rem",lineHeight:"1.5rem"},lg:{fontSize:"1.125rem",lineHeight:"1.75rem"},xl:{fontSize:"1.25rem",lineHeight:"1.75rem"},"2xl":{fontSize:"1.5rem",lineHeight:"2rem"},"3xl":{fontSize:"1.875rem",lineHeight:"2.25rem"},"4xl":{fontSize:"2.25rem",lineHeight:"2.5rem"},"5xl":{fontSize:"3rem",lineHeight:"1.15"}},me={0:"0px",.5:"2px",1:"4px",1.5:"6px",2:"8px",2.5:"10px",3:"12px",4:"16px",5:"20px",6:"24px",8:"32px",10:"40px",12:"48px",16:"64px",20:"80px",24:"96px"},xe={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},ge={none:"none",xs:"0 1px 2px 0 rgba(0,0,0,0.05)",sm:"0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)",md:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",lg:"0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",xl:"0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)","2xl":"0 25px 50px -12px rgba(0,0,0,0.25)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)"},be={hide:-1,base:0,dropdown:1e3,sticky:1100,fixed:1200,overlay:1300,modal:1400,popover:1500,tooltip:1600,toast:1700,max:9999},ve={none:"0",sm:"4px",md:"6px",lg:"8px",xl:"12px","2xl":"16px",full:"9999px"};exports.LRUCache=$;exports.Quantum=Z;exports.TKX=ee;exports.ThemeContext=T;exports.ThemeProvider=ue;exports.WCAGEngine=ae;exports.auroraLight=oe;exports.batchUpdate=R;exports.breakpoints=xe;exports.contrastRatio=d;exports.createAnnouncer=V;exports.createFocusTrap=K;exports.createTheme=le;exports.css=z;exports.cssVar=w;exports.extractCSS=A;exports.fnv1aHash=v;exports.fromObject=N;exports.generatePalette=pe;exports.getAccessibleForeground=P;exports.handleTabsKeyboard=U;exports.injectStyles=B;exports.keyframes=F;exports.meetsAA=g;exports.meetsAAA=E;exports.memoize=C;exports.prefersHighContrast=G;exports.prefersReducedMotion=q;exports.quantumDark=k;exports.radii=ve;exports.resetStyles=O;exports.responsive=L;exports.shadows=ge;exports.spacing=me;exports.typography=he;exports.useTheme=fe;exports.zIndex=be;
|