klun-ui 0.1.12 → 0.1.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/CHANGELOG.md +16 -0
- package/dist/{chunk-3XJ5FN4P.js → chunk-O2CR4NDQ.js} +48 -7
- package/dist/chunk-O2CR4NDQ.js.map +1 -0
- package/dist/{chunk-7FELOLAD.cjs → chunk-Y2R5PBYN.cjs} +48 -6
- package/dist/chunk-Y2R5PBYN.cjs.map +1 -0
- package/dist/index.cjs +152 -148
- package/dist/index.d.cts +39 -5
- package/dist/index.d.ts +39 -5
- package/dist/index.js +1 -1
- package/dist/styles.css +28 -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
|
@@ -6016,7 +6016,7 @@ var CharacterCounter = react.forwardRef(
|
|
|
6016
6016
|
}
|
|
6017
6017
|
);
|
|
6018
6018
|
CharacterCounter.displayName = "CharacterCounter";
|
|
6019
|
-
var Checkbox = react.forwardRef(function Checkbox2({ indeterminate = false, disabled = false, error = false, size: sizeProp, onChange, className, style, ...props }, ref) {
|
|
6019
|
+
var Checkbox = react.forwardRef(function Checkbox2({ indeterminate = false, disabled = false, error = false, size: sizeProp, onChange, className, style, children, ...props }, ref) {
|
|
6020
6020
|
const size = useSize(sizeProp);
|
|
6021
6021
|
const innerRef = react.useRef(null);
|
|
6022
6022
|
const setRef = (node) => {
|
|
@@ -6035,6 +6035,7 @@ var Checkbox = react.forwardRef(function Checkbox2({ indeterminate = false, disa
|
|
|
6035
6035
|
`klun-checkbox--${size}`,
|
|
6036
6036
|
disabled && "klun-checkbox--disabled",
|
|
6037
6037
|
error && "klun-checkbox--error",
|
|
6038
|
+
children != null && children !== false && "klun-checkbox--with-label",
|
|
6038
6039
|
className
|
|
6039
6040
|
),
|
|
6040
6041
|
style,
|
|
@@ -6054,12 +6055,52 @@ var Checkbox = react.forwardRef(function Checkbox2({ indeterminate = false, disa
|
|
|
6054
6055
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "klun-checkbox__box", "aria-hidden": true, children: [
|
|
6055
6056
|
/* @__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
6057
|
/* @__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
|
-
] })
|
|
6058
|
+
] }),
|
|
6059
|
+
children != null && children !== false && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "klun-checkbox__label", children })
|
|
6058
6060
|
]
|
|
6059
6061
|
}
|
|
6060
6062
|
);
|
|
6061
6063
|
});
|
|
6062
6064
|
Checkbox.displayName = "Checkbox";
|
|
6065
|
+
var CheckboxGroup = react.forwardRef(function CheckboxGroup2({ options, value, defaultValue, onChange, disabled = false, size, name, direction = "horizontal", className, style, children }, ref) {
|
|
6066
|
+
const [internal, setInternal] = react.useState(defaultValue ?? []);
|
|
6067
|
+
const controlled = value != null;
|
|
6068
|
+
const current = controlled ? value : internal;
|
|
6069
|
+
const toggle = (val, checked) => {
|
|
6070
|
+
const next = checked ? [...current, val] : current.filter((v) => v !== val);
|
|
6071
|
+
if (!controlled) setInternal(next);
|
|
6072
|
+
onChange?.(next);
|
|
6073
|
+
};
|
|
6074
|
+
const norm2 = (options ?? []).map(
|
|
6075
|
+
(o) => typeof o === "string" ? { label: o, value: o } : o
|
|
6076
|
+
);
|
|
6077
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6078
|
+
"div",
|
|
6079
|
+
{
|
|
6080
|
+
ref,
|
|
6081
|
+
role: "group",
|
|
6082
|
+
className: chunkTPGAXYFU_cjs.cx("klun-checkbox-group", `klun-checkbox-group--${direction}`, className),
|
|
6083
|
+
style,
|
|
6084
|
+
children: [
|
|
6085
|
+
norm2.map((o) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6086
|
+
Checkbox,
|
|
6087
|
+
{
|
|
6088
|
+
name,
|
|
6089
|
+
size,
|
|
6090
|
+
value: o.value,
|
|
6091
|
+
checked: current.includes(o.value),
|
|
6092
|
+
disabled: disabled || o.disabled,
|
|
6093
|
+
onChange: (checked) => toggle(o.value, checked),
|
|
6094
|
+
children: o.label
|
|
6095
|
+
},
|
|
6096
|
+
o.value
|
|
6097
|
+
)),
|
|
6098
|
+
children
|
|
6099
|
+
]
|
|
6100
|
+
}
|
|
6101
|
+
);
|
|
6102
|
+
});
|
|
6103
|
+
CheckboxGroup.displayName = "CheckboxGroup";
|
|
6063
6104
|
var CheckboxCard = react.forwardRef(
|
|
6064
6105
|
function CheckboxCard2({
|
|
6065
6106
|
title,
|
|
@@ -10091,8 +10132,8 @@ var Drawer = react.forwardRef(function Drawer2({
|
|
|
10091
10132
|
title,
|
|
10092
10133
|
placement,
|
|
10093
10134
|
side,
|
|
10094
|
-
width =
|
|
10095
|
-
height =
|
|
10135
|
+
width = "50%",
|
|
10136
|
+
height = "50%",
|
|
10096
10137
|
size = "default",
|
|
10097
10138
|
closable = true,
|
|
10098
10139
|
maskClosable = true,
|
|
@@ -10700,6 +10741,7 @@ exports.ChartLegend = ChartLegend;
|
|
|
10700
10741
|
exports.ChartTooltip = ChartTooltip;
|
|
10701
10742
|
exports.Checkbox = Checkbox;
|
|
10702
10743
|
exports.CheckboxCard = CheckboxCard;
|
|
10744
|
+
exports.CheckboxGroup = CheckboxGroup;
|
|
10703
10745
|
exports.Chip = Chip;
|
|
10704
10746
|
exports.CircularProgress = CircularProgress;
|
|
10705
10747
|
exports.CodeViewer = CodeViewer;
|
|
@@ -10827,5 +10869,5 @@ exports.useSize = useSize;
|
|
|
10827
10869
|
exports.viVN = viVN;
|
|
10828
10870
|
exports.zhCN = zhCN;
|
|
10829
10871
|
exports.zhTW = zhTW;
|
|
10830
|
-
//# sourceMappingURL=chunk-
|
|
10831
|
-
//# sourceMappingURL=chunk-
|
|
10872
|
+
//# sourceMappingURL=chunk-Y2R5PBYN.cjs.map
|
|
10873
|
+
//# sourceMappingURL=chunk-Y2R5PBYN.cjs.map
|