@atlaskit/button 17.9.0 → 17.11.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 (48) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/new-button/variants/default/use-default-button.js +1 -0
  3. package/dist/cjs/new-button/variants/icon/button.js +105 -15
  4. package/dist/cjs/new-button/variants/icon/link.js +111 -14
  5. package/dist/cjs/new-button/variants/icon/use-icon-button.js +1 -0
  6. package/dist/cjs/new-button/variants/shared/loading-overlay.js +1 -4
  7. package/dist/cjs/new-button/variants/shared/use-button-base.js +4 -1
  8. package/dist/cjs/new-button/variants/shared/xcss.js +9 -3
  9. package/dist/cjs/old-button/shared/button-base.js +1 -1
  10. package/dist/es2019/new-button/variants/default/use-default-button.js +1 -0
  11. package/dist/es2019/new-button/variants/icon/button.js +101 -14
  12. package/dist/es2019/new-button/variants/icon/link.js +107 -13
  13. package/dist/es2019/new-button/variants/icon/use-icon-button.js +1 -0
  14. package/dist/es2019/new-button/variants/shared/loading-overlay.js +1 -4
  15. package/dist/es2019/new-button/variants/shared/use-button-base.js +3 -1
  16. package/dist/es2019/new-button/variants/shared/xcss.js +8 -2
  17. package/dist/es2019/old-button/shared/button-base.js +1 -1
  18. package/dist/esm/new-button/variants/default/use-default-button.js +1 -0
  19. package/dist/esm/new-button/variants/icon/button.js +105 -15
  20. package/dist/esm/new-button/variants/icon/link.js +111 -14
  21. package/dist/esm/new-button/variants/icon/use-icon-button.js +1 -0
  22. package/dist/esm/new-button/variants/shared/loading-overlay.js +1 -4
  23. package/dist/esm/new-button/variants/shared/use-button-base.js +4 -1
  24. package/dist/esm/new-button/variants/shared/xcss.js +9 -3
  25. package/dist/esm/old-button/shared/button-base.js +1 -1
  26. package/dist/types/containers/button-group.d.ts +4 -4
  27. package/dist/types/new-button/variants/default/types.d.ts +0 -4
  28. package/dist/types/new-button/variants/icon/link.d.ts +1 -1
  29. package/dist/types/new-button/variants/icon/types.d.ts +16 -6
  30. package/dist/types/new-button/variants/icon/use-icon-button.d.ts +1 -1
  31. package/dist/types/new-button/variants/shared/use-button-base.d.ts +2 -1
  32. package/dist/types/new-button/variants/shared/xcss.d.ts +2 -1
  33. package/dist/types/new-button/variants/types.d.ts +4 -0
  34. package/dist/types/old-button/types.d.ts +20 -20
  35. package/dist/types/utils/variants.d.ts +2 -2
  36. package/dist/types-ts4.5/containers/button-group.d.ts +4 -4
  37. package/dist/types-ts4.5/new-button/variants/default/types.d.ts +0 -4
  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/types.d.ts +16 -6
  40. package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +1 -1
  41. package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +2 -1
  42. package/dist/types-ts4.5/new-button/variants/shared/xcss.d.ts +2 -1
  43. package/dist/types-ts4.5/new-button/variants/types.d.ts +4 -0
  44. package/dist/types-ts4.5/old-button/types.d.ts +20 -20
  45. package/dist/types-ts4.5/utils/variants.d.ts +2 -2
  46. package/extract-react-types/new-button/variants/default/{common-props.tsx → common-default-button-props.tsx} +1 -1
  47. package/extract-react-types/new-button/variants/icon-button/icon-button-props.tsx +5 -0
  48. package/package.json +2 -1
@@ -1,34 +1,37 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { forwardRef, memo } from 'react';
3
3
  import UNSAFE_ANCHOR from '@atlaskit/primitives/anchor';
4
+ import Tooltip from '@atlaskit/tooltip';
4
5
  import useIconButton from './use-icon-button';
5
6
  const LinkIconButtonBase = ({
7
+ // Prevent duplicate labels being added.
8
+ 'aria-label': preventedAriaLabel,
6
9
  analyticsContext,
7
- interactionName,
8
- autoFocus,
9
10
  appearance,
10
- spacing,
11
+ autoFocus,
12
+ href,
13
+ icon,
14
+ interactionName,
11
15
  isDisabled,
12
16
  isSelected,
13
- icon,
17
+ isTooltipDisabled = true,
14
18
  label,
15
- overlay,
16
19
  onClick,
17
- onMouseDownCapture,
18
- onMouseUpCapture,
20
+ onClickCapture,
19
21
  onKeyDownCapture,
20
22
  onKeyUpCapture,
21
- onTouchStartCapture,
22
- onTouchEndCapture,
23
+ onMouseDownCapture,
24
+ onMouseUpCapture,
23
25
  onPointerDownCapture,
24
26
  onPointerUpCapture,
25
- onClickCapture,
27
+ onTouchEndCapture,
28
+ onTouchStartCapture,
29
+ overlay,
26
30
  shape,
31
+ spacing,
27
32
  testId,
33
+ tooltip,
28
34
  UNSAFE_size,
29
- href,
30
- // Prevent duplicate labels being added.
31
- 'aria-label': preventedAriaLabel,
32
35
  ...rest
33
36
  }, ref) => {
34
37
  const baseProps = useIconButton({
@@ -57,6 +60,97 @@ const LinkIconButtonBase = ({
57
60
  spacing,
58
61
  UNSAFE_size
59
62
  });
63
+ if (!isTooltipDisabled) {
64
+ var _tooltip$content;
65
+ return /*#__PURE__*/React.createElement(Tooltip, {
66
+ content: (_tooltip$content = tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) !== null && _tooltip$content !== void 0 ? _tooltip$content : label,
67
+ testId: tooltip === null || tooltip === void 0 ? void 0 : tooltip.testId,
68
+ position: tooltip === null || tooltip === void 0 ? void 0 : tooltip.position,
69
+ delay: tooltip === null || tooltip === void 0 ? void 0 : tooltip.delay,
70
+ onShow: tooltip === null || tooltip === void 0 ? void 0 : tooltip.onShow,
71
+ onHide: tooltip === null || tooltip === void 0 ? void 0 : tooltip.onHide,
72
+ mousePosition: tooltip === null || tooltip === void 0 ? void 0 : tooltip.mousePosition,
73
+ analyticsContext: tooltip === null || tooltip === void 0 ? void 0 : tooltip.analyticsContext,
74
+ strategy: tooltip === null || tooltip === void 0 ? void 0 : tooltip.strategy,
75
+ tag: tooltip === null || tooltip === void 0 ? void 0 : tooltip.tag,
76
+ truncate: tooltip === null || tooltip === void 0 ? void 0 : tooltip.truncate,
77
+ component: tooltip === null || tooltip === void 0 ? void 0 : tooltip.component,
78
+ hideTooltipOnClick: tooltip === null || tooltip === void 0 ? void 0 : tooltip.hideTooltipOnClick,
79
+ hideTooltipOnMouseDown: tooltip === null || tooltip === void 0 ? void 0 : tooltip.hideTooltipOnMouseDown
80
+ }, triggerProps => /*#__PURE__*/React.createElement(UNSAFE_ANCHOR
81
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
82
+ , _extends({}, rest, {
83
+ testId: testId,
84
+ componentName: "LinkIconButton",
85
+ analyticsContext: analyticsContext,
86
+ interactionName: interactionName
87
+ // Shared between tooltip and native props
88
+ ,
89
+ onMouseOver: e => {
90
+ var _triggerProps$onMouse, _rest$onMouseOver;
91
+ (_triggerProps$onMouse = triggerProps.onMouseOver) === null || _triggerProps$onMouse === void 0 ? void 0 : _triggerProps$onMouse.call(triggerProps, e);
92
+ (_rest$onMouseOver = rest.onMouseOver) === null || _rest$onMouseOver === void 0 ? void 0 : _rest$onMouseOver.call(rest, e);
93
+ },
94
+ onMouseOut: e => {
95
+ var _triggerProps$onMouse2, _rest$onMouseOut;
96
+ (_triggerProps$onMouse2 = triggerProps.onMouseOut) === null || _triggerProps$onMouse2 === void 0 ? void 0 : _triggerProps$onMouse2.call(triggerProps, e);
97
+ (_rest$onMouseOut = rest.onMouseOut) === null || _rest$onMouseOut === void 0 ? void 0 : _rest$onMouseOut.call(rest, e);
98
+ },
99
+ onMouseMove: e => {
100
+ var _triggerProps$onMouse3, _rest$onMouseMove;
101
+ (_triggerProps$onMouse3 = triggerProps.onMouseMove) === null || _triggerProps$onMouse3 === void 0 ? void 0 : _triggerProps$onMouse3.call(triggerProps, e);
102
+ (_rest$onMouseMove = rest.onMouseMove) === null || _rest$onMouseMove === void 0 ? void 0 : _rest$onMouseMove.call(rest, e);
103
+ },
104
+ onMouseDown: e => {
105
+ var _triggerProps$onMouse4, _rest$onMouseDown;
106
+ (_triggerProps$onMouse4 = triggerProps.onMouseDown) === null || _triggerProps$onMouse4 === void 0 ? void 0 : _triggerProps$onMouse4.call(triggerProps, e);
107
+ (_rest$onMouseDown = rest.onMouseDown) === null || _rest$onMouseDown === void 0 ? void 0 : _rest$onMouseDown.call(rest, e);
108
+ },
109
+ onFocus: e => {
110
+ var _triggerProps$onFocus, _rest$onFocus;
111
+ (_triggerProps$onFocus = triggerProps.onFocus) === null || _triggerProps$onFocus === void 0 ? void 0 : _triggerProps$onFocus.call(triggerProps, e);
112
+ (_rest$onFocus = rest.onFocus) === null || _rest$onFocus === void 0 ? void 0 : _rest$onFocus.call(rest, e);
113
+ },
114
+ onBlur: e => {
115
+ var _triggerProps$onBlur, _rest$onBlur;
116
+ (_triggerProps$onBlur = triggerProps.onBlur) === null || _triggerProps$onBlur === void 0 ? void 0 : _triggerProps$onBlur.call(triggerProps, e);
117
+ (_rest$onBlur = rest.onBlur) === null || _rest$onBlur === void 0 ? void 0 : _rest$onBlur.call(rest, e);
118
+ }
119
+ // Shared between tooltip and base props
120
+ ,
121
+ onClick: (event, analyticsEvent) => {
122
+ var _baseProps$onClick, _triggerProps$onClick;
123
+ baseProps === null || baseProps === void 0 ? void 0 : (_baseProps$onClick = baseProps.onClick) === null || _baseProps$onClick === void 0 ? void 0 : _baseProps$onClick.call(baseProps, event, analyticsEvent);
124
+ triggerProps === null || triggerProps === void 0 ? void 0 : (_triggerProps$onClick = triggerProps.onClick) === null || _triggerProps$onClick === void 0 ? void 0 : _triggerProps$onClick.call(triggerProps, event);
125
+ },
126
+ ref: ref => {
127
+ var _triggerProps$ref;
128
+ baseProps.ref(ref);
129
+ triggerProps === null || triggerProps === void 0 ? void 0 : (_triggerProps$ref = triggerProps.ref) === null || _triggerProps$ref === void 0 ? void 0 : _triggerProps$ref.call(triggerProps, ref);
130
+ }
131
+ // Base props only
132
+ ,
133
+ xcss: baseProps.xcss,
134
+ onMouseDownCapture: baseProps.onMouseDownCapture,
135
+ onMouseUpCapture: baseProps.onMouseUpCapture,
136
+ onKeyDownCapture: baseProps.onKeyDownCapture,
137
+ onKeyUpCapture: baseProps.onKeyUpCapture,
138
+ onTouchStartCapture: baseProps.onTouchStartCapture,
139
+ onTouchEndCapture: baseProps.onTouchEndCapture,
140
+ onPointerDownCapture: baseProps.onPointerDownCapture,
141
+ onPointerUpCapture: baseProps.onPointerUpCapture,
142
+ onClickCapture: baseProps.onClickCapture
143
+ /**
144
+ * Disable link in an accessible way using `href`, `role`, and `aria-disabled`.
145
+ * @see https://a11y-guidelines.orange.com/en/articles/disable-elements/#disable-a-link
146
+ */
147
+ // @ts-expect-error (`href` is required, we could make it optional but don't want to encourage this pattern elsewhere)
148
+ ,
149
+ href: baseProps.isDisabled ? undefined : href,
150
+ role: baseProps.isDisabled ? 'link' : undefined,
151
+ "aria-disabled": baseProps.isDisabled === true ? true : undefined
152
+ }), baseProps.children));
153
+ }
60
154
  return /*#__PURE__*/React.createElement(UNSAFE_ANCHOR
61
155
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
62
156
  , _extends({}, rest, {
@@ -56,6 +56,7 @@ const useIconButton = ({
56
56
  }), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)),
57
57
  interactionName,
58
58
  isDisabled,
59
+ isLoading,
59
60
  isSelected,
60
61
  isIconButton: true,
61
62
  isCircle,
@@ -15,12 +15,9 @@ function getSpinnerAppearance({
15
15
  isDisabled,
16
16
  isSelected
17
17
  }) {
18
- if (isDisabled) {
18
+ if (isDisabled || isSelected) {
19
19
  return 'inherit';
20
20
  }
21
- if (isSelected) {
22
- return 'invert';
23
- }
24
21
  if (appearance === 'primary' || appearance === 'danger') {
25
22
  return 'invert';
26
23
  }
@@ -33,6 +33,7 @@ const useButtonBase = ({
33
33
  autoFocus = false,
34
34
  buttonType,
35
35
  isDisabled: propIsDisabled = false,
36
+ isLoading = false,
36
37
  isSelected = false,
37
38
  // TODO: Separate Icon Button styling from button base
38
39
  isIconButton = false,
@@ -83,6 +84,7 @@ const useButtonBase = ({
83
84
  appearance,
84
85
  spacing,
85
86
  isDisabled,
87
+ isLoading,
86
88
  isSelected,
87
89
  isHighlighted,
88
90
  isActiveOverSelected,
@@ -95,7 +97,7 @@ const useButtonBase = ({
95
97
  hasIconAfter,
96
98
  isSplit: isSplitButton,
97
99
  isNavigationSplit: isNavigationSplitButton
98
- }), [appearance, buttonType, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
100
+ }), [appearance, buttonType, spacing, isDisabled, isLoading, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
99
101
  const isEffectivelyDisabled = isDisabled || Boolean(overlay);
100
102
  return {
101
103
  ref: setRef,
@@ -80,6 +80,7 @@ export function getXCSS({
80
80
  spacing,
81
81
  isDisabled,
82
82
  isSelected,
83
+ isLoading,
83
84
  isHighlighted,
84
85
  isActiveOverSelected,
85
86
  isIconButton,
@@ -157,8 +158,8 @@ export function getXCSS({
157
158
  // justifyContent required for shouldFitContainer buttons with an icon inside
158
159
  justifyContent: 'center',
159
160
  ...combinedBaseColorStyles,
160
- ...(isDisabled || hasOverlay ? {
161
- cursor: 'not-allowed'
161
+ ...(isDisabled || hasOverlay || isLoading ? {
162
+ cursor: isLoading ? 'progress' : 'not-allowed'
162
163
  } : {}),
163
164
  ':hover': {
164
165
  ...getColors({
@@ -185,6 +186,11 @@ export function getXCSS({
185
186
  // background, box-shadow
186
187
  transitionDuration: '0s, 0s'
187
188
  },
189
+ ':focus': {
190
+ // Required due to Jira's AUI CSS reset
191
+ // See https://product-fabric.atlassian.net/browse/DSP-15687
192
+ textDecoration: !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? 'underline' : 'none'
193
+ },
188
194
  ...splitButtonStyles
189
195
  });
190
196
  }
@@ -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: "17.9.0",
105
+ packageVersion: "17.11.0",
106
106
  analyticsData: analyticsContext
107
107
  });
108
108
 
@@ -63,6 +63,7 @@ var useDefaultButton = function useDefaultButton(_ref) {
63
63
  }))),
64
64
  interactionName: interactionName,
65
65
  isDisabled: isDisabled,
66
+ isLoading: isLoading,
66
67
  isSelected: isSelected,
67
68
  onClick: onClick,
68
69
  onMouseDownCapture: onMouseDownCapture,
@@ -1,8 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "isLoading", "icon", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "type", "testId", "UNSAFE_size", "aria-label"];
3
+ var _excluded = ["aria-label", "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"];
4
4
  import React from 'react';
5
5
  import UNSAFE_PRESSABLE from '@atlaskit/primitives/pressable';
6
+ import Tooltip from '@atlaskit/tooltip';
6
7
  import useIconButton from './use-icon-button';
7
8
  /**
8
9
  * __Icon Button__
@@ -14,33 +15,36 @@ import useIconButton from './use-icon-button';
14
15
  * - [Usage](https://atlassian.design/components/button/usage)
15
16
  */
16
17
  var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
17
- var analyticsContext = _ref.analyticsContext,
18
- interactionName = _ref.interactionName,
19
- autoFocus = _ref.autoFocus,
18
+ var preventedAriaLabel = _ref['aria-label'],
19
+ analyticsContext = _ref.analyticsContext,
20
20
  appearance = _ref.appearance,
21
- spacing = _ref.spacing,
21
+ autoFocus = _ref.autoFocus,
22
+ icon = _ref.icon,
23
+ interactionName = _ref.interactionName,
22
24
  isDisabled = _ref.isDisabled,
23
- isSelected = _ref.isSelected,
24
25
  isLoading = _ref.isLoading,
25
- icon = _ref.icon,
26
+ isSelected = _ref.isSelected,
27
+ _ref$isTooltipDisable = _ref.isTooltipDisabled,
28
+ isTooltipDisabled = _ref$isTooltipDisable === void 0 ? true : _ref$isTooltipDisable,
26
29
  label = _ref.label,
27
- overlay = _ref.overlay,
28
30
  onClick = _ref.onClick,
29
- onMouseDownCapture = _ref.onMouseDownCapture,
30
- onMouseUpCapture = _ref.onMouseUpCapture,
31
+ onClickCapture = _ref.onClickCapture,
31
32
  onKeyDownCapture = _ref.onKeyDownCapture,
32
33
  onKeyUpCapture = _ref.onKeyUpCapture,
33
- onTouchStartCapture = _ref.onTouchStartCapture,
34
- onTouchEndCapture = _ref.onTouchEndCapture,
34
+ onMouseDownCapture = _ref.onMouseDownCapture,
35
+ onMouseUpCapture = _ref.onMouseUpCapture,
35
36
  onPointerDownCapture = _ref.onPointerDownCapture,
36
37
  onPointerUpCapture = _ref.onPointerUpCapture,
37
- onClickCapture = _ref.onClickCapture,
38
+ onTouchEndCapture = _ref.onTouchEndCapture,
39
+ onTouchStartCapture = _ref.onTouchStartCapture,
40
+ overlay = _ref.overlay,
38
41
  shape = _ref.shape,
42
+ spacing = _ref.spacing,
43
+ testId = _ref.testId,
44
+ tooltip = _ref.tooltip,
39
45
  _ref$type = _ref.type,
40
46
  type = _ref$type === void 0 ? 'button' : _ref$type,
41
- testId = _ref.testId,
42
47
  UNSAFE_size = _ref.UNSAFE_size,
43
- preventedAriaLabel = _ref['aria-label'],
44
48
  rest = _objectWithoutProperties(_ref, _excluded);
45
49
  /**
46
50
  * TODO: At some stage I'll look into re-using more logic across 'default' and 'icon'
@@ -73,6 +77,92 @@ var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
73
77
  spacing: spacing,
74
78
  UNSAFE_size: UNSAFE_size
75
79
  });
80
+ if (!isTooltipDisabled) {
81
+ var _tooltip$content;
82
+ return /*#__PURE__*/React.createElement(Tooltip, {
83
+ content: (_tooltip$content = tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) !== null && _tooltip$content !== void 0 ? _tooltip$content : label,
84
+ testId: tooltip === null || tooltip === void 0 ? void 0 : tooltip.testId,
85
+ position: tooltip === null || tooltip === void 0 ? void 0 : tooltip.position,
86
+ delay: tooltip === null || tooltip === void 0 ? void 0 : tooltip.delay,
87
+ onShow: tooltip === null || tooltip === void 0 ? void 0 : tooltip.onShow,
88
+ onHide: tooltip === null || tooltip === void 0 ? void 0 : tooltip.onHide,
89
+ mousePosition: tooltip === null || tooltip === void 0 ? void 0 : tooltip.mousePosition,
90
+ analyticsContext: tooltip === null || tooltip === void 0 ? void 0 : tooltip.analyticsContext,
91
+ strategy: tooltip === null || tooltip === void 0 ? void 0 : tooltip.strategy,
92
+ tag: tooltip === null || tooltip === void 0 ? void 0 : tooltip.tag,
93
+ truncate: tooltip === null || tooltip === void 0 ? void 0 : tooltip.truncate,
94
+ component: tooltip === null || tooltip === void 0 ? void 0 : tooltip.component,
95
+ hideTooltipOnClick: tooltip === null || tooltip === void 0 ? void 0 : tooltip.hideTooltipOnClick,
96
+ hideTooltipOnMouseDown: tooltip === null || tooltip === void 0 ? void 0 : tooltip.hideTooltipOnMouseDown
97
+ }, function (triggerProps) {
98
+ return /*#__PURE__*/React.createElement(UNSAFE_PRESSABLE
99
+ // Top level props
100
+ , _extends({}, rest, {
101
+ type: type,
102
+ testId: testId,
103
+ componentName: "IconButton",
104
+ analyticsContext: analyticsContext,
105
+ interactionName: interactionName
106
+ // Shared between tooltip and native props
107
+ ,
108
+ onMouseOver: function onMouseOver(e) {
109
+ var _triggerProps$onMouse, _rest$onMouseOver;
110
+ (_triggerProps$onMouse = triggerProps.onMouseOver) === null || _triggerProps$onMouse === void 0 || _triggerProps$onMouse.call(triggerProps, e);
111
+ (_rest$onMouseOver = rest.onMouseOver) === null || _rest$onMouseOver === void 0 || _rest$onMouseOver.call(rest, e);
112
+ },
113
+ onMouseOut: function onMouseOut(e) {
114
+ var _triggerProps$onMouse2, _rest$onMouseOut;
115
+ (_triggerProps$onMouse2 = triggerProps.onMouseOut) === null || _triggerProps$onMouse2 === void 0 || _triggerProps$onMouse2.call(triggerProps, e);
116
+ (_rest$onMouseOut = rest.onMouseOut) === null || _rest$onMouseOut === void 0 || _rest$onMouseOut.call(rest, e);
117
+ },
118
+ onMouseMove: function onMouseMove(e) {
119
+ var _triggerProps$onMouse3, _rest$onMouseMove;
120
+ (_triggerProps$onMouse3 = triggerProps.onMouseMove) === null || _triggerProps$onMouse3 === void 0 || _triggerProps$onMouse3.call(triggerProps, e);
121
+ (_rest$onMouseMove = rest.onMouseMove) === null || _rest$onMouseMove === void 0 || _rest$onMouseMove.call(rest, e);
122
+ },
123
+ onMouseDown: function onMouseDown(e) {
124
+ var _triggerProps$onMouse4, _rest$onMouseDown;
125
+ (_triggerProps$onMouse4 = triggerProps.onMouseDown) === null || _triggerProps$onMouse4 === void 0 || _triggerProps$onMouse4.call(triggerProps, e);
126
+ (_rest$onMouseDown = rest.onMouseDown) === null || _rest$onMouseDown === void 0 || _rest$onMouseDown.call(rest, e);
127
+ },
128
+ onFocus: function onFocus(e) {
129
+ var _triggerProps$onFocus, _rest$onFocus;
130
+ (_triggerProps$onFocus = triggerProps.onFocus) === null || _triggerProps$onFocus === void 0 || _triggerProps$onFocus.call(triggerProps, e);
131
+ (_rest$onFocus = rest.onFocus) === null || _rest$onFocus === void 0 || _rest$onFocus.call(rest, e);
132
+ },
133
+ onBlur: function onBlur(e) {
134
+ var _triggerProps$onBlur, _rest$onBlur;
135
+ (_triggerProps$onBlur = triggerProps.onBlur) === null || _triggerProps$onBlur === void 0 || _triggerProps$onBlur.call(triggerProps, e);
136
+ (_rest$onBlur = rest.onBlur) === null || _rest$onBlur === void 0 || _rest$onBlur.call(rest, e);
137
+ }
138
+ // Shared between tooltip and base props
139
+ ,
140
+ onClick: function onClick(event, analyticsEvent) {
141
+ var _baseProps$onClick, _triggerProps$onClick;
142
+ baseProps === null || baseProps === void 0 || (_baseProps$onClick = baseProps.onClick) === null || _baseProps$onClick === void 0 || _baseProps$onClick.call(baseProps, event, analyticsEvent);
143
+ triggerProps === null || triggerProps === void 0 || (_triggerProps$onClick = triggerProps.onClick) === null || _triggerProps$onClick === void 0 || _triggerProps$onClick.call(triggerProps, event);
144
+ },
145
+ ref: function ref(_ref2) {
146
+ var _triggerProps$ref;
147
+ baseProps.ref(_ref2);
148
+ triggerProps === null || triggerProps === void 0 || (_triggerProps$ref = triggerProps.ref) === null || _triggerProps$ref === void 0 || _triggerProps$ref.call(triggerProps, _ref2);
149
+ }
150
+ // Base props only
151
+ ,
152
+ xcss: baseProps.xcss,
153
+ isDisabled: baseProps.isDisabled,
154
+ onMouseDownCapture: baseProps.onMouseDownCapture,
155
+ onMouseUpCapture: baseProps.onMouseUpCapture,
156
+ onKeyDownCapture: baseProps.onKeyDownCapture,
157
+ onKeyUpCapture: baseProps.onKeyUpCapture,
158
+ onTouchStartCapture: baseProps.onTouchStartCapture,
159
+ onTouchEndCapture: baseProps.onTouchEndCapture,
160
+ onPointerDownCapture: baseProps.onPointerDownCapture,
161
+ onPointerUpCapture: baseProps.onPointerUpCapture,
162
+ onClickCapture: baseProps.onClickCapture
163
+ }), baseProps.children);
164
+ });
165
+ }
76
166
  return /*#__PURE__*/React.createElement(UNSAFE_PRESSABLE, _extends({}, rest, {
77
167
  ref: baseProps.ref,
78
168
  xcss: baseProps.xcss,
@@ -1,35 +1,39 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
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"];
3
+ var _excluded = ["aria-label", "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"];
4
4
  import React, { forwardRef, memo } from 'react';
5
5
  import UNSAFE_ANCHOR from '@atlaskit/primitives/anchor';
6
+ import Tooltip from '@atlaskit/tooltip';
6
7
  import useIconButton from './use-icon-button';
7
8
  var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
8
- var analyticsContext = _ref.analyticsContext,
9
- interactionName = _ref.interactionName,
10
- autoFocus = _ref.autoFocus,
9
+ var preventedAriaLabel = _ref['aria-label'],
10
+ analyticsContext = _ref.analyticsContext,
11
11
  appearance = _ref.appearance,
12
- spacing = _ref.spacing,
12
+ autoFocus = _ref.autoFocus,
13
+ href = _ref.href,
14
+ icon = _ref.icon,
15
+ interactionName = _ref.interactionName,
13
16
  isDisabled = _ref.isDisabled,
14
17
  isSelected = _ref.isSelected,
15
- icon = _ref.icon,
18
+ _ref$isTooltipDisable = _ref.isTooltipDisabled,
19
+ isTooltipDisabled = _ref$isTooltipDisable === void 0 ? true : _ref$isTooltipDisable,
16
20
  label = _ref.label,
17
- overlay = _ref.overlay,
18
21
  onClick = _ref.onClick,
19
- onMouseDownCapture = _ref.onMouseDownCapture,
20
- onMouseUpCapture = _ref.onMouseUpCapture,
22
+ onClickCapture = _ref.onClickCapture,
21
23
  onKeyDownCapture = _ref.onKeyDownCapture,
22
24
  onKeyUpCapture = _ref.onKeyUpCapture,
23
- onTouchStartCapture = _ref.onTouchStartCapture,
24
- onTouchEndCapture = _ref.onTouchEndCapture,
25
+ onMouseDownCapture = _ref.onMouseDownCapture,
26
+ onMouseUpCapture = _ref.onMouseUpCapture,
25
27
  onPointerDownCapture = _ref.onPointerDownCapture,
26
28
  onPointerUpCapture = _ref.onPointerUpCapture,
27
- onClickCapture = _ref.onClickCapture,
29
+ onTouchEndCapture = _ref.onTouchEndCapture,
30
+ onTouchStartCapture = _ref.onTouchStartCapture,
31
+ overlay = _ref.overlay,
28
32
  shape = _ref.shape,
33
+ spacing = _ref.spacing,
29
34
  testId = _ref.testId,
35
+ tooltip = _ref.tooltip,
30
36
  UNSAFE_size = _ref.UNSAFE_size,
31
- href = _ref.href,
32
- preventedAriaLabel = _ref['aria-label'],
33
37
  rest = _objectWithoutProperties(_ref, _excluded);
34
38
  var baseProps = useIconButton({
35
39
  analyticsContext: analyticsContext,
@@ -57,6 +61,99 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
57
61
  spacing: spacing,
58
62
  UNSAFE_size: UNSAFE_size
59
63
  });
64
+ if (!isTooltipDisabled) {
65
+ var _tooltip$content;
66
+ return /*#__PURE__*/React.createElement(Tooltip, {
67
+ content: (_tooltip$content = tooltip === null || tooltip === void 0 ? void 0 : tooltip.content) !== null && _tooltip$content !== void 0 ? _tooltip$content : label,
68
+ testId: tooltip === null || tooltip === void 0 ? void 0 : tooltip.testId,
69
+ position: tooltip === null || tooltip === void 0 ? void 0 : tooltip.position,
70
+ delay: tooltip === null || tooltip === void 0 ? void 0 : tooltip.delay,
71
+ onShow: tooltip === null || tooltip === void 0 ? void 0 : tooltip.onShow,
72
+ onHide: tooltip === null || tooltip === void 0 ? void 0 : tooltip.onHide,
73
+ mousePosition: tooltip === null || tooltip === void 0 ? void 0 : tooltip.mousePosition,
74
+ analyticsContext: tooltip === null || tooltip === void 0 ? void 0 : tooltip.analyticsContext,
75
+ strategy: tooltip === null || tooltip === void 0 ? void 0 : tooltip.strategy,
76
+ tag: tooltip === null || tooltip === void 0 ? void 0 : tooltip.tag,
77
+ truncate: tooltip === null || tooltip === void 0 ? void 0 : tooltip.truncate,
78
+ component: tooltip === null || tooltip === void 0 ? void 0 : tooltip.component,
79
+ hideTooltipOnClick: tooltip === null || tooltip === void 0 ? void 0 : tooltip.hideTooltipOnClick,
80
+ hideTooltipOnMouseDown: tooltip === null || tooltip === void 0 ? void 0 : tooltip.hideTooltipOnMouseDown
81
+ }, function (triggerProps) {
82
+ return /*#__PURE__*/React.createElement(UNSAFE_ANCHOR
83
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
84
+ , _extends({}, rest, {
85
+ testId: testId,
86
+ componentName: "LinkIconButton",
87
+ analyticsContext: analyticsContext,
88
+ interactionName: interactionName
89
+ // Shared between tooltip and native props
90
+ ,
91
+ onMouseOver: function onMouseOver(e) {
92
+ var _triggerProps$onMouse, _rest$onMouseOver;
93
+ (_triggerProps$onMouse = triggerProps.onMouseOver) === null || _triggerProps$onMouse === void 0 || _triggerProps$onMouse.call(triggerProps, e);
94
+ (_rest$onMouseOver = rest.onMouseOver) === null || _rest$onMouseOver === void 0 || _rest$onMouseOver.call(rest, e);
95
+ },
96
+ onMouseOut: function onMouseOut(e) {
97
+ var _triggerProps$onMouse2, _rest$onMouseOut;
98
+ (_triggerProps$onMouse2 = triggerProps.onMouseOut) === null || _triggerProps$onMouse2 === void 0 || _triggerProps$onMouse2.call(triggerProps, e);
99
+ (_rest$onMouseOut = rest.onMouseOut) === null || _rest$onMouseOut === void 0 || _rest$onMouseOut.call(rest, e);
100
+ },
101
+ onMouseMove: function onMouseMove(e) {
102
+ var _triggerProps$onMouse3, _rest$onMouseMove;
103
+ (_triggerProps$onMouse3 = triggerProps.onMouseMove) === null || _triggerProps$onMouse3 === void 0 || _triggerProps$onMouse3.call(triggerProps, e);
104
+ (_rest$onMouseMove = rest.onMouseMove) === null || _rest$onMouseMove === void 0 || _rest$onMouseMove.call(rest, e);
105
+ },
106
+ onMouseDown: function onMouseDown(e) {
107
+ var _triggerProps$onMouse4, _rest$onMouseDown;
108
+ (_triggerProps$onMouse4 = triggerProps.onMouseDown) === null || _triggerProps$onMouse4 === void 0 || _triggerProps$onMouse4.call(triggerProps, e);
109
+ (_rest$onMouseDown = rest.onMouseDown) === null || _rest$onMouseDown === void 0 || _rest$onMouseDown.call(rest, e);
110
+ },
111
+ onFocus: function onFocus(e) {
112
+ var _triggerProps$onFocus, _rest$onFocus;
113
+ (_triggerProps$onFocus = triggerProps.onFocus) === null || _triggerProps$onFocus === void 0 || _triggerProps$onFocus.call(triggerProps, e);
114
+ (_rest$onFocus = rest.onFocus) === null || _rest$onFocus === void 0 || _rest$onFocus.call(rest, e);
115
+ },
116
+ onBlur: function onBlur(e) {
117
+ var _triggerProps$onBlur, _rest$onBlur;
118
+ (_triggerProps$onBlur = triggerProps.onBlur) === null || _triggerProps$onBlur === void 0 || _triggerProps$onBlur.call(triggerProps, e);
119
+ (_rest$onBlur = rest.onBlur) === null || _rest$onBlur === void 0 || _rest$onBlur.call(rest, e);
120
+ }
121
+ // Shared between tooltip and base props
122
+ ,
123
+ onClick: function onClick(event, analyticsEvent) {
124
+ var _baseProps$onClick, _triggerProps$onClick;
125
+ baseProps === null || baseProps === void 0 || (_baseProps$onClick = baseProps.onClick) === null || _baseProps$onClick === void 0 || _baseProps$onClick.call(baseProps, event, analyticsEvent);
126
+ triggerProps === null || triggerProps === void 0 || (_triggerProps$onClick = triggerProps.onClick) === null || _triggerProps$onClick === void 0 || _triggerProps$onClick.call(triggerProps, event);
127
+ },
128
+ ref: function ref(_ref2) {
129
+ var _triggerProps$ref;
130
+ baseProps.ref(_ref2);
131
+ triggerProps === null || triggerProps === void 0 || (_triggerProps$ref = triggerProps.ref) === null || _triggerProps$ref === void 0 || _triggerProps$ref.call(triggerProps, _ref2);
132
+ }
133
+ // Base props only
134
+ ,
135
+ xcss: baseProps.xcss,
136
+ onMouseDownCapture: baseProps.onMouseDownCapture,
137
+ onMouseUpCapture: baseProps.onMouseUpCapture,
138
+ onKeyDownCapture: baseProps.onKeyDownCapture,
139
+ onKeyUpCapture: baseProps.onKeyUpCapture,
140
+ onTouchStartCapture: baseProps.onTouchStartCapture,
141
+ onTouchEndCapture: baseProps.onTouchEndCapture,
142
+ onPointerDownCapture: baseProps.onPointerDownCapture,
143
+ onPointerUpCapture: baseProps.onPointerUpCapture,
144
+ onClickCapture: baseProps.onClickCapture
145
+ /**
146
+ * Disable link in an accessible way using `href`, `role`, and `aria-disabled`.
147
+ * @see https://a11y-guidelines.orange.com/en/articles/disable-elements/#disable-a-link
148
+ */
149
+ // @ts-expect-error (`href` is required, we could make it optional but don't want to encourage this pattern elsewhere)
150
+ ,
151
+ href: baseProps.isDisabled ? undefined : href,
152
+ role: baseProps.isDisabled ? 'link' : undefined,
153
+ "aria-disabled": baseProps.isDisabled === true ? true : undefined
154
+ }), baseProps.children);
155
+ });
156
+ }
60
157
  return /*#__PURE__*/React.createElement(UNSAFE_ANCHOR
61
158
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
62
159
  , _extends({}, rest, {
@@ -55,6 +55,7 @@ var useIconButton = function useIconButton(_ref) {
55
55
  }), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)),
56
56
  interactionName: interactionName,
57
57
  isDisabled: isDisabled,
58
+ isLoading: isLoading,
58
59
  isSelected: isSelected,
59
60
  isIconButton: true,
60
61
  isCircle: isCircle,
@@ -14,12 +14,9 @@ function getSpinnerAppearance(_ref) {
14
14
  var appearance = _ref.appearance,
15
15
  isDisabled = _ref.isDisabled,
16
16
  isSelected = _ref.isSelected;
17
- if (isDisabled) {
17
+ if (isDisabled || isSelected) {
18
18
  return 'inherit';
19
19
  }
20
- if (isSelected) {
21
- return 'invert';
22
- }
23
20
  if (appearance === 'primary' || appearance === 'danger') {
24
21
  return 'invert';
25
22
  }
@@ -39,6 +39,8 @@ var useButtonBase = function useButtonBase(_ref) {
39
39
  buttonType = _ref.buttonType,
40
40
  _ref$isDisabled = _ref.isDisabled,
41
41
  propIsDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
42
+ _ref$isLoading = _ref.isLoading,
43
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
42
44
  _ref$isSelected = _ref.isSelected,
43
45
  isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
44
46
  _ref$isIconButton = _ref.isIconButton,
@@ -94,6 +96,7 @@ var useButtonBase = function useButtonBase(_ref) {
94
96
  appearance: appearance,
95
97
  spacing: spacing,
96
98
  isDisabled: isDisabled,
99
+ isLoading: isLoading,
97
100
  isSelected: isSelected,
98
101
  isHighlighted: isHighlighted,
99
102
  isActiveOverSelected: isActiveOverSelected,
@@ -107,7 +110,7 @@ var useButtonBase = function useButtonBase(_ref) {
107
110
  isSplit: isSplitButton,
108
111
  isNavigationSplit: isNavigationSplitButton
109
112
  });
110
- }, [appearance, buttonType, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
113
+ }, [appearance, buttonType, spacing, isDisabled, isLoading, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
111
114
  var isEffectivelyDisabled = isDisabled || Boolean(overlay);
112
115
  return _objectSpread({
113
116
  ref: setRef,
@@ -82,6 +82,7 @@ export function getXCSS(_ref3) {
82
82
  spacing = _ref3.spacing,
83
83
  isDisabled = _ref3.isDisabled,
84
84
  isSelected = _ref3.isSelected,
85
+ isLoading = _ref3.isLoading,
85
86
  isHighlighted = _ref3.isHighlighted,
86
87
  isActiveOverSelected = _ref3.isActiveOverSelected,
87
88
  isIconButton = _ref3.isIconButton,
@@ -154,8 +155,8 @@ export function getXCSS(_ref3) {
154
155
  width: width,
155
156
  // justifyContent required for shouldFitContainer buttons with an icon inside
156
157
  justifyContent: 'center'
157
- }, combinedBaseColorStyles), isDisabled || hasOverlay ? {
158
- cursor: 'not-allowed'
158
+ }, combinedBaseColorStyles), isDisabled || hasOverlay || isLoading ? {
159
+ cursor: isLoading ? 'progress' : 'not-allowed'
159
160
  } : {}), {}, {
160
161
  ':hover': _objectSpread(_objectSpread({}, getColors({
161
162
  appearance: appearance,
@@ -179,6 +180,11 @@ export function getXCSS(_ref3) {
179
180
  })), {}, {
180
181
  // background, box-shadow
181
182
  transitionDuration: '0s, 0s'
182
- })
183
+ }),
184
+ ':focus': {
185
+ // Required due to Jira's AUI CSS reset
186
+ // See https://product-fabric.atlassian.net/browse/DSP-15687
187
+ textDecoration: !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? 'underline' : 'none'
188
+ }
183
189
  }, splitButtonStyles));
184
190
  }
@@ -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: "17.9.0",
111
+ packageVersion: "17.11.0",
112
112
  analyticsData: analyticsContext
113
113
  });
114
114