@liveblocks/react-ui
Version:
A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.
64 lines (60 loc) • 1.87 kB
JavaScript
"use client";
import { jsx, jsxs } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import { ChevronDownIcon } from '../../icons/ChevronDown.js';
import { cn } from '../../utils/cn.js';
const CustomButton = forwardRef(
({
variant = "default",
size = "default",
disableable = true,
className,
children,
...props
}, forwardedRef) => {
return /* @__PURE__ */ jsx(
"button",
{
type: "button",
className: cn(
"lb-button",
!disableable && "lb-button:non-disableable",
className
),
"data-variant": variant,
"data-size": size,
...props,
ref: forwardedRef,
children
}
);
}
);
const Button = forwardRef(
({ icon, children, ...props }, forwardedRef) => {
return /* @__PURE__ */ jsxs(CustomButton, { ...props, ref: forwardedRef, children: [
icon ? /* @__PURE__ */ jsx("span", { className: "lb-icon-container", children: icon }) : null,
children ? /* @__PURE__ */ jsx("span", { className: "lb-button-label", children }) : null
] });
}
);
const SelectButton = forwardRef(
({ icon, children, className, ...props }, forwardedRef) => {
return /* @__PURE__ */ jsxs(
CustomButton,
{
...props,
type: "button",
className: cn("lb-select-button", className),
ref: forwardedRef,
children: [
icon ? /* @__PURE__ */ jsx("span", { className: "lb-icon-container", children: icon }) : null,
children ? /* @__PURE__ */ jsx("span", { className: "lb-button-label", children }) : null,
/* @__PURE__ */ jsx("span", { className: "lb-select-button-chevron", children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) })
]
}
);
}
);
export { Button, CustomButton, SelectButton };
//# sourceMappingURL=Button.js.map