40 lines
2.2 KiB
JavaScript
40 lines
2.2 KiB
JavaScript
|
"use strict";
|
||
|
|
||
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.default = void 0;
|
||
|
var React = _interopRequireWildcard(require("react"));
|
||
|
var _classnames = _interopRequireDefault(require("classnames"));
|
||
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||
|
var TransBtn = function TransBtn(props) {
|
||
|
var className = props.className,
|
||
|
customizeIcon = props.customizeIcon,
|
||
|
customizeIconProps = props.customizeIconProps,
|
||
|
children = props.children,
|
||
|
_onMouseDown = props.onMouseDown,
|
||
|
onClick = props.onClick;
|
||
|
var icon = typeof customizeIcon === 'function' ? customizeIcon(customizeIconProps) : customizeIcon;
|
||
|
return /*#__PURE__*/React.createElement("span", {
|
||
|
className: className,
|
||
|
onMouseDown: function onMouseDown(event) {
|
||
|
event.preventDefault();
|
||
|
_onMouseDown === null || _onMouseDown === void 0 || _onMouseDown(event);
|
||
|
},
|
||
|
style: {
|
||
|
userSelect: 'none',
|
||
|
WebkitUserSelect: 'none'
|
||
|
},
|
||
|
unselectable: "on",
|
||
|
onClick: onClick,
|
||
|
"aria-hidden": true
|
||
|
}, icon !== undefined ? icon : /*#__PURE__*/React.createElement("span", {
|
||
|
className: (0, _classnames.default)(className.split(/\s+/).map(function (cls) {
|
||
|
return "".concat(cls, "-icon");
|
||
|
}))
|
||
|
}, children));
|
||
|
};
|
||
|
var _default = exports.default = TransBtn;
|