@ctlyst.id/internal-ui 4.2.4 → 4.2.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
@@ -461,22 +461,16 @@ import { Box as Box5, Checkbox, forwardRef as forwardRef7, Text as Text2, useChe
|
|
461
461
|
import * as Icon from "@ctlyst.id/internal-icon";
|
462
462
|
import { jsx as jsx16, jsxs as jsxs2 } from "react/jsx-runtime";
|
463
463
|
var CheckboxComponent = forwardRef7(
|
464
|
-
({ isError = false, helpText, errorText, boxProps, children, isDisabled, ...rest }, ref) => {
|
464
|
+
({ isError = false, animated = false, helpText, errorText, boxProps, children, isDisabled, ...rest }, ref) => {
|
465
465
|
const { state } = useCheckbox(rest);
|
466
466
|
const variant = isError ? "errors" : "unstyled";
|
467
|
+
const renderIcon2 = () => {
|
468
|
+
if (state.isChecked) return /* @__PURE__ */ jsx16(Icon.Check, { size: 3, color: "inherit" });
|
469
|
+
if (state.isIndeterminate) return /* @__PURE__ */ jsx16(Icon.MinusLine, { size: 3, color: "inherit" });
|
470
|
+
return void 0;
|
471
|
+
};
|
467
472
|
return /* @__PURE__ */ jsxs2(Box5, { children: [
|
468
|
-
/* @__PURE__ */ jsx16(Box5, { display: "flex", ...boxProps, children: /* @__PURE__ */ jsx16(
|
469
|
-
Checkbox,
|
470
|
-
{
|
471
|
-
variant,
|
472
|
-
ref,
|
473
|
-
...rest,
|
474
|
-
isDisabled,
|
475
|
-
color: "white",
|
476
|
-
icon: state.isIndeterminate ? /* @__PURE__ */ jsx16(Icon.MinusLine, { size: 3, color: "inherit" }) : /* @__PURE__ */ jsx16(Icon.Check, { size: 3, color: "inherit" }),
|
477
|
-
children: children && /* @__PURE__ */ jsx16(Text2, { as: "span", display: "block", textStyle: "text.sm", color: isDisabled ? "black.medium" : "black.high", children })
|
478
|
-
}
|
479
|
-
) }),
|
473
|
+
/* @__PURE__ */ jsx16(Box5, { display: "flex", ...boxProps, children: /* @__PURE__ */ jsx16(Checkbox, { variant, ref, ...rest, isDisabled, color: "white", icon: renderIcon2(), children: children && /* @__PURE__ */ jsx16(Text2, { as: "span", display: "block", textStyle: "text.sm", color: isDisabled ? "black.medium" : "black.high", children }) }) }),
|
480
474
|
(isError && errorText || helpText) && /* @__PURE__ */ jsx16(Box5, { mt: "1", ml: "6", children: isError ? /* @__PURE__ */ jsx16(Text2, { as: "span", display: "block", textStyle: "text.xs", color: "danger.500", children: errorText }) : /* @__PURE__ */ jsx16(Text2, { as: "span", display: "block", textStyle: "text.xs", color: "black.medium", children: helpText }) })
|
481
475
|
] });
|
482
476
|
}
|