@intility/bifrost-react-select
Version:
React select component for Intility's design system, Bifrost.
54 lines • 1.61 kB
JavaScript
import { c as _c } from "react-compiler-runtime";
import { components } from "react-select";
import { faSquare } from "@fortawesome/free-regular-svg-icons/faSquare";
import { faCheckSquare } from "@fortawesome/free-solid-svg-icons/faCheckSquare";
import { faCheck } from "@fortawesome/free-solid-svg-icons/faCheck";
import { Icon } from "@intility/bifrost-react";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const CustomOption = props => {
const $ = _c(10);
let t0;
if ($[0] !== props.isMulti || $[1] !== props.isSelected) {
t0 = props.isMulti && /*#__PURE__*/_jsx("div", {
children: /*#__PURE__*/_jsx(Icon, {
icon: props.isSelected ? faCheckSquare : faSquare,
marginRight: true,
color: props.isSelected ? "var(--bfc-theme)" : "var(--bfc-base-c-2)"
})
});
$[0] = props.isMulti;
$[1] = props.isSelected;
$[2] = t0;
} else {
t0 = $[2];
}
let t1;
if ($[3] !== props.isMulti || $[4] !== props.isSelected) {
t1 = !props.isMulti && props.isSelected && /*#__PURE__*/_jsx("div", {
children: /*#__PURE__*/_jsx(Icon, {
icon: faCheck,
className: "bf-select-selected-icon"
})
});
$[3] = props.isMulti;
$[4] = props.isSelected;
$[5] = t1;
} else {
t1 = $[5];
}
let t2;
if ($[6] !== props || $[7] !== t0 || $[8] !== t1) {
t2 = /*#__PURE__*/_jsxs(components.Option, {
...props,
children: [t0, props.children, t1]
});
$[6] = props;
$[7] = t0;
$[8] = t1;
$[9] = t2;
} else {
t2 = $[9];
}
return t2;
};
export default CustomOption;