@hitachivantara/uikit-react-core
Version:
UI Kit Core React components.
43 lines (42 loc) • 1.25 kB
JavaScript
import { HvTypography } from "../../Typography/Typography.js";
import { HvBaseSwitch } from "../../BaseSwitch/BaseSwitch.js";
import { createClasses } from "@hitachivantara/uikit-react-utils";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
//#region src/Table/renderers/SwitchColumnCell.tsx
var switchStyle = {
cursor: "pointer",
display: "inline-flex",
marginLeft: "10px"
};
var { useClasses } = createClasses("HvSwitchColumnCell", {
switchNo: switchStyle,
switchYes: switchStyle
});
var HvSwitchColumnCell = ({ checked, value, switchLabel, falseLabel, trueLabel, switchProps }) => {
const { classes } = useClasses();
return /* @__PURE__ */ jsxs(Fragment, { children: [
falseLabel != null && /* @__PURE__ */ jsx(HvTypography, {
"aria-hidden": "true",
variant: "body",
className: classes.switchNo,
children: falseLabel
}),
/* @__PURE__ */ jsx(HvBaseSwitch, {
checked,
value,
...switchProps,
inputProps: {
"aria-label": switchLabel,
...switchProps?.inputProps
}
}),
trueLabel != null && /* @__PURE__ */ jsx(HvTypography, {
"aria-hidden": "true",
variant: "body",
className: classes.switchYes,
children: trueLabel
})
] });
};
//#endregion
export { HvSwitchColumnCell };