@atlaskit/button 17.22.2 → 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.
Files changed (43) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/cjs/new-button/variants/default/button.js +11 -4
  3. package/dist/cjs/new-button/variants/default/link.js +13 -6
  4. package/dist/cjs/new-button/variants/default/use-default-button.js +4 -13
  5. package/dist/cjs/new-button/variants/icon/button.js +14 -7
  6. package/dist/cjs/new-button/variants/icon/link.js +11 -4
  7. package/dist/cjs/new-button/variants/icon/use-icon-button.js +5 -13
  8. package/dist/cjs/new-button/variants/shared/content.js +2 -2
  9. package/dist/cjs/new-button/variants/shared/use-button-base.js +19 -15
  10. package/dist/cjs/old-button/shared/button-base.js +1 -1
  11. package/dist/es2019/new-button/variants/default/button.js +11 -3
  12. package/dist/es2019/new-button/variants/default/link.js +13 -5
  13. package/dist/es2019/new-button/variants/default/use-default-button.js +4 -13
  14. package/dist/es2019/new-button/variants/icon/button.js +14 -6
  15. package/dist/es2019/new-button/variants/icon/link.js +11 -3
  16. package/dist/es2019/new-button/variants/icon/use-icon-button.js +4 -13
  17. package/dist/es2019/new-button/variants/shared/content.js +2 -2
  18. package/dist/es2019/new-button/variants/shared/use-button-base.js +19 -15
  19. package/dist/es2019/old-button/shared/button-base.js +1 -1
  20. package/dist/esm/new-button/variants/default/button.js +11 -4
  21. package/dist/esm/new-button/variants/default/link.js +13 -6
  22. package/dist/esm/new-button/variants/default/use-default-button.js +4 -13
  23. package/dist/esm/new-button/variants/icon/button.js +14 -7
  24. package/dist/esm/new-button/variants/icon/link.js +11 -4
  25. package/dist/esm/new-button/variants/icon/use-icon-button.js +5 -13
  26. package/dist/esm/new-button/variants/shared/content.js +2 -2
  27. package/dist/esm/new-button/variants/shared/use-button-base.js +19 -15
  28. package/dist/esm/old-button/shared/button-base.js +1 -1
  29. package/dist/types/new-button/variants/default/link.d.ts +1 -1
  30. package/dist/types/new-button/variants/default/use-default-button.d.ts +1 -1
  31. package/dist/types/new-button/variants/icon/link.d.ts +1 -1
  32. package/dist/types/new-button/variants/icon/use-icon-button.d.ts +1 -1
  33. package/dist/types/new-button/variants/shared/content.d.ts +2 -2
  34. package/dist/types/new-button/variants/shared/use-button-base.d.ts +2 -2
  35. package/dist/types/new-button/variants/types.d.ts +0 -6
  36. package/dist/types-ts4.5/new-button/variants/default/link.d.ts +1 -1
  37. package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +1 -1
  38. package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -1
  39. package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +1 -1
  40. package/dist/types-ts4.5/new-button/variants/shared/content.d.ts +2 -2
  41. package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +2 -2
  42. package/dist/types-ts4.5/new-button/variants/types.d.ts +0 -6
  43. package/package.json +5 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
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
+
12
+ ## 17.23.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#112945](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/112945)
17
+ [`d7af9e23536c0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d7af9e23536c0) -
18
+ New button prevents unintended spread props being passed to children. The following props will now
19
+ be ignored:
20
+
21
+ - css
22
+ - style
23
+ - as
24
+ - className
25
+
26
+ Note: These props were already excluded via types. The API has not changed.
27
+
3
28
  ## 17.22.2
4
29
 
5
30
  ### Patch Changes
@@ -8,9 +8,11 @@ exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
12
13
  var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
13
- 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", "overlay", "shouldFitContainer", "spacing", "testId", "type", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"];
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
+ _excluded2 = ["className", "css", "as", "style"];
14
16
  /**
15
17
  * __Button__
16
18
  *
@@ -43,7 +45,6 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
43
45
  onPointerUpCapture = _ref.onPointerUpCapture,
44
46
  onTouchEndCapture = _ref.onTouchEndCapture,
45
47
  onTouchStartCapture = _ref.onTouchStartCapture,
46
- overlay = _ref.overlay,
47
48
  shouldFitContainer = _ref.shouldFitContainer,
48
49
  spacing = _ref.spacing,
49
50
  testId = _ref.testId,
@@ -51,7 +52,14 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
51
52
  type = _ref$type === void 0 ? 'button' : _ref$type,
52
53
  UNSAFE_iconAfter_size = _ref.UNSAFE_iconAfter_size,
53
54
  UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
54
- rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
55
+ unsafeRest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
56
+ // @ts-expect-error
57
+ var _className = unsafeRest.className,
58
+ _css = unsafeRest.css,
59
+ _as = unsafeRest.as,
60
+ _style = unsafeRest.style,
61
+ saferRest = (0, _objectWithoutProperties2.default)(unsafeRest, _excluded2);
62
+ var rest = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.remove-unsafe-spread-from-new-button_a2xhw') ? saferRest : unsafeRest;
55
63
  var baseProps = (0, _useDefaultButton.default)({
56
64
  ariaLabel: ariaLabel,
57
65
  ariaLabelledBy: ariaLabelledBy,
@@ -76,7 +84,6 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
76
84
  onPointerUpCapture: onPointerUpCapture,
77
85
  onTouchEndCapture: onTouchEndCapture,
78
86
  onTouchStartCapture: onTouchStartCapture,
79
- overlay: overlay,
80
87
  ref: ref,
81
88
  shouldFitContainer: shouldFitContainer,
82
89
  spacing: spacing,
@@ -9,9 +9,11 @@ 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 _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _anchor = _interopRequireDefault(require("@atlaskit/primitives/anchor"));
13
14
  var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
14
- 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", "overlay", "shouldFitContainer", "spacing", "testId", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"];
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
+ _excluded2 = ["className", "css", "as", "style"];
15
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); }
16
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; }
17
19
  var LinkButtonBase = function LinkButtonBase(_ref, ref) {
@@ -37,18 +39,24 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
37
39
  onPointerUpCapture = _ref.onPointerUpCapture,
38
40
  onTouchEndCapture = _ref.onTouchEndCapture,
39
41
  onTouchStartCapture = _ref.onTouchStartCapture,
40
- overlay = _ref.overlay,
41
42
  shouldFitContainer = _ref.shouldFitContainer,
42
43
  spacing = _ref.spacing,
43
44
  testId = _ref.testId,
44
45
  UNSAFE_iconAfter_size = _ref.UNSAFE_iconAfter_size,
45
46
  UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
46
- rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
47
+ unsafeRest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
48
+ // @ts-expect-error
49
+ var _className = unsafeRest.className,
50
+ _css = unsafeRest.css,
51
+ _as = unsafeRest.as,
52
+ _style = unsafeRest.style,
53
+ saferRest = (0, _objectWithoutProperties2.default)(unsafeRest, _excluded2);
54
+ var rest = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.remove-unsafe-spread-from-new-button_a2xhw') ? saferRest : unsafeRest;
47
55
  var baseProps = (0, _useDefaultButton.default)({
48
- ariaLabel: ariaLabel,
49
- ariaLabelledBy: ariaLabelledBy,
50
56
  analyticsContext: analyticsContext,
51
57
  appearance: appearance,
58
+ ariaLabel: ariaLabel,
59
+ ariaLabelledBy: ariaLabelledBy,
52
60
  autoFocus: autoFocus,
53
61
  buttonType: 'link',
54
62
  children: children,
@@ -67,7 +75,6 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
67
75
  onPointerUpCapture: onPointerUpCapture,
68
76
  onTouchEndCapture: onTouchEndCapture,
69
77
  onTouchStartCapture: onTouchStartCapture,
70
- overlay: overlay,
71
78
  ref: ref,
72
79
  shouldFitContainer: shouldFitContainer,
73
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
- hasOverlay: hasOverlay
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
- hasOverlay: hasOverlay
70
+ isLoading: isLoading
74
71
  }, children), iconAfter && /*#__PURE__*/_react.default.createElement(_content.default, {
75
72
  type: "icon",
76
73
  position: "after",
77
- hasOverlay: hasOverlay
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
  });
@@ -8,10 +8,12 @@ exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
12
13
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
13
14
  var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
14
- 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", "overlay", "shape", "spacing", "testId", "tooltip", "type", "UNSAFE_size"];
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
+ _excluded2 = ["className", "css", "as", "style"];
15
17
  /**
16
18
  * __Icon Button__
17
19
  *
@@ -45,7 +47,6 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
45
47
  onPointerUpCapture = _ref.onPointerUpCapture,
46
48
  onTouchEndCapture = _ref.onTouchEndCapture,
47
49
  onTouchStartCapture = _ref.onTouchStartCapture,
48
- overlay = _ref.overlay,
49
50
  shape = _ref.shape,
50
51
  spacing = _ref.spacing,
51
52
  testId = _ref.testId,
@@ -53,7 +54,15 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
53
54
  _ref$type = _ref.type,
54
55
  type = _ref$type === void 0 ? 'button' : _ref$type,
55
56
  UNSAFE_size = _ref.UNSAFE_size,
56
- rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
57
+ unsafeRest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
58
+ // @ts-expect-error
59
+ var _className = unsafeRest.className,
60
+ _css = unsafeRest.css,
61
+ _as = unsafeRest.as,
62
+ _style = unsafeRest.style,
63
+ saferRest = (0, _objectWithoutProperties2.default)(unsafeRest, _excluded2);
64
+ var rest = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.remove-unsafe-spread-from-new-button_a2xhw') ? saferRest : unsafeRest;
65
+
57
66
  /**
58
67
  * TODO: At some stage I'll look into re-using more logic across 'default' and 'icon'
59
68
  * buttons. It's currently duplicated and mostly the same.
@@ -80,7 +89,6 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
80
89
  onPointerUpCapture: onPointerUpCapture,
81
90
  onTouchEndCapture: onTouchEndCapture,
82
91
  onTouchStartCapture: onTouchStartCapture,
83
- overlay: overlay,
84
92
  ref: ref,
85
93
  shape: shape,
86
94
  spacing: spacing,
@@ -105,9 +113,8 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
105
113
  hideTooltipOnClick: tooltip === null || tooltip === void 0 ? void 0 : tooltip.hideTooltipOnClick,
106
114
  hideTooltipOnMouseDown: tooltip === null || tooltip === void 0 ? void 0 : tooltip.hideTooltipOnMouseDown
107
115
  }, function (triggerProps) {
108
- return /*#__PURE__*/_react.default.createElement(_pressable.default
109
- // Top level props
110
- , (0, _extends2.default)({}, rest, {
116
+ return /*#__PURE__*/_react.default.createElement(_pressable.default, (0, _extends2.default)({}, rest, {
117
+ // Top level props
111
118
  "aria-labelledby": baseProps['aria-labelledby'],
112
119
  type: type,
113
120
  testId: testId,
@@ -9,10 +9,12 @@ 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 _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _anchor = _interopRequireDefault(require("@atlaskit/primitives/anchor"));
13
14
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
14
15
  var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
15
- 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", "overlay", "shape", "spacing", "testId", "tooltip", "UNSAFE_size"];
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
+ _excluded2 = ["className", "css", "as", "style"];
16
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); }
17
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; }
18
20
  var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
@@ -39,13 +41,19 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
39
41
  onPointerUpCapture = _ref.onPointerUpCapture,
40
42
  onTouchEndCapture = _ref.onTouchEndCapture,
41
43
  onTouchStartCapture = _ref.onTouchStartCapture,
42
- overlay = _ref.overlay,
43
44
  shape = _ref.shape,
44
45
  spacing = _ref.spacing,
45
46
  testId = _ref.testId,
46
47
  tooltip = _ref.tooltip,
47
48
  UNSAFE_size = _ref.UNSAFE_size,
48
- rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
49
+ unsafeRest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
50
+ // @ts-expect-error
51
+ var _className = unsafeRest.className,
52
+ _css = unsafeRest.css,
53
+ _as = unsafeRest.as,
54
+ _style = unsafeRest.style,
55
+ saferRest = (0, _objectWithoutProperties2.default)(unsafeRest, _excluded2);
56
+ var rest = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.remove-unsafe-spread-from-new-button_a2xhw') ? saferRest : unsafeRest;
49
57
  var baseProps = (0, _useIconButton.default)({
50
58
  analyticsContext: analyticsContext,
51
59
  appearance: appearance,
@@ -67,7 +75,6 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
67
75
  onPointerUpCapture: onPointerUpCapture,
68
76
  onTouchEndCapture: onTouchEndCapture,
69
77
  onTouchStartCapture: onTouchStartCapture,
70
- overlay: overlay,
71
78
  ref: ref,
72
79
  shape: shape,
73
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
- hasOverlay: hasOverlay
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
- hasOverlay = _ref.hasOverlay,
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)(hasOverlay ? [fadeStyles] : []), (0, _toConsumableArray2.default)(position === 'before' ? [beforeIconStyles] : []), (0, _toConsumableArray2.default)(position === 'after' ? [afterIconStyles] : []))
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 loadingOverlayStyles = (0, _primitives.xcss)({
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 overlayStyles = (0, _primitives.xcss)({
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 hasOverlay = Boolean(overlay);
561
- var isInteractive = !isDisabled && !isLoading && !hasOverlay;
562
- var isEffectivelyDisabled = isDisabled || Boolean(overlay);
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 && loadingOverlayStyles, (isDisabled || hasOverlay && !isLoading) && nonInteractiveStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
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, overlay ? /*#__PURE__*/_react.default.createElement(_primitives.Box, {
574
+ children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children, isLoading ? /*#__PURE__*/_react.default.createElement(_primitives.Box, {
577
575
  as: "span",
578
- xcss: overlayStyles
579
- }, overlay) : null, isLoading && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, {
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
- }, ", Loading")),
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: "17.22.2",
136
+ packageVersion: "18.0.0",
137
137
  analyticsData: analyticsContext
138
138
  });
139
139
 
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
4
  import Pressable from '@atlaskit/primitives/pressable';
4
5
  import useDefaultButton from './use-default-button';
5
6
  /**
@@ -34,15 +35,23 @@ const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function B
34
35
  onPointerUpCapture,
35
36
  onTouchEndCapture,
36
37
  onTouchStartCapture,
37
- overlay,
38
38
  shouldFitContainer,
39
39
  spacing,
40
40
  testId,
41
41
  type = 'button',
42
42
  UNSAFE_iconAfter_size,
43
43
  UNSAFE_iconBefore_size,
44
- ...rest
44
+ ...unsafeRest
45
45
  }, ref) {
46
+ // @ts-expect-error
47
+ const {
48
+ className: _className,
49
+ css: _css,
50
+ as: _as,
51
+ style: _style,
52
+ ...saferRest
53
+ } = unsafeRest;
54
+ const rest = getBooleanFF('platform.design-system-team.remove-unsafe-spread-from-new-button_a2xhw') ? saferRest : unsafeRest;
46
55
  const baseProps = useDefaultButton({
47
56
  ariaLabel,
48
57
  ariaLabelledBy,
@@ -67,7 +76,6 @@ const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function B
67
76
  onPointerUpCapture,
68
77
  onTouchEndCapture,
69
78
  onTouchStartCapture,
70
- overlay,
71
79
  ref,
72
80
  shouldFitContainer,
73
81
  spacing,
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { forwardRef, memo } from 'react';
3
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
4
  import Anchor from '@atlaskit/primitives/anchor';
4
5
  import useDefaultButton from './use-default-button';
5
6
  const LinkButtonBase = ({
@@ -25,19 +26,27 @@ const LinkButtonBase = ({
25
26
  onPointerUpCapture,
26
27
  onTouchEndCapture,
27
28
  onTouchStartCapture,
28
- overlay,
29
29
  shouldFitContainer,
30
30
  spacing,
31
31
  testId,
32
32
  UNSAFE_iconAfter_size,
33
33
  UNSAFE_iconBefore_size,
34
- ...rest
34
+ ...unsafeRest
35
35
  }, ref) => {
36
+ // @ts-expect-error
37
+ const {
38
+ className: _className,
39
+ css: _css,
40
+ as: _as,
41
+ style: _style,
42
+ ...saferRest
43
+ } = unsafeRest;
44
+ const rest = getBooleanFF('platform.design-system-team.remove-unsafe-spread-from-new-button_a2xhw') ? saferRest : unsafeRest;
36
45
  const baseProps = useDefaultButton({
37
- ariaLabel,
38
- ariaLabelledBy,
39
46
  analyticsContext,
40
47
  appearance,
48
+ ariaLabel,
49
+ ariaLabelledBy,
41
50
  autoFocus,
42
51
  buttonType: 'link',
43
52
  children,
@@ -56,7 +65,6 @@ const LinkButtonBase = ({
56
65
  onPointerUpCapture,
57
66
  onTouchEndCapture,
58
67
  onTouchStartCapture,
59
- overlay,
60
68
  ref,
61
69
  shouldFitContainer,
62
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
- hasOverlay: hasOverlay
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
- hasOverlay: hasOverlay
60
+ isLoading: isLoading
64
61
  }, children), iconAfter && /*#__PURE__*/React.createElement(Content, {
65
62
  type: "icon",
66
63
  position: "after",
67
- hasOverlay: hasOverlay
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
  });