@atlaskit/button 17.17.3 → 17.18.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 (66) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/cjs/containers/button-group.js +3 -1
  3. package/dist/cjs/new-button/containers/split-button/split-button.js +6 -2
  4. package/dist/cjs/new-button/variants/default/button.js +8 -1
  5. package/dist/cjs/new-button/variants/default/link.js +8 -1
  6. package/dist/cjs/new-button/variants/default/use-default-button.js +7 -1
  7. package/dist/cjs/new-button/variants/icon/button.js +6 -1
  8. package/dist/cjs/new-button/variants/icon/link.js +6 -1
  9. package/dist/cjs/new-button/variants/icon/use-icon-button.js +7 -1
  10. package/dist/cjs/new-button/variants/shared/constants.js +7 -0
  11. package/dist/cjs/new-button/variants/shared/loading-overlay.js +4 -3
  12. package/dist/cjs/new-button/variants/shared/use-button-base.js +54 -2
  13. package/dist/cjs/old-button/button.js +1 -1
  14. package/dist/cjs/old-button/custom-theme-button/custom-theme-button.js +1 -1
  15. package/dist/cjs/old-button/custom-theme-button/theme.js +1 -1
  16. package/dist/cjs/old-button/shared/button-base.js +9 -3
  17. package/dist/cjs/old-button/shared/css.js +4 -3
  18. package/dist/es2019/containers/button-group.js +3 -1
  19. package/dist/es2019/new-button/containers/split-button/split-button.js +5 -2
  20. package/dist/es2019/new-button/variants/default/button.js +7 -0
  21. package/dist/es2019/new-button/variants/default/link.js +7 -0
  22. package/dist/es2019/new-button/variants/default/use-default-button.js +7 -1
  23. package/dist/es2019/new-button/variants/icon/button.js +5 -0
  24. package/dist/es2019/new-button/variants/icon/link.js +5 -0
  25. package/dist/es2019/new-button/variants/icon/use-icon-button.js +7 -1
  26. package/dist/es2019/new-button/variants/shared/constants.js +1 -0
  27. package/dist/es2019/new-button/variants/shared/loading-overlay.js +4 -3
  28. package/dist/es2019/new-button/variants/shared/use-button-base.js +54 -2
  29. package/dist/es2019/old-button/button.js +3 -0
  30. package/dist/es2019/old-button/custom-theme-button/custom-theme-button.js +3 -0
  31. package/dist/es2019/old-button/custom-theme-button/theme.js +2 -0
  32. package/dist/es2019/old-button/shared/button-base.js +10 -3
  33. package/dist/es2019/old-button/shared/css.js +4 -2
  34. package/dist/esm/containers/button-group.js +3 -1
  35. package/dist/esm/new-button/containers/split-button/split-button.js +5 -2
  36. package/dist/esm/new-button/variants/default/button.js +8 -1
  37. package/dist/esm/new-button/variants/default/link.js +8 -1
  38. package/dist/esm/new-button/variants/default/use-default-button.js +7 -1
  39. package/dist/esm/new-button/variants/icon/button.js +6 -1
  40. package/dist/esm/new-button/variants/icon/link.js +6 -1
  41. package/dist/esm/new-button/variants/icon/use-icon-button.js +7 -1
  42. package/dist/esm/new-button/variants/shared/constants.js +1 -0
  43. package/dist/esm/new-button/variants/shared/loading-overlay.js +4 -3
  44. package/dist/esm/new-button/variants/shared/use-button-base.js +54 -2
  45. package/dist/esm/old-button/button.js +3 -0
  46. package/dist/esm/old-button/custom-theme-button/custom-theme-button.js +3 -0
  47. package/dist/esm/old-button/custom-theme-button/theme.js +2 -0
  48. package/dist/esm/old-button/shared/button-base.js +10 -3
  49. package/dist/esm/old-button/shared/css.js +4 -2
  50. package/dist/types/new-button/variants/default/link.d.ts +1 -1
  51. package/dist/types/new-button/variants/default/types.d.ts +1 -1
  52. package/dist/types/new-button/variants/default/use-default-button.d.ts +4 -3
  53. package/dist/types/new-button/variants/icon/link.d.ts +1 -1
  54. package/dist/types/new-button/variants/icon/use-icon-button.d.ts +4 -3
  55. package/dist/types/new-button/variants/shared/constants.d.ts +1 -0
  56. package/dist/types/new-button/variants/shared/loading-overlay.d.ts +2 -1
  57. package/dist/types/new-button/variants/shared/use-button-base.d.ts +5 -1
  58. package/dist/types-ts4.5/new-button/variants/default/link.d.ts +1 -1
  59. package/dist/types-ts4.5/new-button/variants/default/types.d.ts +1 -1
  60. package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +4 -3
  61. package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -1
  62. package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +4 -3
  63. package/dist/types-ts4.5/new-button/variants/shared/constants.d.ts +1 -0
  64. package/dist/types-ts4.5/new-button/variants/shared/loading-overlay.d.ts +2 -1
  65. package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +5 -1
  66. package/package.json +202 -201
@@ -16,7 +16,7 @@ var _buttonBase = _interopRequireDefault(require("../shared/button-base"));
16
16
  var _getIsOnlySingleIcon = _interopRequireDefault(require("../shared/get-is-only-single-icon"));
17
17
  var _loadingSpinner = _interopRequireDefault(require("../shared/loading-spinner"));
18
18
  var _theme = _interopRequireWildcard(require("./theme"));
19
- var _excluded = ["appearance", "autoFocus", "isDisabled", "isSelected", "shouldFitContainer", "spacing", "isLoading", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "theme"];
19
+ var _excluded = ["appearance", "autoFocus", "isDisabled", "isSelected", "shouldFitContainer", "spacing", "isLoading", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "theme"]; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
20
20
  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); }
21
21
  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; }
22
22
  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; }
@@ -12,7 +12,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
12
12
  var _components = require("@atlaskit/theme/components");
13
13
  var _css = require("../shared/css");
14
14
  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; }
15
- 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; }
15
+ 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; } // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
16
16
  var stateToSelectorMap = {
17
17
  focus: '&:focus',
18
18
  focusSelected: '&:focus',
@@ -22,6 +22,7 @@ var _getIfVisuallyHiddenChildren = require("./get-if-visually-hidden-children");
22
22
  var _excluded = ["analyticsContext", "appearance", "autoFocus", "buttonCss", "children", "className", "href", "component", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isSelected", "onBlur", "onClick", "onFocus", "onMouseDown", "overlay", "shouldFitContainer", "spacing", "tabIndex", "type", "testId"];
23
23
  /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
24
24
  /** @jsx jsx */
25
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
26
  // eslint-disable-next-line no-duplicate-imports
26
27
  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); }
27
28
  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; }
@@ -129,7 +130,7 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
129
130
  action: 'clicked',
130
131
  componentName: 'button',
131
132
  packageName: "@atlaskit/button",
132
- packageVersion: "17.17.3",
133
+ packageVersion: "17.18.0",
133
134
  analyticsData: analyticsContext
134
135
  });
135
136
 
@@ -149,6 +150,7 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
149
150
 
150
151
  // we are 'disabling' input with a button when there is an overlay
151
152
  var hasOverlay = Boolean(overlay);
153
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
152
154
  var fadeStyles = (0, _react2.css)((0, _css.getFadingCss)({
153
155
  hasOverlay: hasOverlay
154
156
  }));
@@ -192,13 +194,17 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
192
194
  }, (0, _blockEvents.default)({
193
195
  isInteractive: isInteractive
194
196
  })), iconBefore ? (0, _react2.jsx)("span", {
195
- css: [fadeStyles, (0, _css.getIconStyle)({
197
+ css: [fadeStyles,
198
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
199
+ (0, _css.getIconStyle)({
196
200
  spacing: spacing
197
201
  }), getSpacingFix(children, iconBeforeSpacingFixStyle)]
198
202
  }, iconBefore) : null, getChildren(children, [fadeStyles, (0, _css.getContentStyle)({
199
203
  spacing: spacing
200
204
  })]), iconAfter ? (0, _react2.jsx)("span", {
201
- css: [fadeStyles, (0, _css.getIconStyle)({
205
+ css: [fadeStyles,
206
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
207
+ (0, _css.getIconStyle)({
202
208
  spacing: spacing
203
209
  }), getSpacingFix(children, iconAfterSpacingFixStyle)]
204
210
  }, iconAfter) : null, overlay ? (0, _react2.jsx)("span", {
@@ -14,7 +14,7 @@ var _react = require("@emotion/react");
14
14
  var _constants = require("@atlaskit/theme/constants");
15
15
  var _colors = _interopRequireDefault(require("./colors"));
16
16
  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; }
17
- 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; }
17
+ 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; } // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
18
18
  var gridSize = (0, _constants.gridSize)();
19
19
  var fontSize = (0, _constants.fontSize)();
20
20
 
@@ -196,7 +196,7 @@ function getIconStyle(_ref4) {
196
196
  return (0, _react.css)({
197
197
  display: 'flex',
198
198
  // icon size cannot grow and shrink
199
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
199
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
200
200
  margin: spacing === 'none' ? 0 : innerMargin.icon,
201
201
  flexGrow: 0,
202
202
  flexShrink: 0,
@@ -211,7 +211,7 @@ function getIconStyle(_ref4) {
211
211
  function getContentStyle(_ref5) {
212
212
  var spacing = _ref5.spacing;
213
213
  return (0, _react.css)({
214
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
214
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
215
215
  margin: spacing === 'none' ? 0 : innerMargin.content,
216
216
  // content can grow and shrink
217
217
  flexGrow: 1,
@@ -225,6 +225,7 @@ function getContentStyle(_ref5) {
225
225
  function getFadingCss(_ref6) {
226
226
  var hasOverlay = _ref6.hasOverlay;
227
227
  return (0, _react.css)({
228
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
228
229
  opacity: hasOverlay ? 0 : 1,
229
230
  transition: 'opacity 0.3s'
230
231
  });
@@ -1,10 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import React, { Fragment } from 'react';
3
+
4
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
3
5
  import { css, jsx } from '@emotion/react';
4
6
  const buttonGroupStyles = css({
5
7
  display: 'inline-flex',
6
8
  gap: "var(--ds-space-050, 4px)",
7
- // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
9
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
8
10
  '> *': {
9
11
  flex: '1 0 auto'
10
12
  }
@@ -1,5 +1,6 @@
1
1
  /** @jsx jsx */
2
2
 
3
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
3
4
  import { css, jsx } from '@emotion/react';
4
5
  import { fontSize as getFontSize } from '@atlaskit/theme/constants';
5
6
  const fontSize = getFontSize();
@@ -17,9 +18,11 @@ const baseDividerStyles = css({
17
18
  zIndex: 2
18
19
  });
19
20
  const defaultDividerStyles = css({
21
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
20
22
  height: heights.default
21
23
  });
22
24
  const compactDividerStyles = css({
25
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
23
26
  height: heights.compact
24
27
  });
25
28
  const dividerDisabledStyles = css({
@@ -69,14 +72,14 @@ const splitButtonStyles = css({
69
72
  whiteSpace: 'nowrap'
70
73
  });
71
74
  const primaryButtonStyles = css({
72
- // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
75
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
73
76
  'button,a': {
74
77
  borderEndEndRadius: 0,
75
78
  borderStartEndRadius: 0
76
79
  }
77
80
  });
78
81
  const secondaryButtonStyles = css({
79
- // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
82
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
80
83
  'button,a': {
81
84
  borderEndStartRadius: 0,
82
85
  borderStartStartRadius: 0
@@ -14,6 +14,8 @@ import useDefaultButton from './use-default-button';
14
14
  const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button({
15
15
  analyticsContext,
16
16
  appearance,
17
+ 'aria-label': ariaLabel,
18
+ 'aria-labelledby': ariaLabelledBy,
17
19
  autoFocus,
18
20
  children,
19
21
  iconAfter,
@@ -42,6 +44,8 @@ const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function B
42
44
  ...rest
43
45
  }, ref) {
44
46
  const baseProps = useDefaultButton({
47
+ ariaLabel,
48
+ ariaLabelledBy,
45
49
  analyticsContext,
46
50
  appearance,
47
51
  autoFocus,
@@ -67,12 +71,15 @@ const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function B
67
71
  ref,
68
72
  shouldFitContainer,
69
73
  spacing,
74
+ testId,
70
75
  UNSAFE_iconAfter_size,
71
76
  UNSAFE_iconBefore_size
72
77
  });
73
78
  return /*#__PURE__*/React.createElement(Pressable
74
79
  // TODO: Remove spread props
75
80
  , _extends({}, rest, {
81
+ "aria-label": baseProps['aria-label'],
82
+ "aria-labelledby": baseProps['aria-labelledby'],
76
83
  ref: baseProps.ref,
77
84
  xcss: baseProps.xcss,
78
85
  isDisabled: baseProps.isDisabled,
@@ -5,6 +5,8 @@ import useDefaultButton from './use-default-button';
5
5
  const LinkButtonBase = ({
6
6
  analyticsContext,
7
7
  appearance,
8
+ 'aria-label': ariaLabel,
9
+ 'aria-labelledby': ariaLabelledBy,
8
10
  autoFocus,
9
11
  children,
10
12
  href,
@@ -32,6 +34,8 @@ const LinkButtonBase = ({
32
34
  ...rest
33
35
  }, ref) => {
34
36
  const baseProps = useDefaultButton({
37
+ ariaLabel,
38
+ ariaLabelledBy,
35
39
  analyticsContext,
36
40
  appearance,
37
41
  autoFocus,
@@ -56,12 +60,15 @@ const LinkButtonBase = ({
56
60
  ref,
57
61
  shouldFitContainer,
58
62
  spacing,
63
+ testId,
59
64
  UNSAFE_iconAfter_size,
60
65
  UNSAFE_iconBefore_size
61
66
  });
62
67
  return /*#__PURE__*/React.createElement(Anchor
63
68
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
64
69
  , _extends({}, rest, {
70
+ "aria-label": baseProps['aria-label'],
71
+ "aria-labelledby": baseProps['aria-labelledby'],
65
72
  ref: baseProps.ref,
66
73
  xcss: baseProps.xcss,
67
74
  onClick: baseProps.onClick,
@@ -14,6 +14,8 @@ import useButtonBase from '../shared/use-button-base';
14
14
  const useDefaultButton = ({
15
15
  analyticsContext,
16
16
  appearance,
17
+ ariaLabel,
18
+ ariaLabelledBy,
17
19
  autoFocus,
18
20
  buttonType,
19
21
  children,
@@ -37,6 +39,7 @@ const useDefaultButton = ({
37
39
  ref,
38
40
  shouldFitContainer,
39
41
  spacing,
42
+ testId,
40
43
  UNSAFE_iconAfter_size,
41
44
  UNSAFE_iconBefore_size
42
45
  }) => {
@@ -45,6 +48,8 @@ const useDefaultButton = ({
45
48
  analyticsContext,
46
49
  appearance,
47
50
  autoFocus,
51
+ ariaLabel,
52
+ ariaLabelledBy,
48
53
  buttonType,
49
54
  children: /*#__PURE__*/React.createElement(Fragment, null, IconBefore && /*#__PURE__*/React.createElement(Content, {
50
55
  type: "icon",
@@ -83,7 +88,8 @@ const useDefaultButton = ({
83
88
  spacing,
84
89
  appearance,
85
90
  isDisabled,
86
- isSelected
91
+ isSelected,
92
+ testId
87
93
  }) : overlay,
88
94
  ref,
89
95
  shouldFitContainer,
@@ -15,6 +15,7 @@ import useIconButton from './use-icon-button';
15
15
  const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button({
16
16
  // Prevent duplicate labels being added.
17
17
  'aria-label': preventedAriaLabel,
18
+ 'aria-labelledby': ariaLabelledBy,
18
19
  analyticsContext,
19
20
  appearance,
20
21
  autoFocus,
@@ -51,6 +52,7 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
51
52
  const baseProps = useIconButton({
52
53
  analyticsContext,
53
54
  appearance,
55
+ ariaLabelledBy,
54
56
  autoFocus,
55
57
  buttonType: 'button',
56
58
  icon,
@@ -73,6 +75,7 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
73
75
  ref,
74
76
  shape,
75
77
  spacing,
78
+ testId,
76
79
  UNSAFE_size
77
80
  });
78
81
  if (!isTooltipDisabled) {
@@ -95,6 +98,7 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
95
98
  }, triggerProps => /*#__PURE__*/React.createElement(Pressable
96
99
  // Top level props
97
100
  , _extends({}, rest, {
101
+ "aria-labelledby": baseProps['aria-labelledby'],
98
102
  type: type,
99
103
  testId: testId,
100
104
  componentName: "IconButton",
@@ -160,6 +164,7 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
160
164
  }), baseProps.children));
161
165
  }
162
166
  return /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
167
+ "aria-labelledby": baseProps['aria-labelledby'],
163
168
  ref: baseProps.ref,
164
169
  xcss: baseProps.xcss,
165
170
  isDisabled: baseProps.isDisabled,
@@ -6,6 +6,7 @@ import useIconButton from './use-icon-button';
6
6
  const LinkIconButtonBase = ({
7
7
  // Prevent duplicate labels being added.
8
8
  'aria-label': preventedAriaLabel,
9
+ 'aria-labelledby': ariaLabelledBy,
9
10
  analyticsContext,
10
11
  appearance,
11
12
  autoFocus,
@@ -37,6 +38,7 @@ const LinkIconButtonBase = ({
37
38
  const baseProps = useIconButton({
38
39
  analyticsContext,
39
40
  appearance,
41
+ ariaLabelledBy,
40
42
  autoFocus,
41
43
  buttonType: 'link',
42
44
  icon,
@@ -58,6 +60,7 @@ const LinkIconButtonBase = ({
58
60
  ref,
59
61
  shape,
60
62
  spacing,
63
+ testId,
61
64
  UNSAFE_size
62
65
  });
63
66
  if (!isTooltipDisabled) {
@@ -80,6 +83,7 @@ const LinkIconButtonBase = ({
80
83
  }, triggerProps => /*#__PURE__*/React.createElement(Anchor
81
84
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
82
85
  , _extends({}, rest, {
86
+ "aria-labelledby": baseProps['aria-labelledby'],
83
87
  testId: testId,
84
88
  componentName: "LinkIconButton",
85
89
  analyticsContext: analyticsContext,
@@ -154,6 +158,7 @@ const LinkIconButtonBase = ({
154
158
  return /*#__PURE__*/React.createElement(Anchor
155
159
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
156
160
  , _extends({}, rest, {
161
+ "aria-labelledby": baseProps['aria-labelledby'],
157
162
  ref: baseProps.ref,
158
163
  xcss: baseProps.xcss,
159
164
  onClick: baseProps.onClick,
@@ -15,6 +15,8 @@ import useButtonBase from '../shared/use-button-base';
15
15
  const useIconButton = ({
16
16
  analyticsContext,
17
17
  appearance,
18
+ ariaLabel,
19
+ ariaLabelledBy,
18
20
  autoFocus,
19
21
  buttonType,
20
22
  icon: Icon,
@@ -38,6 +40,7 @@ const useIconButton = ({
38
40
  shape,
39
41
  shouldFitContainer,
40
42
  spacing,
43
+ testId,
41
44
  UNSAFE_size
42
45
  }) => {
43
46
  const hasOverlay = Boolean(overlay || isLoading);
@@ -46,6 +49,8 @@ const useIconButton = ({
46
49
  analyticsContext,
47
50
  appearance,
48
51
  autoFocus,
52
+ ariaLabel,
53
+ ariaLabelledBy,
49
54
  buttonType,
50
55
  children: /*#__PURE__*/React.createElement(Content, {
51
56
  type: "icon",
@@ -75,7 +80,8 @@ const useIconButton = ({
75
80
  spacing,
76
81
  appearance,
77
82
  isDisabled,
78
- isSelected
83
+ isSelected,
84
+ testId
79
85
  }) : overlay,
80
86
  ref,
81
87
  shouldFitContainer,
@@ -0,0 +1 @@
1
+ export const LOADING_LABEL = ', Loading';
@@ -27,15 +27,16 @@ export default function renderLoadingOverlay({
27
27
  appearance,
28
28
  spacing,
29
29
  isDisabled,
30
- isSelected
30
+ isSelected,
31
+ testId
31
32
  }) {
32
33
  return /*#__PURE__*/React.createElement(Spinner, {
33
- label: ", Loading",
34
34
  size: getIconSpacing(spacing),
35
35
  appearance: getSpinnerAppearance({
36
36
  appearance,
37
37
  isDisabled,
38
38
  isSelected
39
- })
39
+ }),
40
+ testId: testId ? `${testId}--loading-spinner` : undefined
40
41
  });
41
42
  }
@@ -1,12 +1,15 @@
1
1
  import React, { Fragment, useRef } from 'react';
2
+ import { uid } from 'react-uid';
2
3
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
3
4
  import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
4
5
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
6
  import { Box, xcss } from '@atlaskit/primitives';
6
7
  import * as colors from '@atlaskit/theme/colors';
7
8
  import { fontSize as getFontSize } from '@atlaskit/theme/constants';
9
+ import VisuallyHidden from '@atlaskit/visually-hidden';
8
10
  import { useSplitButtonContext } from '../../containers/split-button/split-button-context';
9
11
  import blockEvents from './block-events';
12
+ import { LOADING_LABEL } from './constants';
10
13
  const fontSize = getFontSize();
11
14
  const buttonStyles = xcss({
12
15
  display: 'inline-flex',
@@ -17,10 +20,12 @@ const buttonStyles = xcss({
17
20
  alignItems: 'baseline',
18
21
  justifyContent: 'center',
19
22
  columnGap: 'space.050',
23
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
20
24
  background: `var(--ds-background-neutral, ${colors.N20A})`,
21
25
  borderRadius: 'border.radius.100',
22
26
  borderWidth: 'border.width.0',
23
27
  // @ts-expect-error
28
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
24
29
  color: `var(--ds-text, ${colors.N500})`,
25
30
  flexShrink: 0,
26
31
  height: `${32 / fontSize}em`,
@@ -31,6 +36,7 @@ const buttonStyles = xcss({
31
36
  verticalAlign: 'middle',
32
37
  ':visited': {
33
38
  // @ts-expect-error
39
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
34
40
  color: `var(--ds-text, ${colors.N500})`
35
41
  }
36
42
  });
@@ -51,12 +57,15 @@ const defaultInteractiveStyles = xcss({
51
57
  ':hover': {
52
58
  background: "var(--ds-background-neutral-hovered, #091e4214)",
53
59
  // @ts-expect-error
60
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
54
61
  color: `var(--ds-text, ${colors.N500})`,
55
62
  transitionDuration: '0s, 0.15s'
56
63
  },
57
64
  ':active': {
65
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
58
66
  background: `var(--ds-background-neutral-pressed, ${colors.B75})`,
59
67
  // @ts-expect-error
68
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
60
69
  color: `var(--ds-text, ${colors.B400})`,
61
70
  transitionDuration: '0s, 0s'
62
71
  }
@@ -160,11 +169,13 @@ const subtleInteractiveStyles = xcss({
160
169
  });
161
170
  const linkStyles = xcss({
162
171
  // @ts-expect-error
172
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
163
173
  color: `var(--ds-link, ${colors.B400})`,
164
174
  background: "var(--ds-background-neutral-subtle, transparent)",
165
175
  textDecoration: 'none',
166
176
  ':hover': {
167
177
  // @ts-expect-error
178
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
168
179
  color: `var(--ds-link, ${colors.B300})`,
169
180
  background: "var(--ds-background-neutral-subtle, transparent)"
170
181
  },
@@ -175,26 +186,31 @@ const linkStyles = xcss({
175
186
  },
176
187
  ':visited': {
177
188
  // @ts-expect-error
189
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
178
190
  color: `var(--ds-link, ${colors.B400})`
179
191
  }
180
192
  });
181
193
  const subtleLinkStyles = xcss({
182
194
  // @ts-expect-error
195
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
183
196
  color: `var(--ds-text-subtle, ${colors.N200})`,
184
197
  background: "var(--ds-background-neutral-subtle, transparent)",
185
198
  textDecoration: 'none',
186
199
  ':hover': {
187
200
  // @ts-expect-error
201
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
188
202
  color: `var(--ds-text-subtle, ${colors.N90})`,
189
203
  background: "var(--ds-background-neutral-subtle, transparent)"
190
204
  },
191
205
  ':active': {
192
206
  // @ts-expect-error
207
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
193
208
  color: `var(--ds-text, ${colors.N400})`,
194
209
  background: "var(--ds-background-neutral-subtle, transparent)"
195
210
  },
196
211
  ':visited': {
197
212
  // @ts-expect-error
213
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
198
214
  color: `var(--ds-text-subtle, ${colors.N200})`
199
215
  }
200
216
  });
@@ -221,72 +237,94 @@ const linkDecorationStyles = xcss({
221
237
  }
222
238
  });
223
239
  const disabledStyles = xcss({
240
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
224
241
  background: `var(--ds-background-disabled, ${colors.N20A})`,
225
242
  // @ts-expect-error
226
243
  color: "var(--ds-text-disabled, #091E424F)",
227
244
  ':hover': {
245
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
228
246
  background: `var(--ds-background-disabled, ${colors.N20A})`,
229
247
  // @ts-expect-error
230
248
  color: "var(--ds-text-disabled, #091E424F)"
231
249
  },
232
250
  ':active': {
251
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
233
252
  background: `var(--ds-background-disabled, ${colors.N20A})`,
234
253
  // @ts-expect-error
235
254
  color: "var(--ds-text-disabled, #091E424F)"
236
255
  }
237
256
  });
238
257
  const selectedStyles = xcss({
258
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
239
259
  background: `var(--ds-background-selected, ${colors.N700})`,
240
260
  // @ts-expect-error
261
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
241
262
  color: `var(--ds-text-selected, ${colors.N20})`,
242
263
  ':visited': {
243
264
  // @ts-expect-error
265
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
244
266
  color: `var(--ds-text-selected, ${colors.N20})`
245
267
  }
246
268
  });
247
269
  const selectedInteractiveStyles = xcss({
248
270
  ':hover': {
249
271
  // @ts-expect-error
272
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
250
273
  color: `var(--ds-text-selected, ${colors.N20})`,
274
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
251
275
  background: `var(--ds-background-selected-hovered, ${colors.N700})`
252
276
  },
253
277
  ':active': {
254
278
  // @ts-expect-error
279
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
255
280
  color: `var(--ds-text-selected, ${colors.N20})`,
281
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
256
282
  background: `var(--ds-background-selected-pressed, ${colors.N700})`
257
283
  }
258
284
  });
259
285
 
260
286
  // TODO: Remove me once we kill color fallbacks
261
287
  const selectedWarningStyles = xcss({
288
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
262
289
  background: `var(--ds-background-selected, ${colors.Y400})`,
263
290
  // @ts-expect-error
291
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
264
292
  color: `var(--ds-text-selected, ${colors.N800})`,
265
293
  ':hover': {
266
294
  // @ts-expect-error
295
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
267
296
  color: `var(--ds-text-selected, ${colors.N20})`,
297
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
268
298
  background: `var(--ds-background-selected, ${colors.Y400})`
269
299
  },
270
300
  ':active': {
271
301
  // @ts-expect-error
302
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
272
303
  color: `var(--ds-text-selected, ${colors.N20})`,
304
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
273
305
  background: `var(--ds-background-selected, ${colors.Y400})`
274
306
  }
275
307
  });
276
308
 
277
309
  // TODO: Remove me once we kill color fallbacks
278
310
  const selectedDangerStyles = xcss({
311
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
279
312
  background: `var(--ds-background-selected, ${colors.R500})`,
280
313
  // @ts-expect-error
314
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
281
315
  color: `var(--ds-text-selected, ${colors.N20})`,
282
316
  ':hover': {
283
317
  // @ts-expect-error
318
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
284
319
  color: `var(--ds-text-selected, ${colors.N20})`,
320
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
285
321
  background: `var(--ds-background-selected, ${colors.R500})`
286
322
  },
287
323
  ':active': {
288
324
  // @ts-expect-error
325
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
289
326
  color: `var(--ds-text-selected, ${colors.N20})`,
327
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
290
328
  background: `var(--ds-background-selected, ${colors.R500})`
291
329
  }
292
330
  });
@@ -295,14 +333,17 @@ const selectedDangerStyles = xcss({
295
333
  const selectedDiscoveryStyles = xcss({
296
334
  background: "var(--ds-background-selected, #403294)",
297
335
  // @ts-expect-error
336
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
298
337
  color: `var(--ds-text-selected, ${colors.N20})`,
299
338
  ':hover': {
300
339
  // @ts-expect-error
340
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
301
341
  color: `var(--ds-text-selected, ${colors.N20})`,
302
342
  background: "var(--ds-background-selected, #403294)"
303
343
  },
304
344
  ':active': {
305
345
  // @ts-expect-error
346
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
306
347
  color: `var(--ds-text-selected, ${colors.N20})`,
307
348
  background: "var(--ds-background-selected, #403294)"
308
349
  }
@@ -420,10 +461,17 @@ const useButtonBase = ({
420
461
  overlay,
421
462
  ref,
422
463
  shouldFitContainer = false,
423
- spacing: propSpacing = 'default'
464
+ spacing: propSpacing = 'default',
465
+ ariaLabel,
466
+ ariaLabelledBy
424
467
  }) => {
425
468
  const localRef = useRef(null);
426
469
  const splitButtonContext = useSplitButtonContext();
470
+ // TODO: Use React 18's useId() hook when we update.
471
+ // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
472
+ const loadingLabelId = uid({
473
+ ariaLabelledBy
474
+ });
427
475
  const isSplitButton = Boolean(splitButtonContext);
428
476
  const isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
429
477
  const appearance = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
@@ -447,7 +495,11 @@ const useButtonBase = ({
447
495
  children: /*#__PURE__*/React.createElement(Fragment, null, children, overlay ? /*#__PURE__*/React.createElement(Box, {
448
496
  as: "span",
449
497
  xcss: overlayStyles
450
- }, overlay) : null),
498
+ }, overlay) : null, isLoading && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/React.createElement(VisuallyHidden, {
499
+ id: loadingLabelId
500
+ }, ", Loading")),
501
+ 'aria-label': isLoading && ariaLabel && !ariaLabelledBy ? `${ariaLabel} ${LOADING_LABEL}` : ariaLabel,
502
+ 'aria-labelledby': isLoading && ariaLabelledBy ? `${ariaLabelledBy} ${loadingLabelId}` : ariaLabelledBy,
451
503
  ...blockEvents(isEffectivelyDisabled, {
452
504
  onClick,
453
505
  onMouseDownCapture,
@@ -1,5 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useMemo, useState } from 'react';
3
+
4
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
5
+
3
6
  import noop from '@atlaskit/ds-lib/noop';
4
7
  import { useGlobalTheme } from '@atlaskit/theme/components';
5
8
  import ButtonBase from './shared/button-base';
@@ -1,5 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useState } from 'react';
3
+
4
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
5
+
3
6
  import GlobalTheme from '@atlaskit/theme/components';
4
7
  import ButtonBase from '../shared/button-base';
5
8
  import getIsOnlySingleIcon from '../shared/get-is-only-single-icon';