UNPKG

@abgov/react-components

Version:

Government of Alberta - UI components for React

82 lines (81 loc) 1.66 kB
import { jsxs, jsx } from "react/jsx-runtime"; import { useRef, useEffect } from "react"; function GoabDrawer({ position, open, heading, maxSize, testId, actions, children, onClose }) { const el = useRef(null); 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__ */ 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__ */ jsx("div", { slot: "heading", children: heading }), actions && /* @__PURE__ */ 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__ */ 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 } ); } export { GoabDrawer as G, GoabIcon as a }; //# sourceMappingURL=icon-CoYGOp1V.mjs.map