@yamada-ui/loading
Version:
Yamada UI loading components
110 lines (108 loc) • 2.57 kB
JavaScript
"use client"
import {
Puff
} from "./chunk-6ABSWRDW.mjs";
import {
Rings
} from "./chunk-UNGG65VC.mjs";
import {
Audio
} from "./chunk-R2NCPADX.mjs";
import {
Circles
} from "./chunk-WR5N6GYL.mjs";
import {
Dots
} from "./chunk-ZKBS5FOC.mjs";
import {
Grid
} from "./chunk-FUGHYPVJ.mjs";
import {
Oval
} from "./chunk-RK3NNOXX.mjs";
// src/loading.tsx
import {
forwardRef,
mergeVars,
omitThemeProps,
useComponentStyle
} from "@yamada-ui/core";
import { cx } from "@yamada-ui/utils";
import { useMemo } from "react";
import { jsx } from "react/jsx-runtime";
var Loading = forwardRef((props, ref) => {
const [
{ color, ...styles },
{ colorScheme, size = "1em", variant = "oval", ...mergedProps }
] = useComponentStyle("Loading", props);
const {
className,
color: colorProp,
dur,
duration,
secondaryColor,
...rest
} = omitThemeProps(mergedProps);
const computedProps = useMemo(
() => {
var _a;
return {
className: cx("ui-loading", className),
size,
color: "$color",
...secondaryColor ? { secondaryColor: "$secondary-color" } : {},
duration: duration != null ? duration : dur,
__css: {
...styles,
vars: mergeVars(styles.vars, [
{
name: "color",
token: "colors",
value: (_a = colorProp != null ? colorProp : color) != null ? _a : `${colorScheme}.500`
},
{
name: "secondary-color",
token: "colors",
value: secondaryColor
}
])
},
...rest
};
},
[
className,
size,
secondaryColor,
duration,
dur,
styles,
colorProp,
color,
colorScheme,
rest
]
);
switch (variant) {
case "grid":
return /* @__PURE__ */ jsx(Grid, { ref, ...computedProps });
case "audio":
return /* @__PURE__ */ jsx(Audio, { ref, ...computedProps });
case "dots":
return /* @__PURE__ */ jsx(Dots, { ref, ...computedProps });
case "puff":
return /* @__PURE__ */ jsx(Puff, { ref, ...computedProps });
case "rings":
return /* @__PURE__ */ jsx(Rings, { ref, ...computedProps });
case "circles":
return /* @__PURE__ */ jsx(Circles, { ref, ...computedProps });
default:
return /* @__PURE__ */ jsx(Oval, { ref, ...computedProps });
}
});
Loading.displayName = "Loading";
Loading.__ui__ = "Loading";
export {
Loading
};
//# sourceMappingURL=chunk-FS4WFG6W.mjs.map