@hitachivantara/uikit-react-core
Version:
UI Kit Core React components.
35 lines (34 loc) • 1.32 kB
JavaScript
import { range } from "../utils/helpers.js";
import { useClasses } from "./Loading.styles.js";
import { getColor } from "@hitachivantara/uikit-styles";
import { mergeStyles, useDefaultProps } from "@hitachivantara/uikit-react-utils";
import { forwardRef } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/Loading/Loading.tsx
/**
* Loading provides feedback about a process that is taking place in the application.
*/
var HvLoading = forwardRef(function HvLoading(props, ref) {
const { color, hidden, small, label, classes: classesProp, style, className, ...others } = useDefaultProps("HvLoading", props);
const { classes, cx } = useClasses(classesProp);
return /* @__PURE__ */ jsxs("div", {
ref,
hidden: !!hidden,
"data-size": small ? "small" : "regular",
style: mergeStyles(style, {
color: getColor(color, small ? "text" : "brand"),
"--customColor": getColor(color)
}),
className: cx(classes.root, { [classes.hidden]: hidden }, className),
...others,
children: [/* @__PURE__ */ jsx("div", {
className: classes.barContainer,
children: range(3).map((e) => /* @__PURE__ */ jsx("div", { className: classes.loadingBar }, e))
}), label && /* @__PURE__ */ jsx("div", {
className: classes.label,
children: label
})]
});
});
//#endregion
export { HvLoading };