smart-react-components
Version:
React UI library, wide variety of editable ready to use Styled and React components.
23 lines (18 loc) • 2.05 kB
JavaScript
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var index = require('./index-6d498b59.js');
var React = require('react');
var React__default = _interopDefault(React);
var WaveEffect = require('./WaveEffect-96d9007c.js');
var Element = require('./Element-d9208356.js');
var Loading = require('./Loading-679f1816.js');
const Button = ({ size = "default", sizeSm, sizeMd, sizeLg, sizeXl, elementProps = index.DV.JSX_ELEMENT_PROPS, children, type, fill, link, border, shape, block, fixedSize, waveEffect = "light", icon, iconPosition = "left", loading, loadingStatus, loadingTransitionClassName = "src-button-loading", loadingTransitionType = "ease-in-out", loadingTransitionDuration = 300, loadingTransitionShowAnimation = true, loadingTransitionHideAnimation = true }) => {
const IconEl = icon ? React__default.createElement(Element.IconElement, { "data-src-icon-position": iconPosition }, icon) : null;
const ButtonEl = (React__default.createElement(Element.ButtonElement, Object.assign({}, elementProps, { "size$": size, "size$Sm": sizeSm, "size$Md": sizeMd, "size$Lg": sizeLg, "size$Xl": sizeXl, "type$": type, "fill$": fill, link: link, "border$": border, shape: shape, block: block, fixedSize: fixedSize, "loading$": loadingStatus }),
loading && React__default.createElement(Loading.Loading, { element: loading, status: loadingStatus, transitionClassName: loadingTransitionClassName, transitionDuration: loadingTransitionDuration, transitionType: loadingTransitionType, transitionShowAnimation: loadingTransitionShowAnimation, transitionHideAnimation: loadingTransitionHideAnimation }),
iconPosition == "left" && IconEl,
(!loading || typeof children !== "string") ? children : React__default.createElement("span", null, children),
iconPosition == "right" && IconEl));
return waveEffect ? React__default.createElement(WaveEffect.WaveEffect, { type: waveEffect }, ButtonEl) : ButtonEl;
};
exports.Button = Button;