@abgov/react-components
Version:
Government of Alberta - UI components for React
81 lines (80 loc) • 1.74 kB
JavaScript
;
const jsxRuntime = require("react/jsx-runtime");
const react = require("react");
function GoabDrawer({
position,
open,
heading,
maxSize,
testId,
actions,
children,
onClose
}) {
const el = react.useRef(null);
react.useEffect(() => {
var _a;
if (!(el == null ? void 0 : el.current) || !onClose) {
return;
}
(_a = el.current) == null ? void 0 : _a.addEventListener("_close", onClose);
return () => {
var _a2;
(_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_close", onClose);
};
}, [el, onClose]);
return /* @__PURE__ */ jsxRuntime.jsxs(
"goa-drawer",
{
ref: el,
position,
open: open ? true : void 0,
heading: typeof heading === "string" ? heading : void 0,
maxsize: maxSize,
testid: testId,
children: [
heading && typeof heading !== "string" && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "heading", children: heading }),
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "actions", children: actions }),
children
]
}
);
}
function GoabIcon({
type,
theme,
size,
inverted,
// TODO: change to boolean only
fillColor,
opacity,
title,
ariaLabel,
mt,
mr,
mb,
ml,
testId
}) {
return /* @__PURE__ */ jsxRuntime.jsx(
"goa-icon",
{
type,
theme,
size,
inverted: typeof inverted === "boolean" ? inverted ? "true" : void 0 : inverted,
fillcolor: fillColor,
opacity,
title,
arialabel: ariaLabel,
mt,
mr,
mb,
ml,
testid: testId
}
);
}
exports.GoabDrawer = GoabDrawer;
exports.GoabIcon = GoabIcon;
//# sourceMappingURL=icon-CK55b563.js.map