UNPKG

@drivy/cobalt

Version:

Opinionated design system for Drivy's projects.

74 lines (73 loc) 2.44 kB
import { jsx } from "react/jsx-runtime"; import classnames from "classnames"; import { forwardRef } from "react"; import ButtonComponent from "../ButtonComponent.js"; import { getButtonCommonClassNames, getButtonContent } from "../helpers.js"; const getComputedClassName = ({ className, standalone, destructive })=>classnames(className, "cob-Button__ghost", { "cob-Button__ghost--standalone": standalone, "cob-Button__ghost--destructive": destructive }); const _GhostButton = /*#__PURE__*/ forwardRef((props, ref)=>{ const { children, standalone, destructive, icon, iconPosition, className, loading, disabled, rounded, size, fullWidth, ...restButtonProps } = props; const content = getButtonContent({ children, icon, iconPosition }); const isDisabled = disabled || loading; const buttonClassNames = getButtonCommonClassNames({ disabled: isDisabled, rounded, size, fullWidth, className }); return /*#__PURE__*/ jsx(ButtonComponent, { ...restButtonProps, className: getComputedClassName({ className: buttonClassNames, standalone, destructive }), ref: ref, loading: loading, disabled: isDisabled, children: content }); }); _GhostButton.displayName = "GhostButton"; const GhostLink = /*#__PURE__*/ forwardRef((props, ref)=>{ const { children, standalone, destructive, icon, iconPosition, className, loading, disabled, rounded, size, fullWidth, ...restLinkProps } = props; const content = getButtonContent({ children, icon, iconPosition }); const isDisabled = disabled || loading; const buttonClassNames = getButtonCommonClassNames({ disabled: isDisabled, rounded, size, fullWidth, className }); return /*#__PURE__*/ jsx(ButtonComponent.Link, { ...restLinkProps, className: getComputedClassName({ className: buttonClassNames, standalone, destructive }), ref: ref, loading: loading, disabled: isDisabled, children: content }); }); GhostLink.displayName = "GhostLink"; const GhostButton = Object.assign(_GhostButton, { Link: GhostLink }); const Buttons_GhostButton = GhostButton; export default Buttons_GhostButton; //# sourceMappingURL=index.js.map