@atlaskit/button 17.5.0 → 17.6.1
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 +16 -0
- package/dist/cjs/new-button/variants/default/button.js +6 -3
- package/dist/cjs/new-button/variants/default/link.js +8 -5
- package/dist/cjs/new-button/variants/icon/button.js +6 -3
- package/dist/cjs/new-button/variants/icon/link.js +8 -5
- package/dist/cjs/new-button/variants/shared/use-button-base.js +3 -25
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/variants/default/button.js +5 -2
- package/dist/es2019/new-button/variants/default/link.js +7 -4
- package/dist/es2019/new-button/variants/icon/button.js +5 -2
- package/dist/es2019/new-button/variants/icon/link.js +7 -4
- package/dist/es2019/new-button/variants/shared/use-button-base.js +2 -25
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/variants/default/button.js +6 -3
- package/dist/esm/new-button/variants/default/link.js +8 -5
- package/dist/esm/new-button/variants/icon/button.js +6 -3
- package/dist/esm/new-button/variants/icon/link.js +8 -5
- package/dist/esm/new-button/variants/shared/use-button-base.js +3 -27
- 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/icon/link.d.ts +1 -1
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +3 -4
- package/dist/types-ts4.5/new-button/variants/default/link.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/shared/use-button-base.d.ts +3 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 17.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 17.6.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#58240](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58240) [`75b2ade8b254`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/75b2ade8b254) - New buttons no longer directly emit analytics tracking events to prevent duplicate events, as the underlying primitive components already have tracking. Any analytics context set on new buttons are retained through forwarding to the primitives
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 17.5.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
|
|
12
12
|
var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
|
|
13
|
-
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "iconBefore", "UNSAFE_iconAfter_size", "iconAfter", "UNSAFE_iconBefore_size", "children", "shouldFitContainer", "
|
|
13
|
+
var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "iconBefore", "UNSAFE_iconAfter_size", "iconAfter", "UNSAFE_iconBefore_size", "children", "shouldFitContainer", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "type", "testId"];
|
|
14
14
|
/**
|
|
15
15
|
* __Button__
|
|
16
16
|
*
|
|
@@ -22,6 +22,7 @@ var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDi
|
|
|
22
22
|
*/
|
|
23
23
|
var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function Button(_ref, ref) {
|
|
24
24
|
var analyticsContext = _ref.analyticsContext,
|
|
25
|
+
interactionName = _ref.interactionName,
|
|
25
26
|
autoFocus = _ref.autoFocus,
|
|
26
27
|
appearance = _ref.appearance,
|
|
27
28
|
spacing = _ref.spacing,
|
|
@@ -33,7 +34,6 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
33
34
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
|
|
34
35
|
children = _ref.children,
|
|
35
36
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
36
|
-
interactionName = _ref.interactionName,
|
|
37
37
|
overlay = _ref.overlay,
|
|
38
38
|
onClick = _ref.onClick,
|
|
39
39
|
onMouseDownCapture = _ref.onMouseDownCapture,
|
|
@@ -94,7 +94,10 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
94
94
|
onPointerUpCapture: baseProps.onPointerUpCapture,
|
|
95
95
|
onClickCapture: baseProps.onClickCapture,
|
|
96
96
|
type: type,
|
|
97
|
-
testId: testId
|
|
97
|
+
testId: testId,
|
|
98
|
+
analyticsContext: analyticsContext,
|
|
99
|
+
interactionName: interactionName,
|
|
100
|
+
componentName: "Button"
|
|
98
101
|
}), baseProps.children);
|
|
99
102
|
}));
|
|
100
103
|
Button.displayName = 'Button';
|
|
@@ -9,13 +9,14 @@ exports.default = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var
|
|
12
|
+
var _anchor = _interopRequireDefault(require("@atlaskit/primitives/anchor"));
|
|
13
13
|
var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
|
|
14
|
-
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "iconBefore", "UNSAFE_iconBefore_size", "iconAfter", "UNSAFE_iconAfter_size", "children", "shouldFitContainer", "
|
|
14
|
+
var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "iconBefore", "UNSAFE_iconBefore_size", "iconAfter", "UNSAFE_iconAfter_size", "children", "shouldFitContainer", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "testId", "href"];
|
|
15
15
|
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); }
|
|
16
16
|
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; }
|
|
17
17
|
var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
18
18
|
var analyticsContext = _ref.analyticsContext,
|
|
19
|
+
interactionName = _ref.interactionName,
|
|
19
20
|
autoFocus = _ref.autoFocus,
|
|
20
21
|
appearance = _ref.appearance,
|
|
21
22
|
spacing = _ref.spacing,
|
|
@@ -27,7 +28,6 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
27
28
|
UNSAFE_iconAfter_size = _ref.UNSAFE_iconAfter_size,
|
|
28
29
|
children = _ref.children,
|
|
29
30
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
30
|
-
interactionName = _ref.interactionName,
|
|
31
31
|
overlay = _ref.overlay,
|
|
32
32
|
onClick = _ref.onClick,
|
|
33
33
|
onMouseDownCapture = _ref.onMouseDownCapture,
|
|
@@ -70,7 +70,7 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
70
70
|
shouldFitContainer: shouldFitContainer,
|
|
71
71
|
spacing: spacing
|
|
72
72
|
});
|
|
73
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
73
|
+
return /*#__PURE__*/_react.default.createElement(_anchor.default
|
|
74
74
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
75
75
|
, (0, _extends2.default)({}, rest, {
|
|
76
76
|
ref: baseProps.ref,
|
|
@@ -94,7 +94,10 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
94
94
|
,
|
|
95
95
|
href: baseProps.isDisabled ? undefined : href,
|
|
96
96
|
role: baseProps.isDisabled ? 'link' : undefined,
|
|
97
|
-
"aria-disabled": baseProps.isDisabled === true ? true : undefined
|
|
97
|
+
"aria-disabled": baseProps.isDisabled === true ? true : undefined,
|
|
98
|
+
analyticsContext: analyticsContext,
|
|
99
|
+
interactionName: interactionName,
|
|
100
|
+
componentName: "LinkButton"
|
|
98
101
|
}), baseProps.children);
|
|
99
102
|
};
|
|
100
103
|
|
|
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
|
|
12
12
|
var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
|
|
13
|
-
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "
|
|
13
|
+
var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "type", "testId", "UNSAFE_size", "aria-label"];
|
|
14
14
|
/**
|
|
15
15
|
* __Icon Button__
|
|
16
16
|
*
|
|
@@ -22,13 +22,13 @@ var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDi
|
|
|
22
22
|
*/
|
|
23
23
|
var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function Button(_ref, ref) {
|
|
24
24
|
var analyticsContext = _ref.analyticsContext,
|
|
25
|
+
interactionName = _ref.interactionName,
|
|
25
26
|
autoFocus = _ref.autoFocus,
|
|
26
27
|
appearance = _ref.appearance,
|
|
27
28
|
spacing = _ref.spacing,
|
|
28
29
|
isDisabled = _ref.isDisabled,
|
|
29
30
|
isSelected = _ref.isSelected,
|
|
30
31
|
icon = _ref.icon,
|
|
31
|
-
interactionName = _ref.interactionName,
|
|
32
32
|
label = _ref.label,
|
|
33
33
|
overlay = _ref.overlay,
|
|
34
34
|
onClick = _ref.onClick,
|
|
@@ -93,7 +93,10 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
93
93
|
onPointerUpCapture: baseProps.onPointerUpCapture,
|
|
94
94
|
onClickCapture: baseProps.onClickCapture,
|
|
95
95
|
type: type,
|
|
96
|
-
testId: testId
|
|
96
|
+
testId: testId,
|
|
97
|
+
componentName: "IconButton",
|
|
98
|
+
analyticsContext: analyticsContext,
|
|
99
|
+
interactionName: interactionName
|
|
97
100
|
}), baseProps.children);
|
|
98
101
|
}));
|
|
99
102
|
IconButton.displayName = 'IconButton';
|
|
@@ -9,20 +9,20 @@ exports.default = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var
|
|
12
|
+
var _anchor = _interopRequireDefault(require("@atlaskit/primitives/anchor"));
|
|
13
13
|
var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
|
|
14
|
-
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "
|
|
14
|
+
var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "testId", "UNSAFE_size", "href", "aria-label"];
|
|
15
15
|
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); }
|
|
16
16
|
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; }
|
|
17
17
|
var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
18
18
|
var analyticsContext = _ref.analyticsContext,
|
|
19
|
+
interactionName = _ref.interactionName,
|
|
19
20
|
autoFocus = _ref.autoFocus,
|
|
20
21
|
appearance = _ref.appearance,
|
|
21
22
|
spacing = _ref.spacing,
|
|
22
23
|
isDisabled = _ref.isDisabled,
|
|
23
24
|
isSelected = _ref.isSelected,
|
|
24
25
|
icon = _ref.icon,
|
|
25
|
-
interactionName = _ref.interactionName,
|
|
26
26
|
label = _ref.label,
|
|
27
27
|
overlay = _ref.overlay,
|
|
28
28
|
onClick = _ref.onClick,
|
|
@@ -67,7 +67,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
67
67
|
spacing: spacing,
|
|
68
68
|
UNSAFE_size: UNSAFE_size
|
|
69
69
|
});
|
|
70
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(_anchor.default
|
|
71
71
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
72
72
|
, (0, _extends2.default)({}, rest, {
|
|
73
73
|
ref: baseProps.ref,
|
|
@@ -91,7 +91,10 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
91
91
|
,
|
|
92
92
|
href: baseProps.isDisabled ? undefined : href,
|
|
93
93
|
role: baseProps.isDisabled ? 'link' : undefined,
|
|
94
|
-
"aria-disabled": baseProps.isDisabled === true ? true : undefined
|
|
94
|
+
"aria-disabled": baseProps.isDisabled === true ? true : undefined,
|
|
95
|
+
componentName: "LinkIconButton",
|
|
96
|
+
analyticsContext: analyticsContext,
|
|
97
|
+
interactionName: interactionName
|
|
95
98
|
}), baseProps.children);
|
|
96
99
|
};
|
|
97
100
|
|
|
@@ -8,10 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
12
|
-
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
13
11
|
var _useAutoFocus = _interopRequireDefault(require("@atlaskit/ds-lib/use-auto-focus"));
|
|
14
|
-
var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-context"));
|
|
15
12
|
var _primitives = require("@atlaskit/primitives");
|
|
16
13
|
var _splitButtonContext = require("../../containers/split-button/split-button-context");
|
|
17
14
|
var _blockEvents = _interopRequireDefault(require("./block-events"));
|
|
@@ -19,9 +16,7 @@ var _xcss = require("./xcss");
|
|
|
19
16
|
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
17
|
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
18
|
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; }
|
|
22
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
|
-
// Include modified onClick with analytics
|
|
24
|
-
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
25
20
|
var overlayStyles = (0, _primitives.xcss)({
|
|
26
21
|
position: 'absolute',
|
|
27
22
|
insetInlineStart: 'space.0',
|
|
@@ -47,13 +42,11 @@ var overlayStyles = (0, _primitives.xcss)({
|
|
|
47
42
|
* @private
|
|
48
43
|
*/
|
|
49
44
|
var useButtonBase = function useButtonBase(_ref) {
|
|
50
|
-
var
|
|
51
|
-
_ref$appearance = _ref.appearance,
|
|
45
|
+
var _ref$appearance = _ref.appearance,
|
|
52
46
|
propAppearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
53
47
|
_ref$autoFocus = _ref.autoFocus,
|
|
54
48
|
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
|
|
55
49
|
buttonType = _ref.buttonType,
|
|
56
|
-
interactionName = _ref.interactionName,
|
|
57
50
|
_ref$isDisabled = _ref.isDisabled,
|
|
58
51
|
propIsDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
59
52
|
_ref$isSelected = _ref.isSelected,
|
|
@@ -67,8 +60,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
67
60
|
_ref$hasIconAfter = _ref.hasIconAfter,
|
|
68
61
|
hasIconAfter = _ref$hasIconAfter === void 0 ? false : _ref$hasIconAfter,
|
|
69
62
|
children = _ref.children,
|
|
70
|
-
|
|
71
|
-
providedOnClick = _ref$onClick === void 0 ? _noop.default : _ref$onClick,
|
|
63
|
+
onClick = _ref.onClick,
|
|
72
64
|
onMouseDownCapture = _ref.onMouseDownCapture,
|
|
73
65
|
onMouseUpCapture = _ref.onMouseUpCapture,
|
|
74
66
|
onKeyDownCapture = _ref.onKeyDownCapture,
|
|
@@ -107,20 +99,6 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
107
99
|
ref.current = node;
|
|
108
100
|
}, [ourRef, ref]);
|
|
109
101
|
(0, _useAutoFocus.default)(ourRef, autoFocus);
|
|
110
|
-
var interactionContext = (0, _react.useContext)(_interactionContext.default);
|
|
111
|
-
var handleClick = (0, _react.useCallback)(function (e, analyticsEvent) {
|
|
112
|
-
interactionContext && interactionContext.tracePress(interactionName, e.timeStamp);
|
|
113
|
-
providedOnClick(e, analyticsEvent);
|
|
114
|
-
}, [providedOnClick, interactionContext, interactionName]);
|
|
115
|
-
var onClick = (0, _analyticsNext.usePlatformLeafEventHandler)({
|
|
116
|
-
fn: handleClick,
|
|
117
|
-
action: 'clicked',
|
|
118
|
-
componentName: 'button',
|
|
119
|
-
packageName: "@atlaskit/button",
|
|
120
|
-
packageVersion: "17.5.0",
|
|
121
|
-
analyticsData: analyticsContext,
|
|
122
|
-
actionSubject: buttonType
|
|
123
|
-
});
|
|
124
102
|
var buttonXCSS = (0, _react.useMemo)(function () {
|
|
125
103
|
return (0, _xcss.getXCSS)({
|
|
126
104
|
appearance: appearance,
|
|
@@ -117,7 +117,7 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
|
|
|
117
117
|
action: 'clicked',
|
|
118
118
|
componentName: 'button',
|
|
119
119
|
packageName: "@atlaskit/button",
|
|
120
|
-
packageVersion: "
|
|
120
|
+
packageVersion: "0.0.0-development",
|
|
121
121
|
analyticsData: analyticsContext
|
|
122
122
|
});
|
|
123
123
|
|
|
@@ -13,6 +13,7 @@ import useDefaultButton from './use-default-button';
|
|
|
13
13
|
*/
|
|
14
14
|
const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button({
|
|
15
15
|
analyticsContext,
|
|
16
|
+
interactionName,
|
|
16
17
|
autoFocus,
|
|
17
18
|
appearance,
|
|
18
19
|
spacing,
|
|
@@ -24,7 +25,6 @@ const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function B
|
|
|
24
25
|
UNSAFE_iconBefore_size,
|
|
25
26
|
children,
|
|
26
27
|
shouldFitContainer,
|
|
27
|
-
interactionName,
|
|
28
28
|
overlay,
|
|
29
29
|
onClick,
|
|
30
30
|
onMouseDownCapture,
|
|
@@ -85,7 +85,10 @@ const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function B
|
|
|
85
85
|
onPointerUpCapture: baseProps.onPointerUpCapture,
|
|
86
86
|
onClickCapture: baseProps.onClickCapture,
|
|
87
87
|
type: type,
|
|
88
|
-
testId: testId
|
|
88
|
+
testId: testId,
|
|
89
|
+
analyticsContext: analyticsContext,
|
|
90
|
+
interactionName: interactionName,
|
|
91
|
+
componentName: "Button"
|
|
89
92
|
}), baseProps.children);
|
|
90
93
|
}));
|
|
91
94
|
Button.displayName = 'Button';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { forwardRef, memo } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import UNSAFE_ANCHOR from '@atlaskit/primitives/anchor';
|
|
4
4
|
import useDefaultButton from './use-default-button';
|
|
5
5
|
const LinkButtonBase = ({
|
|
6
6
|
analyticsContext,
|
|
7
|
+
interactionName,
|
|
7
8
|
autoFocus,
|
|
8
9
|
appearance,
|
|
9
10
|
spacing,
|
|
@@ -15,7 +16,6 @@ const LinkButtonBase = ({
|
|
|
15
16
|
UNSAFE_iconAfter_size,
|
|
16
17
|
children,
|
|
17
18
|
shouldFitContainer,
|
|
18
|
-
interactionName,
|
|
19
19
|
overlay,
|
|
20
20
|
onClick,
|
|
21
21
|
onMouseDownCapture,
|
|
@@ -59,7 +59,7 @@ const LinkButtonBase = ({
|
|
|
59
59
|
shouldFitContainer,
|
|
60
60
|
spacing
|
|
61
61
|
});
|
|
62
|
-
return /*#__PURE__*/React.createElement(
|
|
62
|
+
return /*#__PURE__*/React.createElement(UNSAFE_ANCHOR
|
|
63
63
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
64
64
|
, _extends({}, rest, {
|
|
65
65
|
ref: baseProps.ref,
|
|
@@ -83,7 +83,10 @@ const LinkButtonBase = ({
|
|
|
83
83
|
,
|
|
84
84
|
href: baseProps.isDisabled ? undefined : href,
|
|
85
85
|
role: baseProps.isDisabled ? 'link' : undefined,
|
|
86
|
-
"aria-disabled": baseProps.isDisabled === true ? true : undefined
|
|
86
|
+
"aria-disabled": baseProps.isDisabled === true ? true : undefined,
|
|
87
|
+
analyticsContext: analyticsContext,
|
|
88
|
+
interactionName: interactionName,
|
|
89
|
+
componentName: "LinkButton"
|
|
87
90
|
}), baseProps.children);
|
|
88
91
|
};
|
|
89
92
|
|
|
@@ -13,13 +13,13 @@ import useIconButton from './use-icon-button';
|
|
|
13
13
|
*/
|
|
14
14
|
const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button({
|
|
15
15
|
analyticsContext,
|
|
16
|
+
interactionName,
|
|
16
17
|
autoFocus,
|
|
17
18
|
appearance,
|
|
18
19
|
spacing,
|
|
19
20
|
isDisabled,
|
|
20
21
|
isSelected,
|
|
21
22
|
icon,
|
|
22
|
-
interactionName,
|
|
23
23
|
label,
|
|
24
24
|
overlay,
|
|
25
25
|
onClick,
|
|
@@ -85,7 +85,10 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
|
|
|
85
85
|
onPointerUpCapture: baseProps.onPointerUpCapture,
|
|
86
86
|
onClickCapture: baseProps.onClickCapture,
|
|
87
87
|
type: type,
|
|
88
|
-
testId: testId
|
|
88
|
+
testId: testId,
|
|
89
|
+
componentName: "IconButton",
|
|
90
|
+
analyticsContext: analyticsContext,
|
|
91
|
+
interactionName: interactionName
|
|
89
92
|
}), baseProps.children);
|
|
90
93
|
}));
|
|
91
94
|
IconButton.displayName = 'IconButton';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { forwardRef, memo } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import UNSAFE_ANCHOR from '@atlaskit/primitives/anchor';
|
|
4
4
|
import useIconButton from './use-icon-button';
|
|
5
5
|
const LinkIconButtonBase = ({
|
|
6
6
|
analyticsContext,
|
|
7
|
+
interactionName,
|
|
7
8
|
autoFocus,
|
|
8
9
|
appearance,
|
|
9
10
|
spacing,
|
|
10
11
|
isDisabled,
|
|
11
12
|
isSelected,
|
|
12
13
|
icon,
|
|
13
|
-
interactionName,
|
|
14
14
|
label,
|
|
15
15
|
overlay,
|
|
16
16
|
onClick,
|
|
@@ -57,7 +57,7 @@ const LinkIconButtonBase = ({
|
|
|
57
57
|
spacing,
|
|
58
58
|
UNSAFE_size
|
|
59
59
|
});
|
|
60
|
-
return /*#__PURE__*/React.createElement(
|
|
60
|
+
return /*#__PURE__*/React.createElement(UNSAFE_ANCHOR
|
|
61
61
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
62
62
|
, _extends({}, rest, {
|
|
63
63
|
ref: baseProps.ref,
|
|
@@ -81,7 +81,10 @@ const LinkIconButtonBase = ({
|
|
|
81
81
|
,
|
|
82
82
|
href: baseProps.isDisabled ? undefined : href,
|
|
83
83
|
role: baseProps.isDisabled ? 'link' : undefined,
|
|
84
|
-
"aria-disabled": baseProps.isDisabled === true ? true : undefined
|
|
84
|
+
"aria-disabled": baseProps.isDisabled === true ? true : undefined,
|
|
85
|
+
componentName: "LinkIconButton",
|
|
86
|
+
analyticsContext: analyticsContext,
|
|
87
|
+
interactionName: interactionName
|
|
85
88
|
}), baseProps.children);
|
|
86
89
|
};
|
|
87
90
|
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import React, { Fragment, useCallback,
|
|
2
|
-
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
3
|
-
import noop from '@atlaskit/ds-lib/noop';
|
|
1
|
+
import React, { Fragment, useCallback, useMemo, useRef } from 'react';
|
|
4
2
|
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
5
|
-
// eslint-disable-next-line no-duplicate-imports
|
|
6
|
-
import InteractionContext from '@atlaskit/interaction-context';
|
|
7
3
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
8
4
|
import { useSplitButtonContext } from '../../containers/split-button/split-button-context';
|
|
9
5
|
import blockEvents from './block-events';
|
|
10
6
|
import { getXCSS } from './xcss';
|
|
11
|
-
|
|
12
|
-
// Include modified onClick with analytics
|
|
13
|
-
|
|
14
7
|
const overlayStyles = xcss({
|
|
15
8
|
position: 'absolute',
|
|
16
9
|
insetInlineStart: 'space.0',
|
|
@@ -36,11 +29,9 @@ const overlayStyles = xcss({
|
|
|
36
29
|
* @private
|
|
37
30
|
*/
|
|
38
31
|
const useButtonBase = ({
|
|
39
|
-
analyticsContext,
|
|
40
32
|
appearance: propAppearance = 'default',
|
|
41
33
|
autoFocus = false,
|
|
42
34
|
buttonType,
|
|
43
|
-
interactionName,
|
|
44
35
|
isDisabled: propIsDisabled = false,
|
|
45
36
|
isSelected = false,
|
|
46
37
|
// TODO: Separate Icon Button styling from button base
|
|
@@ -50,7 +41,7 @@ const useButtonBase = ({
|
|
|
50
41
|
hasIconBefore = false,
|
|
51
42
|
hasIconAfter = false,
|
|
52
43
|
children,
|
|
53
|
-
onClick
|
|
44
|
+
onClick,
|
|
54
45
|
onMouseDownCapture,
|
|
55
46
|
onMouseUpCapture,
|
|
56
47
|
onKeyDownCapture,
|
|
@@ -88,20 +79,6 @@ const useButtonBase = ({
|
|
|
88
79
|
ref.current = node;
|
|
89
80
|
}, [ourRef, ref]);
|
|
90
81
|
useAutoFocus(ourRef, autoFocus);
|
|
91
|
-
const interactionContext = useContext(InteractionContext);
|
|
92
|
-
const handleClick = useCallback((e, analyticsEvent) => {
|
|
93
|
-
interactionContext && interactionContext.tracePress(interactionName, e.timeStamp);
|
|
94
|
-
providedOnClick(e, analyticsEvent);
|
|
95
|
-
}, [providedOnClick, interactionContext, interactionName]);
|
|
96
|
-
const onClick = usePlatformLeafEventHandler({
|
|
97
|
-
fn: handleClick,
|
|
98
|
-
action: 'clicked',
|
|
99
|
-
componentName: 'button',
|
|
100
|
-
packageName: "@atlaskit/button",
|
|
101
|
-
packageVersion: "17.5.0",
|
|
102
|
-
analyticsData: analyticsContext,
|
|
103
|
-
actionSubject: buttonType
|
|
104
|
-
});
|
|
105
82
|
const buttonXCSS = useMemo(() => getXCSS({
|
|
106
83
|
appearance,
|
|
107
84
|
spacing,
|
|
@@ -102,7 +102,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
102
102
|
action: 'clicked',
|
|
103
103
|
componentName: 'button',
|
|
104
104
|
packageName: "@atlaskit/button",
|
|
105
|
-
packageVersion: "
|
|
105
|
+
packageVersion: "0.0.0-development",
|
|
106
106
|
analyticsData: analyticsContext
|
|
107
107
|
});
|
|
108
108
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "iconBefore", "UNSAFE_iconAfter_size", "iconAfter", "UNSAFE_iconBefore_size", "children", "shouldFitContainer", "
|
|
3
|
+
var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "iconBefore", "UNSAFE_iconAfter_size", "iconAfter", "UNSAFE_iconBefore_size", "children", "shouldFitContainer", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "type", "testId"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import UNSAFE_PRESSABLE from '@atlaskit/primitives/pressable';
|
|
6
6
|
import useDefaultButton from './use-default-button';
|
|
@@ -15,6 +15,7 @@ import useDefaultButton from './use-default-button';
|
|
|
15
15
|
*/
|
|
16
16
|
var Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
|
|
17
17
|
var analyticsContext = _ref.analyticsContext,
|
|
18
|
+
interactionName = _ref.interactionName,
|
|
18
19
|
autoFocus = _ref.autoFocus,
|
|
19
20
|
appearance = _ref.appearance,
|
|
20
21
|
spacing = _ref.spacing,
|
|
@@ -26,7 +27,6 @@ var Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function But
|
|
|
26
27
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
|
|
27
28
|
children = _ref.children,
|
|
28
29
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
29
|
-
interactionName = _ref.interactionName,
|
|
30
30
|
overlay = _ref.overlay,
|
|
31
31
|
onClick = _ref.onClick,
|
|
32
32
|
onMouseDownCapture = _ref.onMouseDownCapture,
|
|
@@ -87,7 +87,10 @@ var Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function But
|
|
|
87
87
|
onPointerUpCapture: baseProps.onPointerUpCapture,
|
|
88
88
|
onClickCapture: baseProps.onClickCapture,
|
|
89
89
|
type: type,
|
|
90
|
-
testId: testId
|
|
90
|
+
testId: testId,
|
|
91
|
+
analyticsContext: analyticsContext,
|
|
92
|
+
interactionName: interactionName,
|
|
93
|
+
componentName: "Button"
|
|
91
94
|
}), baseProps.children);
|
|
92
95
|
}));
|
|
93
96
|
Button.displayName = 'Button';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "iconBefore", "UNSAFE_iconBefore_size", "iconAfter", "UNSAFE_iconAfter_size", "children", "shouldFitContainer", "
|
|
3
|
+
var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "iconBefore", "UNSAFE_iconBefore_size", "iconAfter", "UNSAFE_iconAfter_size", "children", "shouldFitContainer", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "testId", "href"];
|
|
4
4
|
import React, { forwardRef, memo } from 'react';
|
|
5
|
-
import
|
|
5
|
+
import UNSAFE_ANCHOR from '@atlaskit/primitives/anchor';
|
|
6
6
|
import useDefaultButton from './use-default-button';
|
|
7
7
|
var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
8
8
|
var analyticsContext = _ref.analyticsContext,
|
|
9
|
+
interactionName = _ref.interactionName,
|
|
9
10
|
autoFocus = _ref.autoFocus,
|
|
10
11
|
appearance = _ref.appearance,
|
|
11
12
|
spacing = _ref.spacing,
|
|
@@ -17,7 +18,6 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
17
18
|
UNSAFE_iconAfter_size = _ref.UNSAFE_iconAfter_size,
|
|
18
19
|
children = _ref.children,
|
|
19
20
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
20
|
-
interactionName = _ref.interactionName,
|
|
21
21
|
overlay = _ref.overlay,
|
|
22
22
|
onClick = _ref.onClick,
|
|
23
23
|
onMouseDownCapture = _ref.onMouseDownCapture,
|
|
@@ -60,7 +60,7 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
60
60
|
shouldFitContainer: shouldFitContainer,
|
|
61
61
|
spacing: spacing
|
|
62
62
|
});
|
|
63
|
-
return /*#__PURE__*/React.createElement(
|
|
63
|
+
return /*#__PURE__*/React.createElement(UNSAFE_ANCHOR
|
|
64
64
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
65
65
|
, _extends({}, rest, {
|
|
66
66
|
ref: baseProps.ref,
|
|
@@ -84,7 +84,10 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
84
84
|
,
|
|
85
85
|
href: baseProps.isDisabled ? undefined : href,
|
|
86
86
|
role: baseProps.isDisabled ? 'link' : undefined,
|
|
87
|
-
"aria-disabled": baseProps.isDisabled === true ? true : undefined
|
|
87
|
+
"aria-disabled": baseProps.isDisabled === true ? true : undefined,
|
|
88
|
+
analyticsContext: analyticsContext,
|
|
89
|
+
interactionName: interactionName,
|
|
90
|
+
componentName: "LinkButton"
|
|
88
91
|
}), baseProps.children);
|
|
89
92
|
};
|
|
90
93
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "
|
|
3
|
+
var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "type", "testId", "UNSAFE_size", "aria-label"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import UNSAFE_PRESSABLE from '@atlaskit/primitives/pressable';
|
|
6
6
|
import useIconButton from './use-icon-button';
|
|
@@ -15,13 +15,13 @@ import useIconButton from './use-icon-button';
|
|
|
15
15
|
*/
|
|
16
16
|
var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
|
|
17
17
|
var analyticsContext = _ref.analyticsContext,
|
|
18
|
+
interactionName = _ref.interactionName,
|
|
18
19
|
autoFocus = _ref.autoFocus,
|
|
19
20
|
appearance = _ref.appearance,
|
|
20
21
|
spacing = _ref.spacing,
|
|
21
22
|
isDisabled = _ref.isDisabled,
|
|
22
23
|
isSelected = _ref.isSelected,
|
|
23
24
|
icon = _ref.icon,
|
|
24
|
-
interactionName = _ref.interactionName,
|
|
25
25
|
label = _ref.label,
|
|
26
26
|
overlay = _ref.overlay,
|
|
27
27
|
onClick = _ref.onClick,
|
|
@@ -86,7 +86,10 @@ var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
86
86
|
onPointerUpCapture: baseProps.onPointerUpCapture,
|
|
87
87
|
onClickCapture: baseProps.onClickCapture,
|
|
88
88
|
type: type,
|
|
89
|
-
testId: testId
|
|
89
|
+
testId: testId,
|
|
90
|
+
componentName: "IconButton",
|
|
91
|
+
analyticsContext: analyticsContext,
|
|
92
|
+
interactionName: interactionName
|
|
90
93
|
}), baseProps.children);
|
|
91
94
|
}));
|
|
92
95
|
IconButton.displayName = 'IconButton';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "
|
|
3
|
+
var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "testId", "UNSAFE_size", "href", "aria-label"];
|
|
4
4
|
import React, { forwardRef, memo } from 'react';
|
|
5
|
-
import
|
|
5
|
+
import UNSAFE_ANCHOR from '@atlaskit/primitives/anchor';
|
|
6
6
|
import useIconButton from './use-icon-button';
|
|
7
7
|
var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
8
8
|
var analyticsContext = _ref.analyticsContext,
|
|
9
|
+
interactionName = _ref.interactionName,
|
|
9
10
|
autoFocus = _ref.autoFocus,
|
|
10
11
|
appearance = _ref.appearance,
|
|
11
12
|
spacing = _ref.spacing,
|
|
12
13
|
isDisabled = _ref.isDisabled,
|
|
13
14
|
isSelected = _ref.isSelected,
|
|
14
15
|
icon = _ref.icon,
|
|
15
|
-
interactionName = _ref.interactionName,
|
|
16
16
|
label = _ref.label,
|
|
17
17
|
overlay = _ref.overlay,
|
|
18
18
|
onClick = _ref.onClick,
|
|
@@ -57,7 +57,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
57
57
|
spacing: spacing,
|
|
58
58
|
UNSAFE_size: UNSAFE_size
|
|
59
59
|
});
|
|
60
|
-
return /*#__PURE__*/React.createElement(
|
|
60
|
+
return /*#__PURE__*/React.createElement(UNSAFE_ANCHOR
|
|
61
61
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
62
62
|
, _extends({}, rest, {
|
|
63
63
|
ref: baseProps.ref,
|
|
@@ -81,7 +81,10 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
81
81
|
,
|
|
82
82
|
href: baseProps.isDisabled ? undefined : href,
|
|
83
83
|
role: baseProps.isDisabled ? 'link' : undefined,
|
|
84
|
-
"aria-disabled": baseProps.isDisabled === true ? true : undefined
|
|
84
|
+
"aria-disabled": baseProps.isDisabled === true ? true : undefined,
|
|
85
|
+
componentName: "LinkIconButton",
|
|
86
|
+
analyticsContext: analyticsContext,
|
|
87
|
+
interactionName: interactionName
|
|
85
88
|
}), baseProps.children);
|
|
86
89
|
};
|
|
87
90
|
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import React, { Fragment, useCallback,
|
|
5
|
-
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
6
|
-
import noop from '@atlaskit/ds-lib/noop';
|
|
4
|
+
import React, { Fragment, useCallback, useMemo, useRef } from 'react';
|
|
7
5
|
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
8
|
-
// eslint-disable-next-line no-duplicate-imports
|
|
9
|
-
import InteractionContext from '@atlaskit/interaction-context';
|
|
10
6
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
11
7
|
import { useSplitButtonContext } from '../../containers/split-button/split-button-context';
|
|
12
8
|
import blockEvents from './block-events';
|
|
13
9
|
import { getXCSS } from './xcss';
|
|
14
|
-
|
|
15
|
-
// Include modified onClick with analytics
|
|
16
|
-
|
|
17
10
|
var overlayStyles = xcss({
|
|
18
11
|
position: 'absolute',
|
|
19
12
|
insetInlineStart: 'space.0',
|
|
@@ -39,13 +32,11 @@ var overlayStyles = xcss({
|
|
|
39
32
|
* @private
|
|
40
33
|
*/
|
|
41
34
|
var useButtonBase = function useButtonBase(_ref) {
|
|
42
|
-
var
|
|
43
|
-
_ref$appearance = _ref.appearance,
|
|
35
|
+
var _ref$appearance = _ref.appearance,
|
|
44
36
|
propAppearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
45
37
|
_ref$autoFocus = _ref.autoFocus,
|
|
46
38
|
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
|
|
47
39
|
buttonType = _ref.buttonType,
|
|
48
|
-
interactionName = _ref.interactionName,
|
|
49
40
|
_ref$isDisabled = _ref.isDisabled,
|
|
50
41
|
propIsDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
51
42
|
_ref$isSelected = _ref.isSelected,
|
|
@@ -59,8 +50,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
59
50
|
_ref$hasIconAfter = _ref.hasIconAfter,
|
|
60
51
|
hasIconAfter = _ref$hasIconAfter === void 0 ? false : _ref$hasIconAfter,
|
|
61
52
|
children = _ref.children,
|
|
62
|
-
|
|
63
|
-
providedOnClick = _ref$onClick === void 0 ? noop : _ref$onClick,
|
|
53
|
+
onClick = _ref.onClick,
|
|
64
54
|
onMouseDownCapture = _ref.onMouseDownCapture,
|
|
65
55
|
onMouseUpCapture = _ref.onMouseUpCapture,
|
|
66
56
|
onKeyDownCapture = _ref.onKeyDownCapture,
|
|
@@ -99,20 +89,6 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
99
89
|
ref.current = node;
|
|
100
90
|
}, [ourRef, ref]);
|
|
101
91
|
useAutoFocus(ourRef, autoFocus);
|
|
102
|
-
var interactionContext = useContext(InteractionContext);
|
|
103
|
-
var handleClick = useCallback(function (e, analyticsEvent) {
|
|
104
|
-
interactionContext && interactionContext.tracePress(interactionName, e.timeStamp);
|
|
105
|
-
providedOnClick(e, analyticsEvent);
|
|
106
|
-
}, [providedOnClick, interactionContext, interactionName]);
|
|
107
|
-
var onClick = usePlatformLeafEventHandler({
|
|
108
|
-
fn: handleClick,
|
|
109
|
-
action: 'clicked',
|
|
110
|
-
componentName: 'button',
|
|
111
|
-
packageName: "@atlaskit/button",
|
|
112
|
-
packageVersion: "17.5.0",
|
|
113
|
-
analyticsData: analyticsContext,
|
|
114
|
-
actionSubject: buttonType
|
|
115
|
-
});
|
|
116
92
|
var buttonXCSS = useMemo(function () {
|
|
117
93
|
return getXCSS({
|
|
118
94
|
appearance: appearance,
|
|
@@ -108,7 +108,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
108
108
|
action: 'clicked',
|
|
109
109
|
componentName: 'button',
|
|
110
110
|
packageName: "@atlaskit/button",
|
|
111
|
-
packageVersion: "
|
|
111
|
+
packageVersion: "0.0.0-development",
|
|
112
112
|
analyticsData: analyticsContext
|
|
113
113
|
});
|
|
114
114
|
|
|
@@ -2,7 +2,7 @@ import React, { type Ref } from 'react';
|
|
|
2
2
|
import { type AdditionalDefaultLinkVariantProps, type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonDefaultButtonProps } from './types';
|
|
4
4
|
export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig> & AdditionalDefaultLinkVariantProps;
|
|
5
|
-
declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, iconBefore, UNSAFE_iconBefore_size, iconAfter, UNSAFE_iconAfter_size, children, shouldFitContainer,
|
|
5
|
+
declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, interactionName, autoFocus, appearance, spacing, isDisabled, isSelected, iconBefore, UNSAFE_iconBefore_size, iconAfter, UNSAFE_iconAfter_size, children, shouldFitContainer, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, testId, href, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Button__
|
|
8
8
|
*
|
|
@@ -2,7 +2,7 @@ import React, { type Ref } from 'react';
|
|
|
2
2
|
import { type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
4
|
export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
|
|
5
|
-
declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, icon,
|
|
5
|
+
declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, interactionName, autoFocus, appearance, spacing, isDisabled, isSelected, icon, label, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, shape, testId, UNSAFE_size, href, "aria-label": preventedAriaLabel, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Icon Button__
|
|
8
8
|
*
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { xcss } from '@atlaskit/primitives';
|
|
3
3
|
import { type Appearance, type CommonButtonProps } from '../types';
|
|
4
|
-
export type ControlledEvents<TagName extends HTMLElement> = Pick<React.DOMAttributes<TagName>, 'onMouseDownCapture' | 'onMouseUpCapture' | 'onKeyDownCapture' | 'onKeyUpCapture' | 'onTouchStartCapture' | 'onTouchEndCapture' | 'onPointerDownCapture' | 'onPointerUpCapture' | 'onClickCapture'
|
|
5
|
-
export type ControlledEventsPassed<TagName extends HTMLElement> = Omit<ControlledEvents<TagName>, 'onClick'> & Pick<CommonButtonProps<TagName>, 'onClick'>;
|
|
4
|
+
export type ControlledEvents<TagName extends HTMLElement> = Pick<React.DOMAttributes<TagName>, 'onMouseDownCapture' | 'onMouseUpCapture' | 'onKeyDownCapture' | 'onKeyUpCapture' | 'onTouchStartCapture' | 'onTouchEndCapture' | 'onPointerDownCapture' | 'onPointerUpCapture' | 'onClickCapture'> & Pick<CommonButtonProps<TagName>, 'onClick'>;
|
|
6
5
|
export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
7
6
|
ref: React.Ref<TagName>;
|
|
8
7
|
/**
|
|
@@ -16,7 +15,7 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
16
15
|
shouldFitContainer?: boolean;
|
|
17
16
|
appearance?: Appearance;
|
|
18
17
|
children: React.ReactNode;
|
|
19
|
-
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay' | 'spacing'> &
|
|
18
|
+
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay' | 'spacing'> & ControlledEvents<TagName>;
|
|
20
19
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
21
20
|
xcss: ReturnType<typeof xcss>;
|
|
22
21
|
ref(node: TagName | null): void;
|
|
@@ -36,5 +35,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
|
36
35
|
*
|
|
37
36
|
* @private
|
|
38
37
|
*/
|
|
39
|
-
declare const useButtonBase: <TagName extends HTMLElement>({
|
|
38
|
+
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, buttonType, isDisabled: propIsDisabled, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
40
39
|
export default useButtonBase;
|
|
@@ -2,7 +2,7 @@ import React, { type Ref } from 'react';
|
|
|
2
2
|
import { type AdditionalDefaultLinkVariantProps, type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonDefaultButtonProps } from './types';
|
|
4
4
|
export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig> & AdditionalDefaultLinkVariantProps;
|
|
5
|
-
declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, iconBefore, UNSAFE_iconBefore_size, iconAfter, UNSAFE_iconAfter_size, children, shouldFitContainer,
|
|
5
|
+
declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, interactionName, autoFocus, appearance, spacing, isDisabled, isSelected, iconBefore, UNSAFE_iconBefore_size, iconAfter, UNSAFE_iconAfter_size, children, shouldFitContainer, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, testId, href, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Button__
|
|
8
8
|
*
|
|
@@ -2,7 +2,7 @@ import React, { type Ref } from 'react';
|
|
|
2
2
|
import { type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
4
|
export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
|
|
5
|
-
declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, icon,
|
|
5
|
+
declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, interactionName, autoFocus, appearance, spacing, isDisabled, isSelected, icon, label, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, shape, testId, UNSAFE_size, href, "aria-label": preventedAriaLabel, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Icon Button__
|
|
8
8
|
*
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { xcss } from '@atlaskit/primitives';
|
|
3
3
|
import { type Appearance, type CommonButtonProps } from '../types';
|
|
4
|
-
export type ControlledEvents<TagName extends HTMLElement> = Pick<React.DOMAttributes<TagName>, 'onMouseDownCapture' | 'onMouseUpCapture' | 'onKeyDownCapture' | 'onKeyUpCapture' | 'onTouchStartCapture' | 'onTouchEndCapture' | 'onPointerDownCapture' | 'onPointerUpCapture' | 'onClickCapture'
|
|
5
|
-
export type ControlledEventsPassed<TagName extends HTMLElement> = Omit<ControlledEvents<TagName>, 'onClick'> & Pick<CommonButtonProps<TagName>, 'onClick'>;
|
|
4
|
+
export type ControlledEvents<TagName extends HTMLElement> = Pick<React.DOMAttributes<TagName>, 'onMouseDownCapture' | 'onMouseUpCapture' | 'onKeyDownCapture' | 'onKeyUpCapture' | 'onTouchStartCapture' | 'onTouchEndCapture' | 'onPointerDownCapture' | 'onPointerUpCapture' | 'onClickCapture'> & Pick<CommonButtonProps<TagName>, 'onClick'>;
|
|
6
5
|
export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
7
6
|
ref: React.Ref<TagName>;
|
|
8
7
|
/**
|
|
@@ -16,7 +15,7 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
16
15
|
shouldFitContainer?: boolean;
|
|
17
16
|
appearance?: Appearance;
|
|
18
17
|
children: React.ReactNode;
|
|
19
|
-
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay' | 'spacing'> &
|
|
18
|
+
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay' | 'spacing'> & ControlledEvents<TagName>;
|
|
20
19
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
21
20
|
xcss: ReturnType<typeof xcss>;
|
|
22
21
|
ref(node: TagName | null): void;
|
|
@@ -36,5 +35,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
|
36
35
|
*
|
|
37
36
|
* @private
|
|
38
37
|
*/
|
|
39
|
-
declare const useButtonBase: <TagName extends HTMLElement>({
|
|
38
|
+
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, buttonType, isDisabled: propIsDisabled, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
40
39
|
export default useButtonBase;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.6.1",
|
|
4
4
|
"description": "A button triggers an event or action. They let users know what will happen next.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -87,10 +87,10 @@
|
|
|
87
87
|
"@atlaskit/focus-ring": "^1.3.0",
|
|
88
88
|
"@atlaskit/icon": "^22.1.0",
|
|
89
89
|
"@atlaskit/interaction-context": "^2.1.0",
|
|
90
|
-
"@atlaskit/primitives": "^
|
|
90
|
+
"@atlaskit/primitives": "^4.0.0",
|
|
91
91
|
"@atlaskit/spinner": "^16.0.0",
|
|
92
92
|
"@atlaskit/theme": "^12.6.0",
|
|
93
|
-
"@atlaskit/tokens": "^1.
|
|
93
|
+
"@atlaskit/tokens": "^1.39.0",
|
|
94
94
|
"@atlaskit/visually-hidden": "^1.2.4",
|
|
95
95
|
"@babel/runtime": "^7.0.0",
|
|
96
96
|
"@emotion/react": "^11.7.1"
|