klun-ui 0.1.12 → 0.1.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/CHANGELOG.md +26 -0
- package/dist/{chunk-7FELOLAD.cjs → chunk-752UKCVU.cjs} +206 -64
- package/dist/chunk-752UKCVU.cjs.map +1 -0
- package/dist/{chunk-3XJ5FN4P.js → chunk-7L7FJQZ7.js} +204 -65
- package/dist/chunk-7L7FJQZ7.js.map +1 -0
- package/dist/index.cjs +160 -148
- package/dist/index.d.cts +54 -5
- package/dist/index.d.ts +54 -5
- package/dist/index.js +1 -1
- package/dist/styles.css +86 -0
- package/dist/templates/index.cjs +89 -89
- package/dist/templates/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3XJ5FN4P.js.map +0 -1
- package/dist/chunk-7FELOLAD.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,32 @@ All notable changes to **klun-ui** are documented here. The format follows
|
|
|
5
5
|
[Semantic Versioning](https://semver.org/) (pre-1.0: minor/patch bumps may carry
|
|
6
6
|
small breaking changes).
|
|
7
7
|
|
|
8
|
+
## [0.1.14] — 2026-06-23
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **`Markdown` — a dependency-free Markdown → React renderer.** Renders headings,
|
|
12
|
+
`**bold**` / `*italic*` / `~~strike~~` / `` `code` ``, `[links](url)`,
|
|
13
|
+
`> blockquotes`, ordered/unordered lists and ``` fenced code blocks ``` as React
|
|
14
|
+
nodes (never raw HTML, so user text is XSS-safe). Use `<Markdown>{src}</Markdown>`
|
|
15
|
+
(or `source={src}`); the underlying `renderMarkdown(src): ReactNode` function is
|
|
16
|
+
exported too for inline use. Styles are namespaced under `.klun-md`.
|
|
17
|
+
|
|
18
|
+
## [0.1.13] — 2026-06-23
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- **`CheckboxGroup` — a set of checkboxes bound to a `string[]` value.**
|
|
22
|
+
antd-aligned API: `options` (a bare string is shorthand for
|
|
23
|
+
`{ label, value }`, or pass `{ label, value, disabled }`), controlled
|
|
24
|
+
`value`/`onChange` or uncontrolled `defaultValue`, `direction`
|
|
25
|
+
(`"horizontal"` | `"vertical"`), `size`, and a group-level `disabled`.
|
|
26
|
+
- **`Checkbox` now renders an optional label.** Pass `children` to show text
|
|
27
|
+
next to the box (backward compatible — box-only usage is unchanged).
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- **`Drawer` default size is now `50%`** of the viewport along the slide axis
|
|
31
|
+
(was a fixed `378px`) for both `width` and `height`. Pass an explicit
|
|
32
|
+
`width`/`height` (number or string) to override.
|
|
33
|
+
|
|
8
34
|
## [0.1.10] — 2026-06-21
|
|
9
35
|
|
|
10
36
|
### Added
|
|
@@ -166,7 +166,7 @@ var Format = {
|
|
|
166
166
|
|
|
167
167
|
// src/components/config/locales.tsx
|
|
168
168
|
function fmt(template, vars) {
|
|
169
|
-
return template.replace(/\{(\w+)\}/g, (m,
|
|
169
|
+
return template.replace(/\{(\w+)\}/g, (m, k2) => k2 in vars ? String(vars[k2]) : m);
|
|
170
170
|
}
|
|
171
171
|
var enUS = {
|
|
172
172
|
locale: "en-US",
|
|
@@ -2934,6 +2934,104 @@ var ListItem = react.forwardRef(
|
|
|
2934
2934
|
}
|
|
2935
2935
|
);
|
|
2936
2936
|
ListItem.displayName = "ListItem";
|
|
2937
|
+
var k = 0;
|
|
2938
|
+
function inline(text) {
|
|
2939
|
+
const patterns = [
|
|
2940
|
+
{ re: /`([^`]+)`/, node: (m) => /* @__PURE__ */ jsxRuntime.jsx("code", { className: "klun-md-code", children: m[1] }, k++) },
|
|
2941
|
+
{ re: /\*\*([^*]+)\*\*/, node: (m) => /* @__PURE__ */ jsxRuntime.jsx("strong", { children: inline(m[1]) }, k++) },
|
|
2942
|
+
{ re: /~~([^~]+)~~/, node: (m) => /* @__PURE__ */ jsxRuntime.jsx("del", { children: inline(m[1]) }, k++) },
|
|
2943
|
+
{ re: /\*([^*]+)\*/, node: (m) => /* @__PURE__ */ jsxRuntime.jsx("em", { children: inline(m[1]) }, k++) },
|
|
2944
|
+
{ re: /<u>([\s\S]*?)<\/u>/, node: (m) => /* @__PURE__ */ jsxRuntime.jsx("u", { children: inline(m[1]) }, k++) },
|
|
2945
|
+
{
|
|
2946
|
+
re: /\[([^\]]+)\]\(([^)]+)\)/,
|
|
2947
|
+
node: (m) => /* @__PURE__ */ jsxRuntime.jsx("a", { href: m[2], target: "_blank", rel: "noreferrer", children: m[1] }, k++)
|
|
2948
|
+
}
|
|
2949
|
+
];
|
|
2950
|
+
const out = [];
|
|
2951
|
+
let rest = text;
|
|
2952
|
+
while (rest.length) {
|
|
2953
|
+
let best = null;
|
|
2954
|
+
for (const p of patterns) {
|
|
2955
|
+
const m = p.re.exec(rest);
|
|
2956
|
+
if (m && (best === null || m.index < best.idx)) best = { idx: m.index, len: m[0].length, p, m };
|
|
2957
|
+
}
|
|
2958
|
+
if (!best) {
|
|
2959
|
+
out.push(rest);
|
|
2960
|
+
break;
|
|
2961
|
+
}
|
|
2962
|
+
if (best.idx > 0) out.push(rest.slice(0, best.idx));
|
|
2963
|
+
out.push(best.p.node(best.m));
|
|
2964
|
+
rest = rest.slice(best.idx + best.len);
|
|
2965
|
+
}
|
|
2966
|
+
return out;
|
|
2967
|
+
}
|
|
2968
|
+
var SPECIAL = /^(#{1,6}\s|>\s?|[-*]\s+|\d+\.\s+|```)/;
|
|
2969
|
+
function renderMarkdown(src) {
|
|
2970
|
+
k = 0;
|
|
2971
|
+
const lines = src.replace(/\r\n/g, "\n").split("\n");
|
|
2972
|
+
const blocks = [];
|
|
2973
|
+
let i = 0;
|
|
2974
|
+
while (i < lines.length) {
|
|
2975
|
+
const line = lines[i];
|
|
2976
|
+
if (/^```/.test(line)) {
|
|
2977
|
+
const buf2 = [];
|
|
2978
|
+
i++;
|
|
2979
|
+
while (i < lines.length && !/^```/.test(lines[i])) buf2.push(lines[i++]);
|
|
2980
|
+
i++;
|
|
2981
|
+
blocks.push(
|
|
2982
|
+
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "klun-md-pre", children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: buf2.join("\n") }) }, k++)
|
|
2983
|
+
);
|
|
2984
|
+
continue;
|
|
2985
|
+
}
|
|
2986
|
+
const h = /^(#{1,6})\s+(.*)$/.exec(line);
|
|
2987
|
+
if (h) {
|
|
2988
|
+
const tag = `h${Math.min(h[1].length + 2, 6)}`;
|
|
2989
|
+
blocks.push(react.createElement(tag, { key: k++, className: "klun-md-h" }, inline(h[2])));
|
|
2990
|
+
i++;
|
|
2991
|
+
continue;
|
|
2992
|
+
}
|
|
2993
|
+
if (/^>\s?/.test(line)) {
|
|
2994
|
+
const buf2 = [];
|
|
2995
|
+
while (i < lines.length && /^>\s?/.test(lines[i])) buf2.push(lines[i++].replace(/^>\s?/, ""));
|
|
2996
|
+
blocks.push(
|
|
2997
|
+
/* @__PURE__ */ jsxRuntime.jsx("blockquote", { className: "klun-md-quote", children: inline(buf2.join("\n")) }, k++)
|
|
2998
|
+
);
|
|
2999
|
+
continue;
|
|
3000
|
+
}
|
|
3001
|
+
if (/^[-*]\s+/.test(line)) {
|
|
3002
|
+
const items2 = [];
|
|
3003
|
+
while (i < lines.length && /^[-*]\s+/.test(lines[i])) items2.push(lines[i++].replace(/^[-*]\s+/, ""));
|
|
3004
|
+
blocks.push(
|
|
3005
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "klun-md-ul", children: items2.map((it, j) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: inline(it) }, j)) }, k++)
|
|
3006
|
+
);
|
|
3007
|
+
continue;
|
|
3008
|
+
}
|
|
3009
|
+
if (/^\d+\.\s+/.test(line)) {
|
|
3010
|
+
const items2 = [];
|
|
3011
|
+
while (i < lines.length && /^\d+\.\s+/.test(lines[i])) items2.push(lines[i++].replace(/^\d+\.\s+/, ""));
|
|
3012
|
+
blocks.push(
|
|
3013
|
+
/* @__PURE__ */ jsxRuntime.jsx("ol", { className: "klun-md-ol", children: items2.map((it, j) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: inline(it) }, j)) }, k++)
|
|
3014
|
+
);
|
|
3015
|
+
continue;
|
|
3016
|
+
}
|
|
3017
|
+
if (line.trim() === "") {
|
|
3018
|
+
i++;
|
|
3019
|
+
continue;
|
|
3020
|
+
}
|
|
3021
|
+
const buf = [line];
|
|
3022
|
+
i++;
|
|
3023
|
+
while (i < lines.length && lines[i].trim() !== "" && !SPECIAL.test(lines[i])) buf.push(lines[i++]);
|
|
3024
|
+
blocks.push(
|
|
3025
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "klun-md-p", children: buf.flatMap((l, j) => j ? [/* @__PURE__ */ jsxRuntime.jsx("br", {}, `br${j}`), ...inline(l)] : inline(l)) }, k++)
|
|
3026
|
+
);
|
|
3027
|
+
}
|
|
3028
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: blocks });
|
|
3029
|
+
}
|
|
3030
|
+
var Markdown = react.forwardRef(function Markdown2({ children, source, className, ...props }, ref) {
|
|
3031
|
+
const src = source ?? (typeof children === "string" ? children : "") ?? "";
|
|
3032
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: chunkTPGAXYFU_cjs.cx("klun-md", className), ...props, children: renderMarkdown(src) });
|
|
3033
|
+
});
|
|
3034
|
+
Markdown.displayName = "Markdown";
|
|
2937
3035
|
var Money = react.forwardRef(function Money2({
|
|
2938
3036
|
value,
|
|
2939
3037
|
cents = false,
|
|
@@ -3177,8 +3275,8 @@ function StatusBadge({
|
|
|
3177
3275
|
className,
|
|
3178
3276
|
...props
|
|
3179
3277
|
}) {
|
|
3180
|
-
const
|
|
3181
|
-
const resolvedTone = tone || map && map[
|
|
3278
|
+
const k2 = keyOf(status);
|
|
3279
|
+
const resolvedTone = tone || map && map[k2] || STATUS_TONE[k2] || "neutral";
|
|
3182
3280
|
const color = TONE_COLOR[resolvedTone] || "gray";
|
|
3183
3281
|
const text = label != null ? label : String(status == null ? "" : status).replace(/[-_]/g, " ");
|
|
3184
3282
|
const display = typeof text === "string" ? text.charAt(0).toUpperCase() + text.slice(1) : text;
|
|
@@ -3303,14 +3401,14 @@ function Pager({
|
|
|
3303
3401
|
const h = (e) => {
|
|
3304
3402
|
if (sizeRef.current && !sizeRef.current.contains(e.target)) setSizeOpen(false);
|
|
3305
3403
|
};
|
|
3306
|
-
const
|
|
3404
|
+
const k2 = (e) => {
|
|
3307
3405
|
if (e.key === "Escape") setSizeOpen(false);
|
|
3308
3406
|
};
|
|
3309
3407
|
document.addEventListener("mousedown", h);
|
|
3310
|
-
document.addEventListener("keydown",
|
|
3408
|
+
document.addEventListener("keydown", k2);
|
|
3311
3409
|
return () => {
|
|
3312
3410
|
document.removeEventListener("mousedown", h);
|
|
3313
|
-
document.removeEventListener("keydown",
|
|
3411
|
+
document.removeEventListener("keydown", k2);
|
|
3314
3412
|
};
|
|
3315
3413
|
}, [sizeOpen]);
|
|
3316
3414
|
const nums = [];
|
|
@@ -3428,16 +3526,16 @@ function ContextMenu({
|
|
|
3428
3526
|
}, [x, y]);
|
|
3429
3527
|
react.useEffect(() => {
|
|
3430
3528
|
const close = () => onClose();
|
|
3431
|
-
const
|
|
3529
|
+
const k2 = (e) => {
|
|
3432
3530
|
if (e.key === "Escape") onClose();
|
|
3433
3531
|
};
|
|
3434
3532
|
document.addEventListener("mousedown", close);
|
|
3435
|
-
document.addEventListener("keydown",
|
|
3533
|
+
document.addEventListener("keydown", k2);
|
|
3436
3534
|
window.addEventListener("scroll", close, true);
|
|
3437
3535
|
window.addEventListener("resize", close);
|
|
3438
3536
|
return () => {
|
|
3439
3537
|
document.removeEventListener("mousedown", close);
|
|
3440
|
-
document.removeEventListener("keydown",
|
|
3538
|
+
document.removeEventListener("keydown", k2);
|
|
3441
3539
|
window.removeEventListener("scroll", close, true);
|
|
3442
3540
|
window.removeEventListener("resize", close);
|
|
3443
3541
|
};
|
|
@@ -3489,14 +3587,14 @@ function ColumnSettings({
|
|
|
3489
3587
|
const h = (e) => {
|
|
3490
3588
|
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
3491
3589
|
};
|
|
3492
|
-
const
|
|
3590
|
+
const k2 = (e) => {
|
|
3493
3591
|
if (e.key === "Escape") setOpen(false);
|
|
3494
3592
|
};
|
|
3495
3593
|
document.addEventListener("mousedown", h);
|
|
3496
|
-
document.addEventListener("keydown",
|
|
3594
|
+
document.addEventListener("keydown", k2);
|
|
3497
3595
|
return () => {
|
|
3498
3596
|
document.removeEventListener("mousedown", h);
|
|
3499
|
-
document.removeEventListener("keydown",
|
|
3597
|
+
document.removeEventListener("keydown", k2);
|
|
3500
3598
|
};
|
|
3501
3599
|
}, [open]);
|
|
3502
3600
|
const toggleable = columns.filter((c) => c.header != null && c.header !== "");
|
|
@@ -3636,14 +3734,14 @@ function FilterMenu({
|
|
|
3636
3734
|
const h = (e) => {
|
|
3637
3735
|
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
3638
3736
|
};
|
|
3639
|
-
const
|
|
3737
|
+
const k2 = (e) => {
|
|
3640
3738
|
if (e.key === "Escape") setOpen(false);
|
|
3641
3739
|
};
|
|
3642
3740
|
document.addEventListener("mousedown", h);
|
|
3643
|
-
document.addEventListener("keydown",
|
|
3741
|
+
document.addEventListener("keydown", k2);
|
|
3644
3742
|
return () => {
|
|
3645
3743
|
document.removeEventListener("mousedown", h);
|
|
3646
|
-
document.removeEventListener("keydown",
|
|
3744
|
+
document.removeEventListener("keydown", k2);
|
|
3647
3745
|
};
|
|
3648
3746
|
}, [open]);
|
|
3649
3747
|
const toggle = (v) => {
|
|
@@ -4283,12 +4381,12 @@ function useTableFilters({
|
|
|
4283
4381
|
const keys = Object.keys(activeFilters);
|
|
4284
4382
|
if (keys.length === 0) return rows;
|
|
4285
4383
|
return rows.filter(
|
|
4286
|
-
(row) => keys.every((
|
|
4287
|
-
const col = columns.find((c) => c.key ===
|
|
4288
|
-
const vals = activeFilters[
|
|
4384
|
+
(row) => keys.every((k2) => {
|
|
4385
|
+
const col = columns.find((c) => c.key === k2);
|
|
4386
|
+
const vals = activeFilters[k2];
|
|
4289
4387
|
if (!vals || vals.length === 0) return true;
|
|
4290
4388
|
if (col && col.onFilter) return vals.some((v) => col.onFilter(v, row));
|
|
4291
|
-
return vals.includes(row[
|
|
4389
|
+
return vals.includes(row[k2]);
|
|
4292
4390
|
})
|
|
4293
4391
|
);
|
|
4294
4392
|
}, [rows, activeFilters, columns, filters]);
|
|
@@ -4887,10 +4985,10 @@ var Tree = react.forwardRef(function Tree2({
|
|
|
4887
4985
|
};
|
|
4888
4986
|
const rows = [];
|
|
4889
4987
|
flatten(treeData, 0, true, exp, rows);
|
|
4890
|
-
const toggle = (key) => setExp(exp.includes(key) ? exp.filter((
|
|
4988
|
+
const toggle = (key) => setExp(exp.includes(key) ? exp.filter((k2) => k2 !== key) : [...exp, key]);
|
|
4891
4989
|
const checkState = (node) => {
|
|
4892
4990
|
const all = descendantKeys(node, []);
|
|
4893
|
-
const checkedCount = all.filter((
|
|
4991
|
+
const checkedCount = all.filter((k2) => checkedKeys.includes(k2)).length;
|
|
4894
4992
|
if (checkedCount === 0) return "none";
|
|
4895
4993
|
if (checkedCount === all.length) return "all";
|
|
4896
4994
|
return "some";
|
|
@@ -4900,7 +4998,7 @@ var Tree = react.forwardRef(function Tree2({
|
|
|
4900
4998
|
const all = descendantKeys(node, []);
|
|
4901
4999
|
const state = checkState(node);
|
|
4902
5000
|
let next;
|
|
4903
|
-
if (state === "all") next = checkedKeys.filter((
|
|
5001
|
+
if (state === "all") next = checkedKeys.filter((k2) => !all.includes(k2));
|
|
4904
5002
|
else next = Array.from(/* @__PURE__ */ new Set([...checkedKeys, ...all]));
|
|
4905
5003
|
onCheck(next);
|
|
4906
5004
|
};
|
|
@@ -5870,14 +5968,14 @@ var Cascader = react.forwardRef(function Cascader2({
|
|
|
5870
5968
|
const h = (e) => {
|
|
5871
5969
|
if (rootRef.current && !rootRef.current.contains(e.target)) setOpen(false);
|
|
5872
5970
|
};
|
|
5873
|
-
const
|
|
5971
|
+
const k2 = (e) => {
|
|
5874
5972
|
if (e.key === "Escape") setOpen(false);
|
|
5875
5973
|
};
|
|
5876
5974
|
document.addEventListener("mousedown", h);
|
|
5877
|
-
document.addEventListener("keydown",
|
|
5975
|
+
document.addEventListener("keydown", k2);
|
|
5878
5976
|
return () => {
|
|
5879
5977
|
document.removeEventListener("mousedown", h);
|
|
5880
|
-
document.removeEventListener("keydown",
|
|
5978
|
+
document.removeEventListener("keydown", k2);
|
|
5881
5979
|
};
|
|
5882
5980
|
}, [open]);
|
|
5883
5981
|
const columns = [];
|
|
@@ -6016,7 +6114,7 @@ var CharacterCounter = react.forwardRef(
|
|
|
6016
6114
|
}
|
|
6017
6115
|
);
|
|
6018
6116
|
CharacterCounter.displayName = "CharacterCounter";
|
|
6019
|
-
var Checkbox = react.forwardRef(function Checkbox2({ indeterminate = false, disabled = false, error = false, size: sizeProp, onChange, className, style, ...props }, ref) {
|
|
6117
|
+
var Checkbox = react.forwardRef(function Checkbox2({ indeterminate = false, disabled = false, error = false, size: sizeProp, onChange, className, style, children, ...props }, ref) {
|
|
6020
6118
|
const size = useSize(sizeProp);
|
|
6021
6119
|
const innerRef = react.useRef(null);
|
|
6022
6120
|
const setRef = (node) => {
|
|
@@ -6035,6 +6133,7 @@ var Checkbox = react.forwardRef(function Checkbox2({ indeterminate = false, disa
|
|
|
6035
6133
|
`klun-checkbox--${size}`,
|
|
6036
6134
|
disabled && "klun-checkbox--disabled",
|
|
6037
6135
|
error && "klun-checkbox--error",
|
|
6136
|
+
children != null && children !== false && "klun-checkbox--with-label",
|
|
6038
6137
|
className
|
|
6039
6138
|
),
|
|
6040
6139
|
style,
|
|
@@ -6054,12 +6153,52 @@ var Checkbox = react.forwardRef(function Checkbox2({ indeterminate = false, disa
|
|
|
6054
6153
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "klun-checkbox__box", "aria-hidden": true, children: [
|
|
6055
6154
|
/* @__PURE__ */ jsxRuntime.jsx("svg", { className: "klun-checkbox__check", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.5 8.5l3 3 6-6.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
6056
6155
|
/* @__PURE__ */ jsxRuntime.jsx("svg", { className: "klun-checkbox__dash", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.5 8h9", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) })
|
|
6057
|
-
] })
|
|
6156
|
+
] }),
|
|
6157
|
+
children != null && children !== false && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "klun-checkbox__label", children })
|
|
6058
6158
|
]
|
|
6059
6159
|
}
|
|
6060
6160
|
);
|
|
6061
6161
|
});
|
|
6062
6162
|
Checkbox.displayName = "Checkbox";
|
|
6163
|
+
var CheckboxGroup = react.forwardRef(function CheckboxGroup2({ options, value, defaultValue, onChange, disabled = false, size, name, direction = "horizontal", className, style, children }, ref) {
|
|
6164
|
+
const [internal, setInternal] = react.useState(defaultValue ?? []);
|
|
6165
|
+
const controlled = value != null;
|
|
6166
|
+
const current = controlled ? value : internal;
|
|
6167
|
+
const toggle = (val, checked) => {
|
|
6168
|
+
const next = checked ? [...current, val] : current.filter((v) => v !== val);
|
|
6169
|
+
if (!controlled) setInternal(next);
|
|
6170
|
+
onChange?.(next);
|
|
6171
|
+
};
|
|
6172
|
+
const norm2 = (options ?? []).map(
|
|
6173
|
+
(o) => typeof o === "string" ? { label: o, value: o } : o
|
|
6174
|
+
);
|
|
6175
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6176
|
+
"div",
|
|
6177
|
+
{
|
|
6178
|
+
ref,
|
|
6179
|
+
role: "group",
|
|
6180
|
+
className: chunkTPGAXYFU_cjs.cx("klun-checkbox-group", `klun-checkbox-group--${direction}`, className),
|
|
6181
|
+
style,
|
|
6182
|
+
children: [
|
|
6183
|
+
norm2.map((o) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6184
|
+
Checkbox,
|
|
6185
|
+
{
|
|
6186
|
+
name,
|
|
6187
|
+
size,
|
|
6188
|
+
value: o.value,
|
|
6189
|
+
checked: current.includes(o.value),
|
|
6190
|
+
disabled: disabled || o.disabled,
|
|
6191
|
+
onChange: (checked) => toggle(o.value, checked),
|
|
6192
|
+
children: o.label
|
|
6193
|
+
},
|
|
6194
|
+
o.value
|
|
6195
|
+
)),
|
|
6196
|
+
children
|
|
6197
|
+
]
|
|
6198
|
+
}
|
|
6199
|
+
);
|
|
6200
|
+
});
|
|
6201
|
+
CheckboxGroup.displayName = "CheckboxGroup";
|
|
6063
6202
|
var CheckboxCard = react.forwardRef(
|
|
6064
6203
|
function CheckboxCard2({
|
|
6065
6204
|
title,
|
|
@@ -6902,8 +7041,8 @@ var Calendar = react.forwardRef(function Calendar2({ value, onPick, className, s
|
|
|
6902
7041
|
] });
|
|
6903
7042
|
});
|
|
6904
7043
|
var DatePicker = react.forwardRef(
|
|
6905
|
-
function DatePicker2({ value, onChange, inline, placeholder, format = DEFAULT_FORMAT, align = "left", disabled, className, style, ...props }, ref) {
|
|
6906
|
-
if (
|
|
7044
|
+
function DatePicker2({ value, onChange, inline: inline2, placeholder, format = DEFAULT_FORMAT, align = "left", disabled, className, style, ...props }, ref) {
|
|
7045
|
+
if (inline2) {
|
|
6907
7046
|
return /* @__PURE__ */ jsxRuntime.jsx(Calendar, { ref, value, onPick: (d) => onChange?.(d), className, style });
|
|
6908
7047
|
}
|
|
6909
7048
|
const sel = value ? new Date(value) : null;
|
|
@@ -7168,9 +7307,9 @@ function DateTimePanel({ value, onChange }) {
|
|
|
7168
7307
|
] });
|
|
7169
7308
|
}
|
|
7170
7309
|
var DateTimePicker = react.forwardRef(
|
|
7171
|
-
function DateTimePicker2({ value, onChange, inline, placeholder, format = DEFAULT_FORMAT2, align = "left", disabled, className, style, ...props }, ref) {
|
|
7310
|
+
function DateTimePicker2({ value, onChange, inline: inline2, placeholder, format = DEFAULT_FORMAT2, align = "left", disabled, className, style, ...props }, ref) {
|
|
7172
7311
|
const date = value ? new Date(value) : null;
|
|
7173
|
-
if (
|
|
7312
|
+
if (inline2) {
|
|
7174
7313
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: chunkTPGAXYFU_cjs.cx("klun-date-time-picker", className), style, ...props, children: /* @__PURE__ */ jsxRuntime.jsx(DateTimePanel, { value: date, onChange: (d) => onChange?.(d) }) });
|
|
7175
7314
|
}
|
|
7176
7315
|
const label = date ? date.toLocaleString(void 0, format) : "";
|
|
@@ -7257,8 +7396,8 @@ var RangeCalendar = react.forwardRef(function RangeCalendar2({ start, end, onPic
|
|
|
7257
7396
|
] });
|
|
7258
7397
|
});
|
|
7259
7398
|
var DateRangePicker = react.forwardRef(
|
|
7260
|
-
function DateRangePicker2({ start, end, onChange, inline, placeholder, format = DEFAULT_FORMAT3, align = "left", disabled, className, style, ...props }, ref) {
|
|
7261
|
-
if (
|
|
7399
|
+
function DateRangePicker2({ start, end, onChange, inline: inline2, placeholder, format = DEFAULT_FORMAT3, align = "left", disabled, className, style, ...props }, ref) {
|
|
7400
|
+
if (inline2) {
|
|
7262
7401
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7263
7402
|
RangeCalendar,
|
|
7264
7403
|
{
|
|
@@ -7415,9 +7554,9 @@ var toPath = (name) => Array.isArray(name) ? name : String(name).split(".").map(
|
|
|
7415
7554
|
var pathKey = (name) => toPath(name).join(".");
|
|
7416
7555
|
function getIn(obj, name) {
|
|
7417
7556
|
let cur = obj;
|
|
7418
|
-
for (const
|
|
7557
|
+
for (const k2 of toPath(name)) {
|
|
7419
7558
|
if (cur == null) return void 0;
|
|
7420
|
-
cur = cur[
|
|
7559
|
+
cur = cur[k2];
|
|
7421
7560
|
}
|
|
7422
7561
|
return cur;
|
|
7423
7562
|
}
|
|
@@ -7426,11 +7565,11 @@ function setIn(obj, name, value) {
|
|
|
7426
7565
|
const root = Array.isArray(obj) ? obj.slice() : { ...obj };
|
|
7427
7566
|
let cur = root;
|
|
7428
7567
|
for (let i = 0; i < path.length - 1; i++) {
|
|
7429
|
-
const
|
|
7568
|
+
const k2 = path[i];
|
|
7430
7569
|
const nextKeyIsIndex = typeof path[i + 1] === "number";
|
|
7431
|
-
const existing = cur[
|
|
7432
|
-
cur[
|
|
7433
|
-
cur = cur[
|
|
7570
|
+
const existing = cur[k2];
|
|
7571
|
+
cur[k2] = existing == null ? nextKeyIsIndex ? [] : {} : Array.isArray(existing) ? existing.slice() : { ...existing };
|
|
7572
|
+
cur = cur[k2];
|
|
7434
7573
|
}
|
|
7435
7574
|
cur[path[path.length - 1]] = value;
|
|
7436
7575
|
return root;
|
|
@@ -7537,15 +7676,15 @@ function useForm(opts = {}) {
|
|
|
7537
7676
|
const setFields = react.useCallback((map) => {
|
|
7538
7677
|
setErrors((e) => {
|
|
7539
7678
|
const n = { ...e };
|
|
7540
|
-
Object.entries(map).forEach(([
|
|
7541
|
-
n[pathKey(
|
|
7679
|
+
Object.entries(map).forEach(([k2, v]) => {
|
|
7680
|
+
n[pathKey(k2)] = v;
|
|
7542
7681
|
});
|
|
7543
7682
|
return n;
|
|
7544
7683
|
});
|
|
7545
7684
|
setTouched((t) => {
|
|
7546
7685
|
const n = { ...t };
|
|
7547
|
-
Object.keys(map).forEach((
|
|
7548
|
-
n[pathKey(
|
|
7686
|
+
Object.keys(map).forEach((k2) => {
|
|
7687
|
+
n[pathKey(k2)] = true;
|
|
7549
7688
|
});
|
|
7550
7689
|
return n;
|
|
7551
7690
|
});
|
|
@@ -7576,7 +7715,7 @@ function useForm(opts = {}) {
|
|
|
7576
7715
|
}
|
|
7577
7716
|
});
|
|
7578
7717
|
setErrors(errs);
|
|
7579
|
-
setTouched(entries.reduce((a, [
|
|
7718
|
+
setTouched(entries.reduce((a, [k2]) => (a[k2] = true, a), {}));
|
|
7580
7719
|
if (firstBad) scrollToField(firstBad);
|
|
7581
7720
|
return Object.keys(errs).length === 0;
|
|
7582
7721
|
}, [scrollToField]);
|
|
@@ -7733,11 +7872,11 @@ function FormList({ name, children }) {
|
|
|
7733
7872
|
},
|
|
7734
7873
|
move: (from, to) => {
|
|
7735
7874
|
const a = arr.slice();
|
|
7736
|
-
const
|
|
7875
|
+
const k2 = keysRef.current;
|
|
7737
7876
|
const [m] = a.splice(from, 1);
|
|
7738
7877
|
a.splice(to, 0, m);
|
|
7739
|
-
const [mk] =
|
|
7740
|
-
|
|
7878
|
+
const [mk] = k2.splice(from, 1);
|
|
7879
|
+
k2.splice(to, 0, mk);
|
|
7741
7880
|
setArr(a);
|
|
7742
7881
|
}
|
|
7743
7882
|
};
|
|
@@ -8343,14 +8482,14 @@ var SelectMenu = react.forwardRef(
|
|
|
8343
8482
|
if (rootRef.current && !rootRef.current.contains(e.target))
|
|
8344
8483
|
setOpen(false);
|
|
8345
8484
|
};
|
|
8346
|
-
const
|
|
8485
|
+
const k2 = (e) => {
|
|
8347
8486
|
if (e.key === "Escape") setOpen(false);
|
|
8348
8487
|
};
|
|
8349
8488
|
document.addEventListener("mousedown", h);
|
|
8350
|
-
document.addEventListener("keydown",
|
|
8489
|
+
document.addEventListener("keydown", k2);
|
|
8351
8490
|
return () => {
|
|
8352
8491
|
document.removeEventListener("mousedown", h);
|
|
8353
|
-
document.removeEventListener("keydown",
|
|
8492
|
+
document.removeEventListener("keydown", k2);
|
|
8354
8493
|
};
|
|
8355
8494
|
}, [open]);
|
|
8356
8495
|
const lead = leadingIcon || selected?.icon;
|
|
@@ -8913,7 +9052,7 @@ function Masonry({
|
|
|
8913
9052
|
colHeights[c] += (h > 0 ? h : 1) + gutterV;
|
|
8914
9053
|
}
|
|
8915
9054
|
setPlacement(
|
|
8916
|
-
(prev) => prev.length === next.length && prev.every((v,
|
|
9055
|
+
(prev) => prev.length === next.length && prev.every((v, k2) => v === next[k2]) ? prev : next
|
|
8917
9056
|
);
|
|
8918
9057
|
}, [cols, gutterV]);
|
|
8919
9058
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -9384,10 +9523,10 @@ function containsKey(children, key) {
|
|
|
9384
9523
|
}
|
|
9385
9524
|
var Menu = react.forwardRef(function Menu2({ items: items2 = [], selectedKey, onSelect, defaultOpenKeys = [], collapsed = false, className, ...props }, ref) {
|
|
9386
9525
|
const [openKeys, setOpenKeys] = react.useState(() => new Set(defaultOpenKeys));
|
|
9387
|
-
const toggleOpen = (
|
|
9526
|
+
const toggleOpen = (k2) => setOpenKeys((s) => {
|
|
9388
9527
|
const n = new Set(s);
|
|
9389
|
-
if (n.has(
|
|
9390
|
-
else n.add(
|
|
9528
|
+
if (n.has(k2)) n.delete(k2);
|
|
9529
|
+
else n.add(k2);
|
|
9391
9530
|
return n;
|
|
9392
9531
|
});
|
|
9393
9532
|
const Row3 = ({ item, depth }) => {
|
|
@@ -10091,8 +10230,8 @@ var Drawer = react.forwardRef(function Drawer2({
|
|
|
10091
10230
|
title,
|
|
10092
10231
|
placement,
|
|
10093
10232
|
side,
|
|
10094
|
-
width =
|
|
10095
|
-
height =
|
|
10233
|
+
width = "50%",
|
|
10234
|
+
height = "50%",
|
|
10096
10235
|
size = "default",
|
|
10097
10236
|
closable = true,
|
|
10098
10237
|
maskClosable = true,
|
|
@@ -10172,14 +10311,14 @@ var Dropdown = react.forwardRef(function Dropdown2({ trigger, items: items2 = []
|
|
|
10172
10311
|
const h = (e) => {
|
|
10173
10312
|
if (innerRef.current && !innerRef.current.contains(e.target)) setOpen(false);
|
|
10174
10313
|
};
|
|
10175
|
-
const
|
|
10314
|
+
const k2 = (e) => {
|
|
10176
10315
|
if (e.key === "Escape") setOpen(false);
|
|
10177
10316
|
};
|
|
10178
10317
|
document.addEventListener("mousedown", h);
|
|
10179
|
-
document.addEventListener("keydown",
|
|
10318
|
+
document.addEventListener("keydown", k2);
|
|
10180
10319
|
return () => {
|
|
10181
10320
|
document.removeEventListener("mousedown", h);
|
|
10182
|
-
document.removeEventListener("keydown",
|
|
10321
|
+
document.removeEventListener("keydown", k2);
|
|
10183
10322
|
};
|
|
10184
10323
|
}, [open]);
|
|
10185
10324
|
const setRefs = (node) => {
|
|
@@ -10540,14 +10679,14 @@ var Popconfirm = react.forwardRef(function Popconfirm2({
|
|
|
10540
10679
|
if (innerRef.current?.contains(t) || bubbleRef.current?.contains(t)) return;
|
|
10541
10680
|
setOpen(false);
|
|
10542
10681
|
};
|
|
10543
|
-
const
|
|
10682
|
+
const k2 = (e) => {
|
|
10544
10683
|
if (e.key === "Escape") setOpen(false);
|
|
10545
10684
|
};
|
|
10546
10685
|
document.addEventListener("mousedown", h);
|
|
10547
|
-
document.addEventListener("keydown",
|
|
10686
|
+
document.addEventListener("keydown", k2);
|
|
10548
10687
|
return () => {
|
|
10549
10688
|
document.removeEventListener("mousedown", h);
|
|
10550
|
-
document.removeEventListener("keydown",
|
|
10689
|
+
document.removeEventListener("keydown", k2);
|
|
10551
10690
|
};
|
|
10552
10691
|
}, [open]);
|
|
10553
10692
|
react.useLayoutEffect(() => {
|
|
@@ -10700,6 +10839,7 @@ exports.ChartLegend = ChartLegend;
|
|
|
10700
10839
|
exports.ChartTooltip = ChartTooltip;
|
|
10701
10840
|
exports.Checkbox = Checkbox;
|
|
10702
10841
|
exports.CheckboxCard = CheckboxCard;
|
|
10842
|
+
exports.CheckboxGroup = CheckboxGroup;
|
|
10703
10843
|
exports.Chip = Chip;
|
|
10704
10844
|
exports.CircularProgress = CircularProgress;
|
|
10705
10845
|
exports.CodeViewer = CodeViewer;
|
|
@@ -10753,6 +10893,7 @@ exports.List = List;
|
|
|
10753
10893
|
exports.ListItem = ListItem;
|
|
10754
10894
|
exports.LiveDot = LiveDot;
|
|
10755
10895
|
exports.LogViewer = LogViewer;
|
|
10896
|
+
exports.Markdown = Markdown;
|
|
10756
10897
|
exports.Masonry = Masonry;
|
|
10757
10898
|
exports.Menu = Menu;
|
|
10758
10899
|
exports.Message = Message;
|
|
@@ -10812,6 +10953,7 @@ exports.nlNL = nlNL;
|
|
|
10812
10953
|
exports.plPL = plPL;
|
|
10813
10954
|
exports.primaryColorVars = primaryColorVars;
|
|
10814
10955
|
exports.ptBR = ptBR;
|
|
10956
|
+
exports.renderMarkdown = renderMarkdown;
|
|
10815
10957
|
exports.ruRU = ruRU;
|
|
10816
10958
|
exports.toast = toast;
|
|
10817
10959
|
exports.trTR = trTR;
|
|
@@ -10827,5 +10969,5 @@ exports.useSize = useSize;
|
|
|
10827
10969
|
exports.viVN = viVN;
|
|
10828
10970
|
exports.zhCN = zhCN;
|
|
10829
10971
|
exports.zhTW = zhTW;
|
|
10830
|
-
//# sourceMappingURL=chunk-
|
|
10831
|
-
//# sourceMappingURL=chunk-
|
|
10972
|
+
//# sourceMappingURL=chunk-752UKCVU.cjs.map
|
|
10973
|
+
//# sourceMappingURL=chunk-752UKCVU.cjs.map
|