@atlaskit/button 17.23.0 → 18.0.0
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 +9 -0
- package/dist/cjs/new-button/variants/default/button.js +1 -3
- package/dist/cjs/new-button/variants/default/link.js +1 -3
- package/dist/cjs/new-button/variants/default/use-default-button.js +4 -13
- package/dist/cjs/new-button/variants/icon/button.js +1 -3
- package/dist/cjs/new-button/variants/icon/link.js +1 -3
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +5 -13
- package/dist/cjs/new-button/variants/shared/content.js +2 -2
- package/dist/cjs/new-button/variants/shared/use-button-base.js +19 -15
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/variants/default/button.js +0 -2
- package/dist/es2019/new-button/variants/default/link.js +0 -2
- package/dist/es2019/new-button/variants/default/use-default-button.js +4 -13
- package/dist/es2019/new-button/variants/icon/button.js +0 -2
- package/dist/es2019/new-button/variants/icon/link.js +0 -2
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +4 -13
- package/dist/es2019/new-button/variants/shared/content.js +2 -2
- package/dist/es2019/new-button/variants/shared/use-button-base.js +19 -15
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/variants/default/button.js +1 -3
- package/dist/esm/new-button/variants/default/link.js +1 -3
- package/dist/esm/new-button/variants/default/use-default-button.js +4 -13
- package/dist/esm/new-button/variants/icon/button.js +1 -3
- package/dist/esm/new-button/variants/icon/link.js +1 -3
- package/dist/esm/new-button/variants/icon/use-icon-button.js +5 -13
- package/dist/esm/new-button/variants/shared/content.js +2 -2
- package/dist/esm/new-button/variants/shared/use-button-base.js +19 -15
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/new-button/variants/default/link.d.ts +1 -1
- package/dist/types/new-button/variants/default/use-default-button.d.ts +1 -1
- package/dist/types/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +1 -1
- package/dist/types/new-button/variants/shared/content.d.ts +2 -2
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +2 -2
- package/dist/types/new-button/variants/types.d.ts +0 -6
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/shared/content.d.ts +2 -2
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +2 -2
- package/dist/types-ts4.5/new-button/variants/types.d.ts +0 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 18.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#113901](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/113901)
|
|
8
|
+
[`49ea6581aea88`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/49ea6581aea88) -
|
|
9
|
+
The `overlay` prop has been removed in new buttons. It only existed in legacy buttons to support
|
|
10
|
+
loading spinners, which can be achieved in the new button using the `isLoading` prop.
|
|
11
|
+
|
|
3
12
|
## 17.23.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
|
@@ -11,7 +11,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
12
|
var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
|
|
13
13
|
var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
|
|
14
|
-
var _excluded = ["analyticsContext", "appearance", "aria-label", "aria-labelledby", "autoFocus", "children", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isLoading", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "
|
|
14
|
+
var _excluded = ["analyticsContext", "appearance", "aria-label", "aria-labelledby", "autoFocus", "children", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isLoading", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "shouldFitContainer", "spacing", "testId", "type", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"],
|
|
15
15
|
_excluded2 = ["className", "css", "as", "style"];
|
|
16
16
|
/**
|
|
17
17
|
* __Button__
|
|
@@ -45,7 +45,6 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
45
45
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
46
46
|
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
47
47
|
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
48
|
-
overlay = _ref.overlay,
|
|
49
48
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
50
49
|
spacing = _ref.spacing,
|
|
51
50
|
testId = _ref.testId,
|
|
@@ -85,7 +84,6 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
85
84
|
onPointerUpCapture: onPointerUpCapture,
|
|
86
85
|
onTouchEndCapture: onTouchEndCapture,
|
|
87
86
|
onTouchStartCapture: onTouchStartCapture,
|
|
88
|
-
overlay: overlay,
|
|
89
87
|
ref: ref,
|
|
90
88
|
shouldFitContainer: shouldFitContainer,
|
|
91
89
|
spacing: spacing,
|
|
@@ -12,7 +12,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
13
|
var _anchor = _interopRequireDefault(require("@atlaskit/primitives/anchor"));
|
|
14
14
|
var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
|
|
15
|
-
var _excluded = ["analyticsContext", "appearance", "aria-label", "aria-labelledby", "autoFocus", "children", "href", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "
|
|
15
|
+
var _excluded = ["analyticsContext", "appearance", "aria-label", "aria-labelledby", "autoFocus", "children", "href", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "shouldFitContainer", "spacing", "testId", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"],
|
|
16
16
|
_excluded2 = ["className", "css", "as", "style"];
|
|
17
17
|
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); }
|
|
18
18
|
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; }
|
|
@@ -39,7 +39,6 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
39
39
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
40
40
|
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
41
41
|
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
42
|
-
overlay = _ref.overlay,
|
|
43
42
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
44
43
|
spacing = _ref.spacing,
|
|
45
44
|
testId = _ref.testId,
|
|
@@ -76,7 +75,6 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
76
75
|
onPointerUpCapture: onPointerUpCapture,
|
|
77
76
|
onTouchEndCapture: onTouchEndCapture,
|
|
78
77
|
onTouchStartCapture: onTouchStartCapture,
|
|
79
|
-
overlay: overlay,
|
|
80
78
|
ref: ref,
|
|
81
79
|
shouldFitContainer: shouldFitContainer,
|
|
82
80
|
spacing: spacing,
|
|
@@ -9,7 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _content = _interopRequireDefault(require("../shared/content"));
|
|
11
11
|
var _iconRenderer = _interopRequireDefault(require("../shared/icon-renderer"));
|
|
12
|
-
var _loadingOverlay = _interopRequireDefault(require("../shared/loading-overlay"));
|
|
13
12
|
var _useButtonBase = _interopRequireDefault(require("../shared/use-button-base"));
|
|
14
13
|
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); }
|
|
15
14
|
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; }
|
|
@@ -47,14 +46,12 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
47
46
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
48
47
|
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
49
48
|
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
50
|
-
overlay = _ref.overlay,
|
|
51
49
|
ref = _ref.ref,
|
|
52
50
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
53
51
|
spacing = _ref.spacing,
|
|
54
52
|
testId = _ref.testId,
|
|
55
53
|
UNSAFE_iconAfter_size = _ref.UNSAFE_iconAfter_size,
|
|
56
54
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size;
|
|
57
|
-
var hasOverlay = Boolean(overlay || isLoading);
|
|
58
55
|
var baseProps = (0, _useButtonBase.default)({
|
|
59
56
|
analyticsContext: analyticsContext,
|
|
60
57
|
appearance: appearance,
|
|
@@ -65,16 +62,16 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
65
62
|
children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, iconBefore && /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
66
63
|
type: "icon",
|
|
67
64
|
position: "before",
|
|
68
|
-
|
|
65
|
+
isLoading: isLoading
|
|
69
66
|
}, /*#__PURE__*/_react.default.createElement(_iconRenderer.default, {
|
|
70
67
|
icon: iconBefore,
|
|
71
68
|
size: UNSAFE_iconBefore_size
|
|
72
69
|
})), children && /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
73
|
-
|
|
70
|
+
isLoading: isLoading
|
|
74
71
|
}, children), iconAfter && /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
75
72
|
type: "icon",
|
|
76
73
|
position: "after",
|
|
77
|
-
|
|
74
|
+
isLoading: isLoading
|
|
78
75
|
}, /*#__PURE__*/_react.default.createElement(_iconRenderer.default, {
|
|
79
76
|
icon: iconAfter,
|
|
80
77
|
size: UNSAFE_iconAfter_size
|
|
@@ -93,16 +90,10 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
93
90
|
onPointerDownCapture: onPointerDownCapture,
|
|
94
91
|
onPointerUpCapture: onPointerUpCapture,
|
|
95
92
|
onClickCapture: onClickCapture,
|
|
96
|
-
overlay: isLoading ? (0, _loadingOverlay.default)({
|
|
97
|
-
spacing: spacing,
|
|
98
|
-
appearance: appearance,
|
|
99
|
-
isDisabled: isDisabled,
|
|
100
|
-
isSelected: isSelected,
|
|
101
|
-
testId: testId
|
|
102
|
-
}) : overlay,
|
|
103
93
|
ref: ref,
|
|
104
94
|
shouldFitContainer: shouldFitContainer,
|
|
105
95
|
spacing: spacing,
|
|
96
|
+
testId: testId,
|
|
106
97
|
hasIconBefore: Boolean(iconBefore),
|
|
107
98
|
hasIconAfter: Boolean(iconAfter)
|
|
108
99
|
});
|
|
@@ -12,7 +12,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
12
12
|
var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
|
|
13
13
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
14
14
|
var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
|
|
15
|
-
var _excluded = ["aria-label", "aria-labelledby", "analyticsContext", "appearance", "autoFocus", "icon", "interactionName", "isDisabled", "isLoading", "isSelected", "isTooltipDisabled", "label", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "
|
|
15
|
+
var _excluded = ["aria-label", "aria-labelledby", "analyticsContext", "appearance", "autoFocus", "icon", "interactionName", "isDisabled", "isLoading", "isSelected", "isTooltipDisabled", "label", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "shape", "spacing", "testId", "tooltip", "type", "UNSAFE_size"],
|
|
16
16
|
_excluded2 = ["className", "css", "as", "style"];
|
|
17
17
|
/**
|
|
18
18
|
* __Icon Button__
|
|
@@ -47,7 +47,6 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
47
47
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
48
48
|
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
49
49
|
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
50
|
-
overlay = _ref.overlay,
|
|
51
50
|
shape = _ref.shape,
|
|
52
51
|
spacing = _ref.spacing,
|
|
53
52
|
testId = _ref.testId,
|
|
@@ -90,7 +89,6 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
90
89
|
onPointerUpCapture: onPointerUpCapture,
|
|
91
90
|
onTouchEndCapture: onTouchEndCapture,
|
|
92
91
|
onTouchStartCapture: onTouchStartCapture,
|
|
93
|
-
overlay: overlay,
|
|
94
92
|
ref: ref,
|
|
95
93
|
shape: shape,
|
|
96
94
|
spacing: spacing,
|
|
@@ -13,7 +13,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
13
13
|
var _anchor = _interopRequireDefault(require("@atlaskit/primitives/anchor"));
|
|
14
14
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
15
15
|
var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
|
|
16
|
-
var _excluded = ["aria-label", "aria-labelledby", "analyticsContext", "appearance", "autoFocus", "href", "icon", "interactionName", "isDisabled", "isSelected", "isTooltipDisabled", "label", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "
|
|
16
|
+
var _excluded = ["aria-label", "aria-labelledby", "analyticsContext", "appearance", "autoFocus", "href", "icon", "interactionName", "isDisabled", "isSelected", "isTooltipDisabled", "label", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "shape", "spacing", "testId", "tooltip", "UNSAFE_size"],
|
|
17
17
|
_excluded2 = ["className", "css", "as", "style"];
|
|
18
18
|
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); }
|
|
19
19
|
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; }
|
|
@@ -41,7 +41,6 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
41
41
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
42
42
|
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
43
43
|
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
44
|
-
overlay = _ref.overlay,
|
|
45
44
|
shape = _ref.shape,
|
|
46
45
|
spacing = _ref.spacing,
|
|
47
46
|
testId = _ref.testId,
|
|
@@ -76,7 +75,6 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
76
75
|
onPointerUpCapture: onPointerUpCapture,
|
|
77
76
|
onTouchEndCapture: onTouchEndCapture,
|
|
78
77
|
onTouchStartCapture: onTouchStartCapture,
|
|
79
|
-
overlay: overlay,
|
|
80
78
|
ref: ref,
|
|
81
79
|
shape: shape,
|
|
82
80
|
spacing: spacing,
|
|
@@ -9,7 +9,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
10
10
|
var _content = _interopRequireDefault(require("../shared/content"));
|
|
11
11
|
var _iconRenderer = _interopRequireDefault(require("../shared/icon-renderer"));
|
|
12
|
-
var _loadingOverlay = _interopRequireDefault(require("../shared/loading-overlay"));
|
|
13
12
|
var _useButtonBase = _interopRequireDefault(require("../shared/use-button-base"));
|
|
14
13
|
/**
|
|
15
14
|
* __Use icon button__
|
|
@@ -30,7 +29,8 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
30
29
|
icon = _ref.icon,
|
|
31
30
|
interactionName = _ref.interactionName,
|
|
32
31
|
isDisabled = _ref.isDisabled,
|
|
33
|
-
isLoading = _ref.isLoading,
|
|
32
|
+
_ref$isLoading = _ref.isLoading,
|
|
33
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
34
34
|
isSelected = _ref.isSelected,
|
|
35
35
|
label = _ref.label,
|
|
36
36
|
onClick = _ref.onClick,
|
|
@@ -43,14 +43,12 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
43
43
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
44
44
|
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
45
45
|
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
46
|
-
overlay = _ref.overlay,
|
|
47
46
|
ref = _ref.ref,
|
|
48
47
|
shape = _ref.shape,
|
|
49
48
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
50
49
|
spacing = _ref.spacing,
|
|
51
50
|
testId = _ref.testId,
|
|
52
51
|
UNSAFE_size = _ref.UNSAFE_size;
|
|
53
|
-
var hasOverlay = Boolean(overlay || isLoading);
|
|
54
52
|
var isCircle = shape === 'circle';
|
|
55
53
|
var baseProps = (0, _useButtonBase.default)({
|
|
56
54
|
analyticsContext: analyticsContext,
|
|
@@ -61,7 +59,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
61
59
|
buttonType: buttonType,
|
|
62
60
|
children: /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
63
61
|
type: "icon",
|
|
64
|
-
|
|
62
|
+
isLoading: isLoading
|
|
65
63
|
}, /*#__PURE__*/_react.default.createElement(_iconRenderer.default, {
|
|
66
64
|
icon: icon,
|
|
67
65
|
size: UNSAFE_size
|
|
@@ -82,16 +80,10 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
82
80
|
onPointerDownCapture: onPointerDownCapture,
|
|
83
81
|
onPointerUpCapture: onPointerUpCapture,
|
|
84
82
|
onClickCapture: onClickCapture,
|
|
85
|
-
overlay: isLoading ? (0, _loadingOverlay.default)({
|
|
86
|
-
spacing: spacing,
|
|
87
|
-
appearance: appearance,
|
|
88
|
-
isDisabled: isDisabled,
|
|
89
|
-
isSelected: isSelected,
|
|
90
|
-
testId: testId
|
|
91
|
-
}) : overlay,
|
|
92
83
|
ref: ref,
|
|
93
84
|
shouldFitContainer: shouldFitContainer,
|
|
94
|
-
spacing: spacing
|
|
85
|
+
spacing: spacing,
|
|
86
|
+
testId: testId
|
|
95
87
|
});
|
|
96
88
|
return baseProps;
|
|
97
89
|
};
|
|
@@ -63,11 +63,11 @@ var Content = function Content(_ref) {
|
|
|
63
63
|
var children = _ref.children,
|
|
64
64
|
_ref$type = _ref.type,
|
|
65
65
|
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
66
|
-
|
|
66
|
+
isLoading = _ref.isLoading,
|
|
67
67
|
position = _ref.position;
|
|
68
68
|
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
69
69
|
as: "span",
|
|
70
|
-
xcss: [commonStyles].concat((0, _toConsumableArray2.default)(type === 'text' ? [textStyles] : [iconStyles]), (0, _toConsumableArray2.default)(
|
|
70
|
+
xcss: [commonStyles].concat((0, _toConsumableArray2.default)(type === 'text' ? [textStyles] : [iconStyles]), (0, _toConsumableArray2.default)(isLoading ? [fadeStyles] : []), (0, _toConsumableArray2.default)(position === 'before' ? [beforeIconStyles] : []), (0, _toConsumableArray2.default)(position === 'after' ? [afterIconStyles] : []))
|
|
71
71
|
}, children);
|
|
72
72
|
};
|
|
73
73
|
var _default = exports.default = Content;
|
|
@@ -18,6 +18,7 @@ var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"
|
|
|
18
18
|
var _splitButtonContext = require("../../containers/split-button/split-button-context");
|
|
19
19
|
var _blockEvents = _interopRequireDefault(require("./block-events"));
|
|
20
20
|
var _constants = require("./constants");
|
|
21
|
+
var _loadingOverlay = _interopRequireDefault(require("./loading-overlay"));
|
|
21
22
|
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); }
|
|
22
23
|
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; }
|
|
23
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -294,6 +295,7 @@ var linkDecorationStyles = (0, _primitives.xcss)({
|
|
|
294
295
|
}
|
|
295
296
|
});
|
|
296
297
|
var disabledStyles = (0, _primitives.xcss)({
|
|
298
|
+
cursor: 'not-allowed',
|
|
297
299
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
298
300
|
background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
|
|
299
301
|
// @ts-expect-error
|
|
@@ -449,12 +451,9 @@ var circleStyles = (0, _primitives.xcss)({
|
|
|
449
451
|
var fullWidthStyles = (0, _primitives.xcss)({
|
|
450
452
|
width: '100%'
|
|
451
453
|
});
|
|
452
|
-
var
|
|
454
|
+
var loadingStyles = (0, _primitives.xcss)({
|
|
453
455
|
cursor: 'progress'
|
|
454
456
|
});
|
|
455
|
-
var nonInteractiveStyles = (0, _primitives.xcss)({
|
|
456
|
-
cursor: 'not-allowed'
|
|
457
|
-
});
|
|
458
457
|
var iconButtonStyles = (0, _primitives.xcss)({
|
|
459
458
|
height: "".concat(32 / 14, "em"),
|
|
460
459
|
width: "".concat(32 / 14, "em"),
|
|
@@ -482,7 +481,7 @@ var navigationSplitButtonStyles = (0, _primitives.xcss)({
|
|
|
482
481
|
paddingInlineEnd: 'space.075',
|
|
483
482
|
paddingInlineStart: 'space.075'
|
|
484
483
|
});
|
|
485
|
-
var
|
|
484
|
+
var loadingOverlayStyles = (0, _primitives.xcss)({
|
|
486
485
|
display: 'flex',
|
|
487
486
|
position: 'absolute',
|
|
488
487
|
alignItems: 'center',
|
|
@@ -536,12 +535,12 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
536
535
|
onPointerDownCapture = _ref.onPointerDownCapture,
|
|
537
536
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
538
537
|
onClickCapture = _ref.onClickCapture,
|
|
539
|
-
overlay = _ref.overlay,
|
|
540
538
|
ref = _ref.ref,
|
|
541
539
|
_ref$shouldFitContain = _ref.shouldFitContainer,
|
|
542
540
|
shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
|
|
543
541
|
_ref$spacing = _ref.spacing,
|
|
544
542
|
propSpacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
|
|
543
|
+
testId = _ref.testId,
|
|
545
544
|
ariaLabel = _ref.ariaLabel,
|
|
546
545
|
ariaLabelledBy = _ref.ariaLabelledBy;
|
|
547
546
|
var localRef = (0, _react.useRef)(null);
|
|
@@ -557,9 +556,9 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
557
556
|
var appearance = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.component-visual-refresh_t8zbo') && isDefaultAppearanceSplitButton ? 'subtle' : (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
|
|
558
557
|
var spacing = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.spacing) || propSpacing;
|
|
559
558
|
var isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
|
|
560
|
-
var
|
|
561
|
-
|
|
562
|
-
var isEffectivelyDisabled = isDisabled ||
|
|
559
|
+
var isInteractive = !isDisabled && !isLoading;
|
|
560
|
+
// Also treat loading buttons as disabled
|
|
561
|
+
var isEffectivelyDisabled = isDisabled || isLoading;
|
|
563
562
|
var isSelected = propIsSelected && !isDisabled;
|
|
564
563
|
(0, _useAutoFocus.default)(localRef, autoFocus);
|
|
565
564
|
return _objectSpread({
|
|
@@ -570,15 +569,20 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
570
569
|
// TODO: remove me once we kill color fallbacks
|
|
571
570
|
isSelected && appearance === 'warning' && selectedWarningStyles,
|
|
572
571
|
// TODO: remove me once we kill color fallbacks
|
|
573
|
-
isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, spacing === 'compact' && ((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedSpacingCompactStyles : baseSpacingCompactStyles), spacing === 'none' && spacingNoneStyles, spacing === 'none' && (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.button-tokenised-typography-styles') && tokenizedSpacingNoneStyles, spacing !== 'none' && hasIconBefore && buttonIconBeforeStyles, spacing !== 'none' && hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading &&
|
|
574
|
-
// Consider overlay buttons to be effectively disabled
|
|
572
|
+
isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, spacing === 'compact' && ((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedSpacingCompactStyles : baseSpacingCompactStyles), spacing === 'none' && spacingNoneStyles, spacing === 'none' && (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.button-tokenised-typography-styles') && tokenizedSpacingNoneStyles, spacing !== 'none' && hasIconBefore && buttonIconBeforeStyles, spacing !== 'none' && hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading && loadingStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
|
|
575
573
|
isDisabled: isEffectivelyDisabled,
|
|
576
|
-
children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children,
|
|
574
|
+
children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children, isLoading ? /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
577
575
|
as: "span",
|
|
578
|
-
xcss:
|
|
579
|
-
},
|
|
576
|
+
xcss: loadingOverlayStyles
|
|
577
|
+
}, (0, _loadingOverlay.default)({
|
|
578
|
+
spacing: spacing,
|
|
579
|
+
appearance: appearance,
|
|
580
|
+
isDisabled: isDisabled,
|
|
581
|
+
isSelected: isSelected,
|
|
582
|
+
testId: testId
|
|
583
|
+
})) : null, isLoading && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, {
|
|
580
584
|
id: loadingLabelId
|
|
581
|
-
},
|
|
585
|
+
}, _constants.LOADING_LABEL)),
|
|
582
586
|
'aria-label': isLoading && ariaLabel && !ariaLabelledBy ? "".concat(ariaLabel, " ").concat(_constants.LOADING_LABEL) : ariaLabel,
|
|
583
587
|
'aria-labelledby': isLoading && ariaLabelledBy ? "".concat(ariaLabelledBy, " ").concat(loadingLabelId) : ariaLabelledBy
|
|
584
588
|
}, (0, _blockEvents.default)(isEffectivelyDisabled, {
|
|
@@ -133,7 +133,7 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
|
|
|
133
133
|
action: 'clicked',
|
|
134
134
|
componentName: 'button',
|
|
135
135
|
packageName: "@atlaskit/button",
|
|
136
|
-
packageVersion: "
|
|
136
|
+
packageVersion: "18.0.0",
|
|
137
137
|
analyticsData: analyticsContext
|
|
138
138
|
});
|
|
139
139
|
|
|
@@ -35,7 +35,6 @@ const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function B
|
|
|
35
35
|
onPointerUpCapture,
|
|
36
36
|
onTouchEndCapture,
|
|
37
37
|
onTouchStartCapture,
|
|
38
|
-
overlay,
|
|
39
38
|
shouldFitContainer,
|
|
40
39
|
spacing,
|
|
41
40
|
testId,
|
|
@@ -77,7 +76,6 @@ const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function B
|
|
|
77
76
|
onPointerUpCapture,
|
|
78
77
|
onTouchEndCapture,
|
|
79
78
|
onTouchStartCapture,
|
|
80
|
-
overlay,
|
|
81
79
|
ref,
|
|
82
80
|
shouldFitContainer,
|
|
83
81
|
spacing,
|
|
@@ -26,7 +26,6 @@ const LinkButtonBase = ({
|
|
|
26
26
|
onPointerUpCapture,
|
|
27
27
|
onTouchEndCapture,
|
|
28
28
|
onTouchStartCapture,
|
|
29
|
-
overlay,
|
|
30
29
|
shouldFitContainer,
|
|
31
30
|
spacing,
|
|
32
31
|
testId,
|
|
@@ -66,7 +65,6 @@ const LinkButtonBase = ({
|
|
|
66
65
|
onPointerUpCapture,
|
|
67
66
|
onTouchEndCapture,
|
|
68
67
|
onTouchStartCapture,
|
|
69
|
-
overlay,
|
|
70
68
|
ref,
|
|
71
69
|
shouldFitContainer,
|
|
72
70
|
spacing,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
2
|
import Content from '../shared/content';
|
|
3
3
|
import IconRenderer from '../shared/icon-renderer';
|
|
4
|
-
import renderLoadingOverlay from '../shared/loading-overlay';
|
|
5
4
|
import useButtonBase from '../shared/use-button-base';
|
|
6
5
|
/**
|
|
7
6
|
* __Use default button base__
|
|
@@ -36,7 +35,6 @@ const useDefaultButton = ({
|
|
|
36
35
|
onPointerUpCapture,
|
|
37
36
|
onTouchEndCapture,
|
|
38
37
|
onTouchStartCapture,
|
|
39
|
-
overlay,
|
|
40
38
|
ref,
|
|
41
39
|
shouldFitContainer,
|
|
42
40
|
spacing,
|
|
@@ -44,7 +42,6 @@ const useDefaultButton = ({
|
|
|
44
42
|
UNSAFE_iconAfter_size,
|
|
45
43
|
UNSAFE_iconBefore_size
|
|
46
44
|
}) => {
|
|
47
|
-
const hasOverlay = Boolean(overlay || isLoading);
|
|
48
45
|
const baseProps = useButtonBase({
|
|
49
46
|
analyticsContext,
|
|
50
47
|
appearance,
|
|
@@ -55,16 +52,16 @@ const useDefaultButton = ({
|
|
|
55
52
|
children: /*#__PURE__*/React.createElement(Fragment, null, iconBefore && /*#__PURE__*/React.createElement(Content, {
|
|
56
53
|
type: "icon",
|
|
57
54
|
position: "before",
|
|
58
|
-
|
|
55
|
+
isLoading: isLoading
|
|
59
56
|
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
60
57
|
icon: iconBefore,
|
|
61
58
|
size: UNSAFE_iconBefore_size
|
|
62
59
|
})), children && /*#__PURE__*/React.createElement(Content, {
|
|
63
|
-
|
|
60
|
+
isLoading: isLoading
|
|
64
61
|
}, children), iconAfter && /*#__PURE__*/React.createElement(Content, {
|
|
65
62
|
type: "icon",
|
|
66
63
|
position: "after",
|
|
67
|
-
|
|
64
|
+
isLoading: isLoading
|
|
68
65
|
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
69
66
|
icon: iconAfter,
|
|
70
67
|
size: UNSAFE_iconAfter_size
|
|
@@ -83,16 +80,10 @@ const useDefaultButton = ({
|
|
|
83
80
|
onPointerDownCapture,
|
|
84
81
|
onPointerUpCapture,
|
|
85
82
|
onClickCapture,
|
|
86
|
-
overlay: isLoading ? renderLoadingOverlay({
|
|
87
|
-
spacing,
|
|
88
|
-
appearance,
|
|
89
|
-
isDisabled,
|
|
90
|
-
isSelected,
|
|
91
|
-
testId
|
|
92
|
-
}) : overlay,
|
|
93
83
|
ref,
|
|
94
84
|
shouldFitContainer,
|
|
95
85
|
spacing,
|
|
86
|
+
testId,
|
|
96
87
|
hasIconBefore: Boolean(iconBefore),
|
|
97
88
|
hasIconAfter: Boolean(iconAfter)
|
|
98
89
|
});
|
|
@@ -37,7 +37,6 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
|
|
|
37
37
|
onPointerUpCapture,
|
|
38
38
|
onTouchEndCapture,
|
|
39
39
|
onTouchStartCapture,
|
|
40
|
-
overlay,
|
|
41
40
|
shape,
|
|
42
41
|
spacing,
|
|
43
42
|
testId,
|
|
@@ -82,7 +81,6 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
|
|
|
82
81
|
onPointerUpCapture,
|
|
83
82
|
onTouchEndCapture,
|
|
84
83
|
onTouchStartCapture,
|
|
85
|
-
overlay,
|
|
86
84
|
ref,
|
|
87
85
|
shape,
|
|
88
86
|
spacing,
|
|
@@ -28,7 +28,6 @@ const LinkIconButtonBase = ({
|
|
|
28
28
|
onPointerUpCapture,
|
|
29
29
|
onTouchEndCapture,
|
|
30
30
|
onTouchStartCapture,
|
|
31
|
-
overlay,
|
|
32
31
|
shape,
|
|
33
32
|
spacing,
|
|
34
33
|
testId,
|
|
@@ -66,7 +65,6 @@ const LinkIconButtonBase = ({
|
|
|
66
65
|
onPointerUpCapture,
|
|
67
66
|
onTouchEndCapture,
|
|
68
67
|
onTouchStartCapture,
|
|
69
|
-
overlay,
|
|
70
68
|
ref,
|
|
71
69
|
shape,
|
|
72
70
|
spacing,
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
3
3
|
import Content from '../shared/content';
|
|
4
4
|
import IconRenderer from '../shared/icon-renderer';
|
|
5
|
-
import renderLoadingOverlay from '../shared/loading-overlay';
|
|
6
5
|
import useButtonBase from '../shared/use-button-base';
|
|
7
6
|
/**
|
|
8
7
|
* __Use icon button__
|
|
@@ -23,7 +22,7 @@ const useIconButton = ({
|
|
|
23
22
|
icon,
|
|
24
23
|
interactionName,
|
|
25
24
|
isDisabled,
|
|
26
|
-
isLoading,
|
|
25
|
+
isLoading = false,
|
|
27
26
|
isSelected,
|
|
28
27
|
label,
|
|
29
28
|
onClick,
|
|
@@ -36,7 +35,6 @@ const useIconButton = ({
|
|
|
36
35
|
onPointerUpCapture,
|
|
37
36
|
onTouchEndCapture,
|
|
38
37
|
onTouchStartCapture,
|
|
39
|
-
overlay,
|
|
40
38
|
ref,
|
|
41
39
|
shape,
|
|
42
40
|
shouldFitContainer,
|
|
@@ -44,7 +42,6 @@ const useIconButton = ({
|
|
|
44
42
|
testId,
|
|
45
43
|
UNSAFE_size
|
|
46
44
|
}) => {
|
|
47
|
-
const hasOverlay = Boolean(overlay || isLoading);
|
|
48
45
|
const isCircle = shape === 'circle';
|
|
49
46
|
const baseProps = useButtonBase({
|
|
50
47
|
analyticsContext,
|
|
@@ -55,7 +52,7 @@ const useIconButton = ({
|
|
|
55
52
|
buttonType,
|
|
56
53
|
children: /*#__PURE__*/React.createElement(Content, {
|
|
57
54
|
type: "icon",
|
|
58
|
-
|
|
55
|
+
isLoading: isLoading
|
|
59
56
|
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
60
57
|
icon: icon,
|
|
61
58
|
size: UNSAFE_size
|
|
@@ -76,16 +73,10 @@ const useIconButton = ({
|
|
|
76
73
|
onPointerDownCapture,
|
|
77
74
|
onPointerUpCapture,
|
|
78
75
|
onClickCapture,
|
|
79
|
-
overlay: isLoading ? renderLoadingOverlay({
|
|
80
|
-
spacing,
|
|
81
|
-
appearance,
|
|
82
|
-
isDisabled,
|
|
83
|
-
isSelected,
|
|
84
|
-
testId
|
|
85
|
-
}) : overlay,
|
|
86
76
|
ref,
|
|
87
77
|
shouldFitContainer,
|
|
88
|
-
spacing
|
|
78
|
+
spacing,
|
|
79
|
+
testId
|
|
89
80
|
});
|
|
90
81
|
return baseProps;
|
|
91
82
|
};
|
|
@@ -54,12 +54,12 @@ const afterIconStyles = xcss({
|
|
|
54
54
|
const Content = ({
|
|
55
55
|
children,
|
|
56
56
|
type = 'text',
|
|
57
|
-
|
|
57
|
+
isLoading,
|
|
58
58
|
position
|
|
59
59
|
}) => {
|
|
60
60
|
return /*#__PURE__*/React.createElement(Box, {
|
|
61
61
|
as: "span",
|
|
62
|
-
xcss: [commonStyles, ...(type === 'text' ? [textStyles] : [iconStyles]), ...(
|
|
62
|
+
xcss: [commonStyles, ...(type === 'text' ? [textStyles] : [iconStyles]), ...(isLoading ? [fadeStyles] : []), ...(position === 'before' ? [beforeIconStyles] : []), ...(position === 'after' ? [afterIconStyles] : [])]
|
|
63
63
|
}, children);
|
|
64
64
|
};
|
|
65
65
|
export default Content;
|