UNPKG

@coveord/plasma-mantine

Version:

A Plasma flavoured Mantine theme

27 lines (26 loc) 1.23 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { Button as MantineButton, polymorphicFactory } from '@mantine/core'; import { useClickWithLoading } from '../../hooks/useClickWithLoading'; import { ButtonWithDisabledTooltip } from './ButtonWithDisabledTooltip'; export const Button = polymorphicFactory(({ disabledTooltip, disabled, disabledTooltipProps, loading, onClick, 'data-disabled': dataDisabled, ...others }, ref)=>{ const { isLoading, handleClick } = useClickWithLoading(onClick); return /*#__PURE__*/ _jsx(ButtonWithDisabledTooltip, { disabled: disabled || dataDisabled, disabledTooltip: disabledTooltip, disabledTooltipProps: disabledTooltipProps, fullWidth: others.fullWidth, children: /*#__PURE__*/ _jsx(MantineButton, { loaderProps: { variant: 'oval' }, ref: ref, loading: isLoading || loading, onClick: dataDisabled ? (e)=>e.preventDefault() : handleClick, disabled: disabled || dataDisabled, "data-loading": isLoading || loading || undefined, ...others }) }); }); Button.Group = MantineButton.Group; //# sourceMappingURL=Button.js.map