@atlaskit/button 16.8.4 → 16.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/button.js +26 -9
- package/dist/cjs/shared/button-base.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/button.js +20 -7
- package/dist/es2019/shared/button-base.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/button.js +26 -9
- package/dist/esm/shared/button-base.js +1 -1
- package/dist/esm/version.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/button.js
CHANGED
|
@@ -15,7 +15,7 @@ var _components = require("@atlaskit/theme/components");
|
|
|
15
15
|
var _buttonBase = _interopRequireDefault(require("./shared/button-base"));
|
|
16
16
|
var _css = require("./shared/css");
|
|
17
17
|
var _getIsOnlySingleIcon = _interopRequireDefault(require("./shared/get-is-only-single-icon"));
|
|
18
|
-
var _excluded = ["onMouseDown", "onMouseUp"];
|
|
18
|
+
var _excluded = ["appearance", "children", "iconBefore", "iconAfter", "isSelected", "onMouseDown", "onMouseUp", "shouldFitContainer", "spacing"];
|
|
19
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
21
|
var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|
@@ -29,18 +29,29 @@ var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerC
|
|
|
29
29
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
30
30
|
*/
|
|
31
31
|
var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function Button(_ref, ref) {
|
|
32
|
-
var _ref$
|
|
32
|
+
var _ref$appearance = _ref.appearance,
|
|
33
|
+
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
34
|
+
children = _ref.children,
|
|
35
|
+
iconBefore = _ref.iconBefore,
|
|
36
|
+
iconAfter = _ref.iconAfter,
|
|
37
|
+
_ref$isSelected = _ref.isSelected,
|
|
38
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
39
|
+
_ref$onMouseDown = _ref.onMouseDown,
|
|
33
40
|
providedOnMouseDown = _ref$onMouseDown === void 0 ? _noop.default : _ref$onMouseDown,
|
|
34
41
|
_ref$onMouseUp = _ref.onMouseUp,
|
|
35
42
|
providedOnMouseUp = _ref$onMouseUp === void 0 ? _noop.default : _ref$onMouseUp,
|
|
43
|
+
_ref$shouldFitContain = _ref.shouldFitContainer,
|
|
44
|
+
shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
|
|
45
|
+
_ref$spacing = _ref.spacing,
|
|
46
|
+
spacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
|
|
36
47
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
37
48
|
var _useGlobalTheme = (0, _components.useGlobalTheme)(),
|
|
38
49
|
mode = _useGlobalTheme.mode;
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
var isOnlySingleIcon = (0, _getIsOnlySingleIcon.default)({
|
|
51
|
+
children: children,
|
|
52
|
+
iconBefore: iconBefore,
|
|
53
|
+
iconAfter: iconAfter
|
|
54
|
+
});
|
|
44
55
|
var _useState = (0, _react.useState)(false),
|
|
45
56
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
46
57
|
isActive = _useState2[0],
|
|
@@ -72,13 +83,19 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
72
83
|
}, [appearance, spacing, mode, isSelected, shouldFitContainer, isOnlySingleIcon]);
|
|
73
84
|
return /*#__PURE__*/_react.default.createElement(_buttonBase.default, (0, _extends2.default)({}, rest, {
|
|
74
85
|
ref: ref,
|
|
75
|
-
|
|
86
|
+
appearance: appearance,
|
|
87
|
+
buttonCss: buttonCss,
|
|
88
|
+
children: children
|
|
76
89
|
// Due to how click events are set, we need to set active styles
|
|
77
90
|
// manually in Firefox and wrap onMouseDown/onMouseUp
|
|
78
91
|
,
|
|
79
92
|
"data-firefox-is-active": isActive ? true : undefined,
|
|
93
|
+
iconAfter: iconAfter,
|
|
94
|
+
iconBefore: iconBefore,
|
|
95
|
+
isSelected: isSelected,
|
|
80
96
|
onMouseDown: onMouseDown,
|
|
81
|
-
onMouseUp: onMouseUp
|
|
97
|
+
onMouseUp: onMouseUp,
|
|
98
|
+
spacing: spacing
|
|
82
99
|
}));
|
|
83
100
|
}));
|
|
84
101
|
|
|
@@ -96,7 +96,7 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
|
|
|
96
96
|
action: 'clicked',
|
|
97
97
|
componentName: 'button',
|
|
98
98
|
packageName: "@atlaskit/button",
|
|
99
|
-
packageVersion: "16.8.
|
|
99
|
+
packageVersion: "16.8.5",
|
|
100
100
|
analyticsData: analyticsContext
|
|
101
101
|
});
|
|
102
102
|
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/button.js
CHANGED
|
@@ -16,18 +16,25 @@ const isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowe
|
|
|
16
16
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
17
17
|
*/
|
|
18
18
|
const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button({
|
|
19
|
+
appearance = 'default',
|
|
20
|
+
children,
|
|
21
|
+
iconBefore,
|
|
22
|
+
iconAfter,
|
|
23
|
+
isSelected = false,
|
|
19
24
|
onMouseDown: providedOnMouseDown = noop,
|
|
20
25
|
onMouseUp: providedOnMouseUp = noop,
|
|
26
|
+
shouldFitContainer = false,
|
|
27
|
+
spacing = 'default',
|
|
21
28
|
...rest
|
|
22
29
|
}, ref) {
|
|
23
30
|
const {
|
|
24
31
|
mode
|
|
25
32
|
} = useGlobalTheme();
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
const isOnlySingleIcon = getIsOnlySingleIcon({
|
|
34
|
+
children,
|
|
35
|
+
iconBefore,
|
|
36
|
+
iconAfter
|
|
37
|
+
});
|
|
31
38
|
const [isActive, setIsActive] = useState(false);
|
|
32
39
|
|
|
33
40
|
// Wrap onMouseDown / onMouseUp to manually trigger active state
|
|
@@ -54,13 +61,19 @@ const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function B
|
|
|
54
61
|
}), [appearance, spacing, mode, isSelected, shouldFitContainer, isOnlySingleIcon]);
|
|
55
62
|
return /*#__PURE__*/React.createElement(ButtonBase, _extends({}, rest, {
|
|
56
63
|
ref: ref,
|
|
57
|
-
|
|
64
|
+
appearance: appearance,
|
|
65
|
+
buttonCss: buttonCss,
|
|
66
|
+
children: children
|
|
58
67
|
// Due to how click events are set, we need to set active styles
|
|
59
68
|
// manually in Firefox and wrap onMouseDown/onMouseUp
|
|
60
69
|
,
|
|
61
70
|
"data-firefox-is-active": isActive ? true : undefined,
|
|
71
|
+
iconAfter: iconAfter,
|
|
72
|
+
iconBefore: iconBefore,
|
|
73
|
+
isSelected: isSelected,
|
|
62
74
|
onMouseDown: onMouseDown,
|
|
63
|
-
onMouseUp: onMouseUp
|
|
75
|
+
onMouseUp: onMouseUp,
|
|
76
|
+
spacing: spacing
|
|
64
77
|
}));
|
|
65
78
|
}));
|
|
66
79
|
|
|
@@ -84,7 +84,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
84
84
|
action: 'clicked',
|
|
85
85
|
componentName: 'button',
|
|
86
86
|
packageName: "@atlaskit/button",
|
|
87
|
-
packageVersion: "16.8.
|
|
87
|
+
packageVersion: "16.8.5",
|
|
88
88
|
analyticsData: analyticsContext
|
|
89
89
|
});
|
|
90
90
|
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/button.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["onMouseDown", "onMouseUp"];
|
|
4
|
+
var _excluded = ["appearance", "children", "iconBefore", "iconAfter", "isSelected", "onMouseDown", "onMouseUp", "shouldFitContainer", "spacing"];
|
|
5
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
import noop from '@atlaskit/ds-lib/noop';
|
|
7
7
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
@@ -19,18 +19,29 @@ var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerC
|
|
|
19
19
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
20
20
|
*/
|
|
21
21
|
var Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
|
|
22
|
-
var _ref$
|
|
22
|
+
var _ref$appearance = _ref.appearance,
|
|
23
|
+
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
24
|
+
children = _ref.children,
|
|
25
|
+
iconBefore = _ref.iconBefore,
|
|
26
|
+
iconAfter = _ref.iconAfter,
|
|
27
|
+
_ref$isSelected = _ref.isSelected,
|
|
28
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
29
|
+
_ref$onMouseDown = _ref.onMouseDown,
|
|
23
30
|
providedOnMouseDown = _ref$onMouseDown === void 0 ? noop : _ref$onMouseDown,
|
|
24
31
|
_ref$onMouseUp = _ref.onMouseUp,
|
|
25
32
|
providedOnMouseUp = _ref$onMouseUp === void 0 ? noop : _ref$onMouseUp,
|
|
33
|
+
_ref$shouldFitContain = _ref.shouldFitContainer,
|
|
34
|
+
shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
|
|
35
|
+
_ref$spacing = _ref.spacing,
|
|
36
|
+
spacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
|
|
26
37
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
27
38
|
var _useGlobalTheme = useGlobalTheme(),
|
|
28
39
|
mode = _useGlobalTheme.mode;
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
var isOnlySingleIcon = getIsOnlySingleIcon({
|
|
41
|
+
children: children,
|
|
42
|
+
iconBefore: iconBefore,
|
|
43
|
+
iconAfter: iconAfter
|
|
44
|
+
});
|
|
34
45
|
var _useState = useState(false),
|
|
35
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36
47
|
isActive = _useState2[0],
|
|
@@ -62,13 +73,19 @@ var Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function But
|
|
|
62
73
|
}, [appearance, spacing, mode, isSelected, shouldFitContainer, isOnlySingleIcon]);
|
|
63
74
|
return /*#__PURE__*/React.createElement(ButtonBase, _extends({}, rest, {
|
|
64
75
|
ref: ref,
|
|
65
|
-
|
|
76
|
+
appearance: appearance,
|
|
77
|
+
buttonCss: buttonCss,
|
|
78
|
+
children: children
|
|
66
79
|
// Due to how click events are set, we need to set active styles
|
|
67
80
|
// manually in Firefox and wrap onMouseDown/onMouseUp
|
|
68
81
|
,
|
|
69
82
|
"data-firefox-is-active": isActive ? true : undefined,
|
|
83
|
+
iconAfter: iconAfter,
|
|
84
|
+
iconBefore: iconBefore,
|
|
85
|
+
isSelected: isSelected,
|
|
70
86
|
onMouseDown: onMouseDown,
|
|
71
|
-
onMouseUp: onMouseUp
|
|
87
|
+
onMouseUp: onMouseUp,
|
|
88
|
+
spacing: spacing
|
|
72
89
|
}));
|
|
73
90
|
}));
|
|
74
91
|
|
|
@@ -87,7 +87,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
87
87
|
action: 'clicked',
|
|
88
88
|
componentName: 'button',
|
|
89
89
|
packageName: "@atlaskit/button",
|
|
90
|
-
packageVersion: "16.8.
|
|
90
|
+
packageVersion: "16.8.5",
|
|
91
91
|
analyticsData: analyticsContext
|
|
92
92
|
});
|
|
93
93
|
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED