fomantic-ui-react
Version:
Fomantic-UI React -- A React Component Library.
66 lines (56 loc) • 2.97 kB
JavaScript
/**
* fomantic-ui-react v0.0.1-alpha.10
* (c) 2022 FireLoong <fireloong@foxmail.com>
* @license MIT
*/
import { _ as _defineProperty, a as _objectWithoutProperties } from '../_chunks/dep-9f1126c1.js';
import React, { createElement } from 'react';
import classNames from 'classnames';
import forwardRefWithStatics from '../_util/forwardRefWithStatics.js';
import { Icon } from '../icon/index.js';
import ButtonContent from './ButtonContent.js';
import 'hoist-non-react-statics';
import '../icon/Icon.js';
import './style/css.js';
import '../icon/type.js';
var _excluded = ["as", "size", "compact", "disabled", "animated", "basic", "color", "icon", "content", "className", "children", "onClick"];
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var Button = forwardRefWithStatics(function (_ref, ref) {
var _classNames;
var _ref$as = _ref.as,
as = _ref$as === void 0 ? "button" : _ref$as,
size = _ref.size,
compact = _ref.compact,
disabled = _ref.disabled,
animated = _ref.animated,
basic = _ref.basic,
color = _ref.color,
icon = _ref.icon,
content = _ref.content,
className = _ref.className,
children = _ref.children,
onClick = _ref.onClick,
props = _objectWithoutProperties(_ref, _excluded);
if (!as) {
as = "div";
}
if (typeof icon === "string") {
children = /* @__PURE__ */React.createElement(Icon, {
name: icon
});
}
return /*#__PURE__*/createElement(as, _objectSpread({
ref: ref,
onClick: !disabled ? onClick : void 0,
className: classNames("ui", "button", (_classNames = {
basic: basic,
compact: compact
}, _defineProperty(_classNames, color, color), _defineProperty(_classNames, size, size), _defineProperty(_classNames, "disabled", disabled), _defineProperty(_classNames, "animated", animated), _defineProperty(_classNames, animated, animated && typeof animated === "string"), _defineProperty(_classNames, "icon", icon), _classNames), className)
}, props), children || content);
}, {
Content: ButtonContent
});
Button.displayName = "Button";
export { Button as default };
//# sourceMappingURL=Button.js.map