1 | const _excluded = ["className", "disabled", "label", "icon", "busy", "children", "spinner"];
|
2 |
|
3 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4 |
|
5 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
6 |
|
7 | import cn from 'classnames';
|
8 | import * as React from 'react';
|
9 | import { Spinner } from './Icon';
|
10 |
|
11 | function Button(_ref) {
|
12 | let {
|
13 | className,
|
14 | disabled,
|
15 | label,
|
16 | icon,
|
17 | busy,
|
18 | children,
|
19 | spinner = Spinner
|
20 | } = _ref,
|
21 | props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
22 |
|
23 | return React.createElement("button", _extends({
|
24 | tabIndex: -1
|
25 | }, props, {
|
26 | title: label,
|
27 | type: "button",
|
28 | disabled: disabled,
|
29 | "aria-label": label,
|
30 | "aria-disabled": disabled,
|
31 | className: cn(className, 'rw-btn')
|
32 | }), busy ? spinner : icon, children);
|
33 | }
|
34 |
|
35 | export default Button; |
\ | No newline at end of file |