UNPKG

2.22 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4var _typeof = require("@babel/runtime/helpers/typeof");
5Object.defineProperty(exports, "__esModule", {
6 value: true
7});
8exports.default = void 0;
9var React = _interopRequireWildcard(require("react"));
10var _classnames = _interopRequireDefault(require("classnames"));
11function _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); }
12function _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; }
13var TransBtn = function TransBtn(props) {
14 var className = props.className,
15 customizeIcon = props.customizeIcon,
16 customizeIconProps = props.customizeIconProps,
17 children = props.children,
18 _onMouseDown = props.onMouseDown,
19 onClick = props.onClick;
20 var icon = typeof customizeIcon === 'function' ? customizeIcon(customizeIconProps) : customizeIcon;
21 return /*#__PURE__*/React.createElement("span", {
22 className: className,
23 onMouseDown: function onMouseDown(event) {
24 event.preventDefault();
25 _onMouseDown === null || _onMouseDown === void 0 || _onMouseDown(event);
26 },
27 style: {
28 userSelect: 'none',
29 WebkitUserSelect: 'none'
30 },
31 unselectable: "on",
32 onClick: onClick,
33 "aria-hidden": true
34 }, icon !== undefined ? icon : /*#__PURE__*/React.createElement("span", {
35 className: (0, _classnames.default)(className.split(/\s+/).map(function (cls) {
36 return "".concat(cls, "-icon");
37 }))
38 }, children));
39};
40var _default = exports.default = TransBtn;
\No newline at end of file