UNPKG

@cerberus-design/react

Version:

The Cerberus Design React component library.

136 lines (132 loc) 4.74 kB
"use strict"; "use client"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/components/notifications/match-icon.tsx var match_icon_exports = {}; __export(match_icon_exports, { MatchNotificationIcon: () => MatchNotificationIcon }); module.exports = __toCommonJS(match_icon_exports); var import_factory = require("@ark-ui/react/factory"); var import_recipes = require("styled-system/recipes"); // src/context/cerberus.tsx var import_react = require("react"); var import_jsx_runtime = require("react/jsx-runtime"); var CerberusContext = (0, import_react.createContext)(null); function useCerberusContext() { const context = (0, import_react.useContext)(CerberusContext); if (!context) { throw new Error("useCerberus must be used within a CerberusProvider"); } return context; } // src/components/spinner/spinner.tsx var import_jsx_runtime2 = require("react/jsx-runtime"); function Spinner(props) { return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "svg", { "aria-busy": "true", "data-scope": "spinner", "data-part": "root", role: "status", xmlns: "http://www.w3.org/2000/svg", height: props.size, width: props.size, viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)( "g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, children: [ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)( "path", { strokeDasharray: 16, strokeDashoffset: 16, d: "M12 3c4.97 0 9 4.03 9 9", children: [ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "animate", { fill: "freeze", attributeName: "stroke-dashoffset", dur: "0.15s", values: "16;0" } ), /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "animateTransform", { attributeName: "transform", dur: "0.75s", repeatCount: "indefinite", type: "rotate", values: "0 12 12;360 12 12" } ) ] } ), /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "path", { strokeDasharray: 64, strokeDashoffset: 64, strokeOpacity: 0.3, d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "animate", { fill: "freeze", attributeName: "stroke-dashoffset", dur: "0.6s", values: "64;0" } ) } ) ] } ) } ); } // src/components/notifications/match-icon.tsx var import_jsx_runtime3 = require("react/jsx-runtime"); function MatchNotificationIcon(props) { const { icons } = useCerberusContext(); const type = props.type || "info"; const styles = (0, import_recipes.toast)(); const key = `${type}Notification`; const Icon = icons[key] || ToastLoadingIcon; return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_factory.ark.div, { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, {}) }); } function ToastLoadingIcon() { return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Spinner, { size: "1rem" }); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { MatchNotificationIcon }); //# sourceMappingURL=match-icon.cjs.map