@prokodo/ui
Version:
UI components for production-grade Next.js + Headless CMS (Strapi, Contentful, Headless WordPress) websites by prokodo – built for Core Web Vitals & SEO.
32 lines (31 loc) • 1.13 kB
JavaScript
"use client";
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
import { forwardRef } from "react";
import LinkClient from "../link/Link.client.js";
import { ButtonView } from "./Button.view.js";
import { Loading } from "../loading/Loading.js";
function ButtonClient(props, ref) {
const { loading, iconProps = {}, ...rest } = props;
const isIconOnly = typeof (iconProps == null ? void 0 : iconProps.name) === "string" && !props.title;
const finalIconProps = Boolean(loading) ? { name: void 0 } : iconProps;
return /* @__PURE__ */ jsxs(Fragment, { children: [
Boolean(loading) && /* @__PURE__ */ jsx(Loading, { size: "xs" }),
/* @__PURE__ */ jsx(
ButtonView,
{
...rest,
buttonRef: ref,
iconProps: finalIconProps,
isIconOnly: Boolean(isIconOnly),
LinkComponent: LinkClient
}
)
] });
}
__name(ButtonClient, "ButtonClient");
const ButtonClient$1 = forwardRef(ButtonClient);
export {
ButtonClient$1 as default
};