@hitachivantara/uikit-react-core
Version:
Core React components for the NEXT Design System.
56 lines (55 loc) • 1.53 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
const Typography = require("../../Typography/Typography.cjs");
const BaseSwitch = require("../../BaseSwitch/BaseSwitch.cjs");
const switchStyle = {
cursor: "pointer",
display: "inline-flex",
marginLeft: "10px"
};
const { useClasses } = uikitReactUtils.createClasses("HvSwitchColumnCell", {
switchNo: switchStyle,
switchYes: switchStyle
});
const HvSwitchColumnCell = ({
checked,
value,
switchLabel,
falseLabel,
trueLabel,
switchProps
}) => {
const { classes } = useClasses();
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
falseLabel != null && /* @__PURE__ */ jsxRuntime.jsx(
Typography.HvTypography,
{
"aria-hidden": "true",
variant: "body",
className: classes.switchNo,
children: falseLabel
}
),
/* @__PURE__ */ jsxRuntime.jsx(
BaseSwitch.HvBaseSwitch,
{
checked,
value,
...switchProps,
inputProps: { "aria-label": switchLabel, ...switchProps?.inputProps }
}
),
trueLabel != null && /* @__PURE__ */ jsxRuntime.jsx(
Typography.HvTypography,
{
"aria-hidden": "true",
variant: "body",
className: classes.switchYes,
children: trueLabel
}
)
] });
};
exports.HvSwitchColumnCell = HvSwitchColumnCell;