UNPKG

@helpwave/hightide

Version:

helpwave's component and theming library

59 lines 1.49 kB
// src/components/loading-states/ProgressIndicator.tsx import { jsx, jsxs } from "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__ */ jsxs( "svg", { style: { height: `${currentSize}px`, width: `${currentSize}px`, transform: `rotate(${rotation}deg)` }, children: [ /* @__PURE__ */ jsx( "circle", { cx: center, cy: center, r: radius, fill: "transparent", strokeWidth, className: "stroke-progress-indicator-fill" } ), /* @__PURE__ */ jsx( "circle", { cx: center, cy: center, r: radius, fill: "transparent", strokeWidth, strokeDasharray: arcLength, strokeDashoffset: arcOffset, className: "stroke-progress-indicator-background" } ) ] } ); }; export { ProgressIndicator }; //# sourceMappingURL=ProgressIndicator.mjs.map