@atlaskit/button 17.17.3 → 17.19.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 +55 -0
- package/dist/cjs/containers/button-group.js +6 -1
- package/dist/cjs/new-button/containers/split-button/split-button.js +9 -2
- package/dist/cjs/new-button/variants/default/button.js +8 -1
- package/dist/cjs/new-button/variants/default/link.js +8 -1
- package/dist/cjs/new-button/variants/default/use-default-button.js +7 -1
- package/dist/cjs/new-button/variants/icon/button.js +6 -1
- package/dist/cjs/new-button/variants/icon/link.js +6 -1
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/cjs/new-button/variants/shared/constants.js +7 -0
- package/dist/cjs/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/cjs/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/cjs/old-button/button.js +1 -1
- package/dist/cjs/old-button/custom-theme-button/custom-theme-button.js +1 -1
- package/dist/cjs/old-button/custom-theme-button/theme.js +1 -1
- package/dist/cjs/old-button/shared/button-base.js +12 -3
- package/dist/cjs/old-button/shared/css.js +4 -3
- package/dist/es2019/containers/button-group.js +6 -1
- package/dist/es2019/new-button/containers/split-button/split-button.js +8 -2
- package/dist/es2019/new-button/variants/default/button.js +7 -0
- package/dist/es2019/new-button/variants/default/link.js +7 -0
- package/dist/es2019/new-button/variants/default/use-default-button.js +7 -1
- package/dist/es2019/new-button/variants/icon/button.js +5 -0
- package/dist/es2019/new-button/variants/icon/link.js +5 -0
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/es2019/new-button/variants/shared/constants.js +1 -0
- package/dist/es2019/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/es2019/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/es2019/old-button/button.js +3 -0
- package/dist/es2019/old-button/custom-theme-button/custom-theme-button.js +3 -0
- package/dist/es2019/old-button/custom-theme-button/theme.js +2 -0
- package/dist/es2019/old-button/shared/button-base.js +13 -3
- package/dist/es2019/old-button/shared/css.js +4 -2
- package/dist/esm/containers/button-group.js +6 -1
- package/dist/esm/new-button/containers/split-button/split-button.js +8 -2
- package/dist/esm/new-button/variants/default/button.js +8 -1
- package/dist/esm/new-button/variants/default/link.js +8 -1
- package/dist/esm/new-button/variants/default/use-default-button.js +7 -1
- package/dist/esm/new-button/variants/icon/button.js +6 -1
- package/dist/esm/new-button/variants/icon/link.js +6 -1
- package/dist/esm/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/esm/new-button/variants/shared/constants.js +1 -0
- package/dist/esm/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/esm/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/esm/old-button/button.js +3 -0
- package/dist/esm/old-button/custom-theme-button/custom-theme-button.js +3 -0
- package/dist/esm/old-button/custom-theme-button/theme.js +2 -0
- package/dist/esm/old-button/shared/button-base.js +13 -3
- package/dist/esm/old-button/shared/css.js +4 -2
- package/dist/types/containers/button-group.d.ts +3 -0
- package/dist/types/new-button/containers/split-button/split-button.d.ts +3 -0
- package/dist/types/new-button/variants/default/link.d.ts +1 -1
- package/dist/types/new-button/variants/default/types.d.ts +1 -1
- package/dist/types/new-button/variants/default/use-default-button.d.ts +4 -3
- package/dist/types/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +4 -3
- package/dist/types/new-button/variants/shared/constants.d.ts +1 -0
- package/dist/types/new-button/variants/shared/loading-overlay.d.ts +2 -1
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +5 -1
- package/dist/types/old-button/shared/button-base.d.ts +3 -0
- package/dist/types-ts4.5/containers/button-group.d.ts +3 -0
- package/dist/types-ts4.5/new-button/containers/split-button/split-button.d.ts +3 -0
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/types.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +4 -3
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +4 -3
- package/dist/types-ts4.5/new-button/variants/shared/constants.d.ts +1 -0
- package/dist/types-ts4.5/new-button/variants/shared/loading-overlay.d.ts +2 -1
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +5 -1
- package/dist/types-ts4.5/old-button/shared/button-base.d.ts +3 -0
- package/package.json +202 -201
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 17.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#111878](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111878)
|
|
8
|
+
[`223959ef57c80`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/223959ef57c80) -
|
|
9
|
+
Explicitly set jsxRuntime to classic via pragma comments in order to avoid issues where jsxRuntime
|
|
10
|
+
is implicitly set to automatic.
|
|
11
|
+
|
|
12
|
+
## 17.18.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#111486](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111486)
|
|
17
|
+
[`f848f651ef678`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f848f651ef678) - ###
|
|
18
|
+
Accessibility improvement
|
|
19
|
+
|
|
20
|
+
New buttons now adds ", Loading" to the accessible name of loading buttons regardless of how they
|
|
21
|
+
are labelled. This supports labelling by text content (`children`), `aria-label`, and
|
|
22
|
+
`aria-labelledby`.
|
|
23
|
+
|
|
24
|
+
The ", Loading" label was previously part of the loading spinner `<svg>`, which has been relocated
|
|
25
|
+
because this does not support `aria-label` or `aria-labelledby`. Any test locators for loading
|
|
26
|
+
buttons may need to be updated.
|
|
27
|
+
|
|
28
|
+
The most robust way to find loading buttons is by role and accessible name. This accounts for
|
|
29
|
+
label precedence. For example:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
screen.findByRole("button", {
|
|
33
|
+
name: /, Loading/,
|
|
34
|
+
})
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
To validate a loading button that is already located, use `toHaveAccessibleName()`:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
render(<Button testId="foo" isLoading>My label</Button>);
|
|
41
|
+
|
|
42
|
+
const button = screen.getByTestId("foo");
|
|
43
|
+
expect(button).toHaveAccessibleName(`My label , Loading`);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For locating loading spinners, a test ID has been added that is based on the button `testId`. For
|
|
47
|
+
example:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
render(<Button isLoading testId="bar">My label</Button>);
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
const spinner = screen.getByTestId("bar--loading-spinner-wrapper");
|
|
54
|
+
expect(spinner).toBeInTheDocument();
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
|
|
3
58
|
## 17.17.3
|
|
4
59
|
|
|
5
60
|
### Patch Changes
|
|
@@ -9,12 +9,17 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _react2 = require("@emotion/react");
|
|
10
10
|
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); }
|
|
11
11
|
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; }
|
|
12
|
+
/**
|
|
13
|
+
* @jsxRuntime classic
|
|
14
|
+
*/
|
|
12
15
|
/** @jsx jsx */
|
|
13
16
|
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
18
|
+
|
|
14
19
|
var buttonGroupStyles = (0, _react2.css)({
|
|
15
20
|
display: 'inline-flex',
|
|
16
21
|
gap: "var(--ds-space-050, 4px)",
|
|
17
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
22
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
18
23
|
'> *': {
|
|
19
24
|
flex: '1 0 auto'
|
|
20
25
|
}
|
|
@@ -8,8 +8,13 @@ var _react = require("@emotion/react");
|
|
|
8
8
|
var _constants = require("@atlaskit/theme/constants");
|
|
9
9
|
var _splitButtonContext = require("./split-button-context");
|
|
10
10
|
var _utils = require("./utils");
|
|
11
|
+
/**
|
|
12
|
+
* @jsxRuntime classic
|
|
13
|
+
*/
|
|
11
14
|
/** @jsx jsx */
|
|
12
15
|
|
|
16
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
17
|
+
|
|
13
18
|
var fontSize = (0, _constants.fontSize)();
|
|
14
19
|
var heights = {
|
|
15
20
|
default: "".concat(32 / fontSize, "em"),
|
|
@@ -23,9 +28,11 @@ var baseDividerStyles = (0, _react.css)({
|
|
|
23
28
|
zIndex: 2
|
|
24
29
|
});
|
|
25
30
|
var defaultDividerStyles = (0, _react.css)({
|
|
31
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
26
32
|
height: heights.default
|
|
27
33
|
});
|
|
28
34
|
var compactDividerStyles = (0, _react.css)({
|
|
35
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
29
36
|
height: heights.compact
|
|
30
37
|
});
|
|
31
38
|
var dividerDisabledStyles = (0, _react.css)({
|
|
@@ -75,14 +82,14 @@ var splitButtonStyles = (0, _react.css)({
|
|
|
75
82
|
whiteSpace: 'nowrap'
|
|
76
83
|
});
|
|
77
84
|
var primaryButtonStyles = (0, _react.css)({
|
|
78
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
85
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
79
86
|
'button,a': {
|
|
80
87
|
borderEndEndRadius: 0,
|
|
81
88
|
borderStartEndRadius: 0
|
|
82
89
|
}
|
|
83
90
|
});
|
|
84
91
|
var secondaryButtonStyles = (0, _react.css)({
|
|
85
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
92
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
86
93
|
'button,a': {
|
|
87
94
|
borderEndStartRadius: 0,
|
|
88
95
|
borderStartStartRadius: 0
|
|
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
|
|
12
12
|
var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
|
|
13
|
-
var _excluded = ["analyticsContext", "appearance", "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"];
|
|
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
14
|
/**
|
|
15
15
|
* __Button__
|
|
16
16
|
*
|
|
@@ -23,6 +23,8 @@ var _excluded = ["analyticsContext", "appearance", "autoFocus", "children", "ico
|
|
|
23
23
|
var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function Button(_ref, ref) {
|
|
24
24
|
var analyticsContext = _ref.analyticsContext,
|
|
25
25
|
appearance = _ref.appearance,
|
|
26
|
+
ariaLabel = _ref['aria-label'],
|
|
27
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
26
28
|
autoFocus = _ref.autoFocus,
|
|
27
29
|
children = _ref.children,
|
|
28
30
|
iconAfter = _ref.iconAfter,
|
|
@@ -51,6 +53,8 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
51
53
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
|
|
52
54
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
53
55
|
var baseProps = (0, _useDefaultButton.default)({
|
|
56
|
+
ariaLabel: ariaLabel,
|
|
57
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
54
58
|
analyticsContext: analyticsContext,
|
|
55
59
|
appearance: appearance,
|
|
56
60
|
autoFocus: autoFocus,
|
|
@@ -76,12 +80,15 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
76
80
|
ref: ref,
|
|
77
81
|
shouldFitContainer: shouldFitContainer,
|
|
78
82
|
spacing: spacing,
|
|
83
|
+
testId: testId,
|
|
79
84
|
UNSAFE_iconAfter_size: UNSAFE_iconAfter_size,
|
|
80
85
|
UNSAFE_iconBefore_size: UNSAFE_iconBefore_size
|
|
81
86
|
});
|
|
82
87
|
return /*#__PURE__*/_react.default.createElement(_pressable.default
|
|
83
88
|
// TODO: Remove spread props
|
|
84
89
|
, (0, _extends2.default)({}, rest, {
|
|
90
|
+
"aria-label": baseProps['aria-label'],
|
|
91
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
85
92
|
ref: baseProps.ref,
|
|
86
93
|
xcss: baseProps.xcss,
|
|
87
94
|
isDisabled: baseProps.isDisabled,
|
|
@@ -11,12 +11,14 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _anchor = _interopRequireDefault(require("@atlaskit/primitives/anchor"));
|
|
13
13
|
var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
|
|
14
|
-
var _excluded = ["analyticsContext", "appearance", "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"];
|
|
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
15
|
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
16
|
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
17
|
var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
18
18
|
var analyticsContext = _ref.analyticsContext,
|
|
19
19
|
appearance = _ref.appearance,
|
|
20
|
+
ariaLabel = _ref['aria-label'],
|
|
21
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
20
22
|
autoFocus = _ref.autoFocus,
|
|
21
23
|
children = _ref.children,
|
|
22
24
|
href = _ref.href,
|
|
@@ -43,6 +45,8 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
43
45
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
|
|
44
46
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
45
47
|
var baseProps = (0, _useDefaultButton.default)({
|
|
48
|
+
ariaLabel: ariaLabel,
|
|
49
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
46
50
|
analyticsContext: analyticsContext,
|
|
47
51
|
appearance: appearance,
|
|
48
52
|
autoFocus: autoFocus,
|
|
@@ -67,12 +71,15 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
67
71
|
ref: ref,
|
|
68
72
|
shouldFitContainer: shouldFitContainer,
|
|
69
73
|
spacing: spacing,
|
|
74
|
+
testId: testId,
|
|
70
75
|
UNSAFE_iconAfter_size: UNSAFE_iconAfter_size,
|
|
71
76
|
UNSAFE_iconBefore_size: UNSAFE_iconBefore_size
|
|
72
77
|
});
|
|
73
78
|
return /*#__PURE__*/_react.default.createElement(_anchor.default
|
|
74
79
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
75
80
|
, (0, _extends2.default)({}, 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
|
onClick: baseProps.onClick,
|
|
@@ -24,6 +24,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
24
24
|
var useDefaultButton = function useDefaultButton(_ref) {
|
|
25
25
|
var analyticsContext = _ref.analyticsContext,
|
|
26
26
|
appearance = _ref.appearance,
|
|
27
|
+
ariaLabel = _ref.ariaLabel,
|
|
28
|
+
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
27
29
|
autoFocus = _ref.autoFocus,
|
|
28
30
|
buttonType = _ref.buttonType,
|
|
29
31
|
children = _ref.children,
|
|
@@ -48,6 +50,7 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
48
50
|
ref = _ref.ref,
|
|
49
51
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
50
52
|
spacing = _ref.spacing,
|
|
53
|
+
testId = _ref.testId,
|
|
51
54
|
UNSAFE_iconAfter_size = _ref.UNSAFE_iconAfter_size,
|
|
52
55
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size;
|
|
53
56
|
var hasOverlay = Boolean(overlay || isLoading);
|
|
@@ -55,6 +58,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
55
58
|
analyticsContext: analyticsContext,
|
|
56
59
|
appearance: appearance,
|
|
57
60
|
autoFocus: autoFocus,
|
|
61
|
+
ariaLabel: ariaLabel,
|
|
62
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
58
63
|
buttonType: buttonType,
|
|
59
64
|
children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, IconBefore && /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
60
65
|
type: "icon",
|
|
@@ -93,7 +98,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
93
98
|
spacing: spacing,
|
|
94
99
|
appearance: appearance,
|
|
95
100
|
isDisabled: isDisabled,
|
|
96
|
-
isSelected: isSelected
|
|
101
|
+
isSelected: isSelected,
|
|
102
|
+
testId: testId
|
|
97
103
|
}) : overlay,
|
|
98
104
|
ref: ref,
|
|
99
105
|
shouldFitContainer: shouldFitContainer,
|
|
@@ -11,7 +11,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
|
|
12
12
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
13
13
|
var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
|
|
14
|
-
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"];
|
|
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
15
|
/**
|
|
16
16
|
* __Icon Button__
|
|
17
17
|
*
|
|
@@ -23,6 +23,7 @@ var _excluded = ["aria-label", "analyticsContext", "appearance", "autoFocus", "i
|
|
|
23
23
|
*/
|
|
24
24
|
var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function Button(_ref, ref) {
|
|
25
25
|
var preventedAriaLabel = _ref['aria-label'],
|
|
26
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
26
27
|
analyticsContext = _ref.analyticsContext,
|
|
27
28
|
appearance = _ref.appearance,
|
|
28
29
|
autoFocus = _ref.autoFocus,
|
|
@@ -60,6 +61,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
60
61
|
var baseProps = (0, _useIconButton.default)({
|
|
61
62
|
analyticsContext: analyticsContext,
|
|
62
63
|
appearance: appearance,
|
|
64
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
63
65
|
autoFocus: autoFocus,
|
|
64
66
|
buttonType: 'button',
|
|
65
67
|
icon: icon,
|
|
@@ -82,6 +84,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
82
84
|
ref: ref,
|
|
83
85
|
shape: shape,
|
|
84
86
|
spacing: spacing,
|
|
87
|
+
testId: testId,
|
|
85
88
|
UNSAFE_size: UNSAFE_size
|
|
86
89
|
});
|
|
87
90
|
if (!isTooltipDisabled) {
|
|
@@ -105,6 +108,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
105
108
|
return /*#__PURE__*/_react.default.createElement(_pressable.default
|
|
106
109
|
// Top level props
|
|
107
110
|
, (0, _extends2.default)({}, rest, {
|
|
111
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
108
112
|
type: type,
|
|
109
113
|
testId: testId,
|
|
110
114
|
componentName: "IconButton",
|
|
@@ -171,6 +175,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
171
175
|
});
|
|
172
176
|
}
|
|
173
177
|
return /*#__PURE__*/_react.default.createElement(_pressable.default, (0, _extends2.default)({}, rest, {
|
|
178
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
174
179
|
ref: baseProps.ref,
|
|
175
180
|
xcss: baseProps.xcss,
|
|
176
181
|
isDisabled: baseProps.isDisabled,
|
|
@@ -12,11 +12,12 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _anchor = _interopRequireDefault(require("@atlaskit/primitives/anchor"));
|
|
13
13
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
14
14
|
var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
|
|
15
|
-
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"];
|
|
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
16
|
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
17
|
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
18
|
var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
19
19
|
var preventedAriaLabel = _ref['aria-label'],
|
|
20
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
20
21
|
analyticsContext = _ref.analyticsContext,
|
|
21
22
|
appearance = _ref.appearance,
|
|
22
23
|
autoFocus = _ref.autoFocus,
|
|
@@ -48,6 +49,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
48
49
|
var baseProps = (0, _useIconButton.default)({
|
|
49
50
|
analyticsContext: analyticsContext,
|
|
50
51
|
appearance: appearance,
|
|
52
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
51
53
|
autoFocus: autoFocus,
|
|
52
54
|
buttonType: 'link',
|
|
53
55
|
icon: icon,
|
|
@@ -69,6 +71,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
69
71
|
ref: ref,
|
|
70
72
|
shape: shape,
|
|
71
73
|
spacing: spacing,
|
|
74
|
+
testId: testId,
|
|
72
75
|
UNSAFE_size: UNSAFE_size
|
|
73
76
|
});
|
|
74
77
|
if (!isTooltipDisabled) {
|
|
@@ -92,6 +95,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
92
95
|
return /*#__PURE__*/_react.default.createElement(_anchor.default
|
|
93
96
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
94
97
|
, (0, _extends2.default)({}, rest, {
|
|
98
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
95
99
|
testId: testId,
|
|
96
100
|
componentName: "LinkIconButton",
|
|
97
101
|
analyticsContext: analyticsContext,
|
|
@@ -167,6 +171,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
167
171
|
return /*#__PURE__*/_react.default.createElement(_anchor.default
|
|
168
172
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
169
173
|
, (0, _extends2.default)({}, rest, {
|
|
174
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
170
175
|
ref: baseProps.ref,
|
|
171
176
|
xcss: baseProps.xcss,
|
|
172
177
|
onClick: baseProps.onClick,
|
|
@@ -22,6 +22,8 @@ var _useButtonBase = _interopRequireDefault(require("../shared/use-button-base")
|
|
|
22
22
|
var useIconButton = function useIconButton(_ref) {
|
|
23
23
|
var analyticsContext = _ref.analyticsContext,
|
|
24
24
|
appearance = _ref.appearance,
|
|
25
|
+
ariaLabel = _ref.ariaLabel,
|
|
26
|
+
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
25
27
|
autoFocus = _ref.autoFocus,
|
|
26
28
|
buttonType = _ref.buttonType,
|
|
27
29
|
Icon = _ref.icon,
|
|
@@ -45,6 +47,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
45
47
|
shape = _ref.shape,
|
|
46
48
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
47
49
|
spacing = _ref.spacing,
|
|
50
|
+
testId = _ref.testId,
|
|
48
51
|
UNSAFE_size = _ref.UNSAFE_size;
|
|
49
52
|
var hasOverlay = Boolean(overlay || isLoading);
|
|
50
53
|
var isCircle = shape === 'circle';
|
|
@@ -52,6 +55,8 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
52
55
|
analyticsContext: analyticsContext,
|
|
53
56
|
appearance: appearance,
|
|
54
57
|
autoFocus: autoFocus,
|
|
58
|
+
ariaLabel: ariaLabel,
|
|
59
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
55
60
|
buttonType: buttonType,
|
|
56
61
|
children: /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
57
62
|
type: "icon",
|
|
@@ -81,7 +86,8 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
81
86
|
spacing: spacing,
|
|
82
87
|
appearance: appearance,
|
|
83
88
|
isDisabled: isDisabled,
|
|
84
|
-
isSelected: isSelected
|
|
89
|
+
isSelected: isSelected,
|
|
90
|
+
testId: testId
|
|
85
91
|
}) : overlay,
|
|
86
92
|
ref: ref,
|
|
87
93
|
shouldFitContainer: shouldFitContainer,
|
|
@@ -33,14 +33,15 @@ function renderLoadingOverlay(_ref2) {
|
|
|
33
33
|
var appearance = _ref2.appearance,
|
|
34
34
|
spacing = _ref2.spacing,
|
|
35
35
|
isDisabled = _ref2.isDisabled,
|
|
36
|
-
isSelected = _ref2.isSelected
|
|
36
|
+
isSelected = _ref2.isSelected,
|
|
37
|
+
testId = _ref2.testId;
|
|
37
38
|
return /*#__PURE__*/_react.default.createElement(_spinner.default, {
|
|
38
|
-
label: ", Loading",
|
|
39
39
|
size: getIconSpacing(spacing),
|
|
40
40
|
appearance: getSpinnerAppearance({
|
|
41
41
|
appearance: appearance,
|
|
42
42
|
isDisabled: isDisabled,
|
|
43
43
|
isSelected: isSelected
|
|
44
|
-
})
|
|
44
|
+
}),
|
|
45
|
+
testId: testId ? "".concat(testId, "--loading-spinner") : undefined
|
|
45
46
|
});
|
|
46
47
|
}
|