@atlaskit/button 17.4.0 → 17.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/button
2
2
 
3
+ ## 17.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#75714](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75714) [`ba18e89df3d9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ba18e89df3d9) - Icon buttons no longer accept `aria-label` attributes to prevent possible duplicate labels being applied (the dedicated `label` prop handles this)
8
+
3
9
  ## 17.4.0
4
10
 
5
11
  ### Minor Changes
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
  var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
12
12
  var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
13
- var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "type", "testId", "UNSAFE_size"];
13
+ var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "type", "testId", "UNSAFE_size", "aria-label"];
14
14
  /**
15
15
  * __Icon Button__
16
16
  *
@@ -46,6 +46,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
46
46
  type = _ref$type === void 0 ? 'button' : _ref$type,
47
47
  testId = _ref.testId,
48
48
  UNSAFE_size = _ref.UNSAFE_size,
49
+ preventedAriaLabel = _ref['aria-label'],
49
50
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
50
51
  /**
51
52
  * TODO: At some stage I'll look into re-using more logic across 'default' and 'icon'
@@ -11,7 +11,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _link = _interopRequireDefault(require("@atlaskit/primitives/link"));
13
13
  var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
14
- var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "testId", "UNSAFE_size", "href"];
14
+ var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "testId", "UNSAFE_size", "href", "aria-label"];
15
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
@@ -39,6 +39,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
39
39
  testId = _ref.testId,
40
40
  UNSAFE_size = _ref.UNSAFE_size,
41
41
  href = _ref.href,
42
+ preventedAriaLabel = _ref['aria-label'],
42
43
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
43
44
  var baseProps = (0, _useIconButton.default)({
44
45
  analyticsContext: analyticsContext,
@@ -117,7 +117,7 @@ var useButtonBase = function useButtonBase(_ref) {
117
117
  action: 'clicked',
118
118
  componentName: 'button',
119
119
  packageName: "@atlaskit/button",
120
- packageVersion: "17.4.0",
120
+ packageVersion: "17.5.0",
121
121
  analyticsData: analyticsContext,
122
122
  actionSubject: buttonType
123
123
  });
@@ -117,7 +117,7 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
117
117
  action: 'clicked',
118
118
  componentName: 'button',
119
119
  packageName: "@atlaskit/button",
120
- packageVersion: "17.4.0",
120
+ packageVersion: "17.5.0",
121
121
  analyticsData: analyticsContext
122
122
  });
123
123
 
@@ -36,6 +36,8 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
36
36
  type = 'button',
37
37
  testId,
38
38
  UNSAFE_size,
39
+ // Prevent duplicate labels being added.
40
+ 'aria-label': preventedAriaLabel,
39
41
  ...rest
40
42
  }, ref) {
41
43
  /**
@@ -27,6 +27,8 @@ const LinkIconButtonBase = ({
27
27
  testId,
28
28
  UNSAFE_size,
29
29
  href,
30
+ // Prevent duplicate labels being added.
31
+ 'aria-label': preventedAriaLabel,
30
32
  ...rest
31
33
  }, ref) => {
32
34
  const baseProps = useIconButton({
@@ -98,7 +98,7 @@ const useButtonBase = ({
98
98
  action: 'clicked',
99
99
  componentName: 'button',
100
100
  packageName: "@atlaskit/button",
101
- packageVersion: "17.4.0",
101
+ packageVersion: "17.5.0",
102
102
  analyticsData: analyticsContext,
103
103
  actionSubject: buttonType
104
104
  });
@@ -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.4.0",
105
+ packageVersion: "17.5.0",
106
106
  analyticsData: analyticsContext
107
107
  });
108
108
 
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "type", "testId", "UNSAFE_size"];
3
+ var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "type", "testId", "UNSAFE_size", "aria-label"];
4
4
  import React from 'react';
5
5
  import UNSAFE_PRESSABLE from '@atlaskit/primitives/pressable';
6
6
  import useIconButton from './use-icon-button';
@@ -39,6 +39,7 @@ var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
39
39
  type = _ref$type === void 0 ? 'button' : _ref$type,
40
40
  testId = _ref.testId,
41
41
  UNSAFE_size = _ref.UNSAFE_size,
42
+ preventedAriaLabel = _ref['aria-label'],
42
43
  rest = _objectWithoutProperties(_ref, _excluded);
43
44
  /**
44
45
  * TODO: At some stage I'll look into re-using more logic across 'default' and 'icon'
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "testId", "UNSAFE_size", "href"];
3
+ var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "testId", "UNSAFE_size", "href", "aria-label"];
4
4
  import React, { forwardRef, memo } from 'react';
5
5
  import UNSAFE_LINK from '@atlaskit/primitives/link';
6
6
  import useIconButton from './use-icon-button';
@@ -29,6 +29,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
29
29
  testId = _ref.testId,
30
30
  UNSAFE_size = _ref.UNSAFE_size,
31
31
  href = _ref.href,
32
+ preventedAriaLabel = _ref['aria-label'],
32
33
  rest = _objectWithoutProperties(_ref, _excluded);
33
34
  var baseProps = useIconButton({
34
35
  analyticsContext: analyticsContext,
@@ -109,7 +109,7 @@ var useButtonBase = function useButtonBase(_ref) {
109
109
  action: 'clicked',
110
110
  componentName: 'button',
111
111
  packageName: "@atlaskit/button",
112
- packageVersion: "17.4.0",
112
+ packageVersion: "17.5.0",
113
113
  analyticsData: analyticsContext,
114
114
  actionSubject: buttonType
115
115
  });
@@ -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.4.0",
111
+ packageVersion: "17.5.0",
112
112
  analyticsData: analyticsContext
113
113
  });
114
114
 
@@ -2,7 +2,7 @@ import React, { type Ref } from 'react';
2
2
  import { type CommonLinkVariantProps } from '../types';
3
3
  import { type CommonIconButtonProps } from './types';
4
4
  export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
5
- declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, icon, interactionName, label, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, shape, testId, UNSAFE_size, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
5
+ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, icon, interactionName, label, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, shape, testId, UNSAFE_size, href, "aria-label": preventedAriaLabel, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
6
6
  /**
7
7
  * __Link Icon Button__
8
8
  *
@@ -12,6 +12,7 @@ export type CommonIconButtonProps = {
12
12
  * Provide an accessible label, often used by screen readers.
13
13
  */
14
14
  label: string;
15
+ 'aria-label'?: never;
15
16
  /**
16
17
  * Set the shape of the icon, defaults to square with rounded corners.
17
18
  */
@@ -2,7 +2,7 @@ import React, { type Ref } from 'react';
2
2
  import { type CommonLinkVariantProps } from '../types';
3
3
  import { type CommonIconButtonProps } from './types';
4
4
  export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
5
- declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, icon, interactionName, label, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, shape, testId, UNSAFE_size, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
5
+ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, icon, interactionName, label, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, shape, testId, UNSAFE_size, href, "aria-label": preventedAriaLabel, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
6
6
  /**
7
7
  * __Link Icon Button__
8
8
  *
@@ -12,6 +12,7 @@ export type CommonIconButtonProps = {
12
12
  * Provide an accessible label, often used by screen readers.
13
13
  */
14
14
  label: string;
15
+ 'aria-label'?: never;
15
16
  /**
16
17
  * Set the shape of the icon, defaults to square with rounded corners.
17
18
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "17.4.0",
3
+ "version": "17.5.0",
4
4
  "description": "A button triggers an event or action. They let users know what will happen next.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -85,12 +85,12 @@
85
85
  "@atlaskit/analytics-next": "^9.2.0",
86
86
  "@atlaskit/ds-lib": "^2.2.0",
87
87
  "@atlaskit/focus-ring": "^1.3.0",
88
- "@atlaskit/icon": "^22.0.0",
88
+ "@atlaskit/icon": "^22.1.0",
89
89
  "@atlaskit/interaction-context": "^2.1.0",
90
- "@atlaskit/primitives": "^2.0.0",
90
+ "@atlaskit/primitives": "^2.1.0",
91
91
  "@atlaskit/spinner": "^16.0.0",
92
92
  "@atlaskit/theme": "^12.6.0",
93
- "@atlaskit/tokens": "^1.37.0",
93
+ "@atlaskit/tokens": "^1.38.0",
94
94
  "@atlaskit/visually-hidden": "^1.2.4",
95
95
  "@babel/runtime": "^7.0.0",
96
96
  "@emotion/react": "^11.7.1"