UNPKG

@helpwave/hightide

Version:

helpwave's component and theming library

83 lines (82 loc) 2.62 kB
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/loading-states/ProgressIndicator.tsx var ProgressIndicator_exports = {}; __export(ProgressIndicator_exports, { ProgressIndicator: () => ProgressIndicator }); module.exports = __toCommonJS(ProgressIndicator_exports); var import_jsx_runtime = require("react/jsx-runtime"); var sizeMapping = { small: 16, medium: 24, big: 48 }; var ProgressIndicator = ({ progress, strokeWidth = 5, size = "medium", direction = "counterclockwise", rotation = 0 }) => { const currentSize = sizeMapping[size]; const center = currentSize / 2; const radius = center - strokeWidth / 2; const arcLength = 2 * Math.PI * radius; const arcOffset = arcLength * progress; if (direction === "clockwise") { rotation += 360 * progress; } return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)( "svg", { style: { height: `${currentSize}px`, width: `${currentSize}px`, transform: `rotate(${rotation}deg)` }, children: [ /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "circle", { cx: center, cy: center, r: radius, fill: "transparent", strokeWidth, className: "stroke-progress-indicator-fill" } ), /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "circle", { cx: center, cy: center, r: radius, fill: "transparent", strokeWidth, strokeDasharray: arcLength, strokeDashoffset: arcOffset, className: "stroke-progress-indicator-background" } ) ] } ); }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { ProgressIndicator }); //# sourceMappingURL=ProgressIndicator.js.map