@ctlyst.id/internal-ui 4.2.4 → 4.2.6
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/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.d.mts
CHANGED
@@ -161,6 +161,7 @@ interface CheckboxComponentProps extends CheckboxProps, PropsWithChildren {
|
|
161
161
|
helpText?: string;
|
162
162
|
errorText?: string;
|
163
163
|
boxProps?: BoxProps;
|
164
|
+
animated?: boolean;
|
164
165
|
}
|
165
166
|
declare const CheckboxComponent: _chakra_ui_react.ComponentWithAs<"input", CheckboxComponentProps>;
|
166
167
|
|
package/dist/index.d.ts
CHANGED
@@ -161,6 +161,7 @@ interface CheckboxComponentProps extends CheckboxProps, PropsWithChildren {
|
|
161
161
|
helpText?: string;
|
162
162
|
errorText?: string;
|
163
163
|
boxProps?: BoxProps;
|
164
|
+
animated?: boolean;
|
164
165
|
}
|
165
166
|
declare const CheckboxComponent: _chakra_ui_react.ComponentWithAs<"input", CheckboxComponentProps>;
|
166
167
|
|
package/dist/index.js
CHANGED
@@ -840,22 +840,16 @@ var import_react13 = require("@chakra-ui/react");
|
|
840
840
|
var Icon = __toESM(require("@ctlyst.id/internal-icon"));
|
841
841
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
842
842
|
var CheckboxComponent = (0, import_react13.forwardRef)(
|
843
|
-
({ isError = false, helpText, errorText, boxProps, children, isDisabled, ...rest }, ref) => {
|
843
|
+
({ isError = false, animated = false, helpText, errorText, boxProps, children, isDisabled, ...rest }, ref) => {
|
844
844
|
const { state } = (0, import_react13.useCheckbox)(rest);
|
845
845
|
const variant = isError ? "errors" : "unstyled";
|
846
|
+
const renderIcon2 = () => {
|
847
|
+
if (state.isChecked) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon.Check, { size: 3, color: "inherit" });
|
848
|
+
if (state.isIndeterminate) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon.MinusLine, { size: 3, color: "inherit" });
|
849
|
+
return void 0;
|
850
|
+
};
|
846
851
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react13.Box, { children: [
|
847
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react13.Box, { display: "flex", ...boxProps, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
848
|
-
import_react13.Checkbox,
|
849
|
-
{
|
850
|
-
variant,
|
851
|
-
ref,
|
852
|
-
...rest,
|
853
|
-
isDisabled,
|
854
|
-
color: "white",
|
855
|
-
icon: state.isIndeterminate ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon.MinusLine, { size: 3, color: "inherit" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon.Check, { size: 3, color: "inherit" }),
|
856
|
-
children: children && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react13.Text, { as: "span", display: "block", textStyle: "text.sm", color: isDisabled ? "black.medium" : "black.high", children })
|
857
|
-
}
|
858
|
-
) }),
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react13.Box, { display: "flex", ...boxProps, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react13.Checkbox, { variant, ref, ...rest, isDisabled, color: "white", icon: renderIcon2(), children: children && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react13.Text, { as: "span", display: "block", textStyle: "text.sm", color: isDisabled ? "black.medium" : "black.high", children }) }) }),
|
859
853
|
(isError && errorText || helpText) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react13.Box, { mt: "1", ml: "6", children: isError ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react13.Text, { as: "span", display: "block", textStyle: "text.xs", color: "danger.500", children: errorText }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react13.Text, { as: "span", display: "block", textStyle: "text.xs", color: "black.medium", children: helpText }) })
|
860
854
|
] });
|
861
855
|
}
|