TransBtn.js
1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var TransBtn = function TransBtn(_ref) {
var className = _ref.className,
customizeIcon = _ref.customizeIcon,
customizeIconProps = _ref.customizeIconProps,
_onMouseDown = _ref.onMouseDown,
onClick = _ref.onClick,
children = _ref.children;
var icon;
if (typeof customizeIcon === 'function') {
icon = customizeIcon(customizeIconProps);
} else {
icon = customizeIcon;
}
return React.createElement("span", {
className: className,
onMouseDown: function onMouseDown(event) {
event.preventDefault();
if (_onMouseDown) {
_onMouseDown(event);
}
},
style: {
userSelect: 'none',
WebkitUserSelect: 'none'
},
unselectable: "on",
onClick: onClick,
"aria-hidden": true
}, icon !== undefined ? icon : React.createElement("span", {
className: (0, _classnames.default)(className.split(/\s+/).map(function (cls) {
return "".concat(cls, "-icon");
}))
}, children));
};
var _default = TransBtn;
exports.default = _default;