@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.
- package/CHANGELOG.md +46 -0
- package/dist/cjs/containers/button-group.js +3 -1
- package/dist/cjs/new-button/containers/split-button/split-button.js +6 -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 +9 -3
- package/dist/cjs/old-button/shared/css.js +4 -3
- package/dist/es2019/containers/button-group.js +3 -1
- package/dist/es2019/new-button/containers/split-button/split-button.js +5 -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 +10 -3
- package/dist/es2019/old-button/shared/css.js +4 -2
- package/dist/esm/containers/button-group.js +3 -1
- package/dist/esm/new-button/containers/split-button/split-button.js +5 -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 +10 -3
- package/dist/esm/old-button/shared/css.js +4 -2
- 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-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/package.json +202 -201
|
@@ -2,6 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { useCallback, useContext, useEffect, useRef } from 'react';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
7
|
import { css, jsx } from '@emotion/react';
|
|
6
8
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
7
9
|
import noop from '@atlaskit/ds-lib/noop';
|
|
@@ -114,7 +116,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
114
116
|
action: 'clicked',
|
|
115
117
|
componentName: 'button',
|
|
116
118
|
packageName: "@atlaskit/button",
|
|
117
|
-
packageVersion: "17.
|
|
119
|
+
packageVersion: "17.18.0",
|
|
118
120
|
analyticsData: analyticsContext
|
|
119
121
|
});
|
|
120
122
|
|
|
@@ -134,6 +136,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
134
136
|
|
|
135
137
|
// we are 'disabling' input with a button when there is an overlay
|
|
136
138
|
const hasOverlay = Boolean(overlay);
|
|
139
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
137
140
|
const fadeStyles = css(getFadingCss({
|
|
138
141
|
hasOverlay
|
|
139
142
|
}));
|
|
@@ -177,13 +180,17 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
177
180
|
}, blockEvents({
|
|
178
181
|
isInteractive
|
|
179
182
|
})), iconBefore ? jsx("span", {
|
|
180
|
-
css: [fadeStyles,
|
|
183
|
+
css: [fadeStyles,
|
|
184
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
185
|
+
getIconStyle({
|
|
181
186
|
spacing
|
|
182
187
|
}), getSpacingFix(children, iconBeforeSpacingFixStyle)]
|
|
183
188
|
}, iconBefore) : null, getChildren(children, [fadeStyles, getContentStyle({
|
|
184
189
|
spacing
|
|
185
190
|
})]), iconAfter ? jsx("span", {
|
|
186
|
-
css: [fadeStyles,
|
|
191
|
+
css: [fadeStyles,
|
|
192
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
193
|
+
getIconStyle({
|
|
187
194
|
spacing
|
|
188
195
|
}), getSpacingFix(children, iconAfterSpacingFixStyle)]
|
|
189
196
|
}, iconAfter) : null, overlay ? jsx("span", {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
1
2
|
import { css } from '@emotion/react';
|
|
2
3
|
import { fontSize as getFontSize,
|
|
3
4
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
@@ -198,7 +199,7 @@ export function getIconStyle({
|
|
|
198
199
|
return css({
|
|
199
200
|
display: 'flex',
|
|
200
201
|
// icon size cannot grow and shrink
|
|
201
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
202
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
202
203
|
margin: spacing === 'none' ? 0 : innerMargin.icon,
|
|
203
204
|
flexGrow: 0,
|
|
204
205
|
flexShrink: 0,
|
|
@@ -214,7 +215,7 @@ export function getContentStyle({
|
|
|
214
215
|
spacing
|
|
215
216
|
}) {
|
|
216
217
|
return css({
|
|
217
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
218
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
218
219
|
margin: spacing === 'none' ? 0 : innerMargin.content,
|
|
219
220
|
// content can grow and shrink
|
|
220
221
|
flexGrow: 1,
|
|
@@ -229,6 +230,7 @@ export function getFadingCss({
|
|
|
229
230
|
hasOverlay
|
|
230
231
|
}) {
|
|
231
232
|
return css({
|
|
233
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
232
234
|
opacity: hasOverlay ? 0 : 1,
|
|
233
235
|
transition: 'opacity 0.3s'
|
|
234
236
|
});
|
|
@@ -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
|
var 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
|
var fontSize = getFontSize();
|
|
@@ -17,9 +18,11 @@ var baseDividerStyles = css({
|
|
|
17
18
|
zIndex: 2
|
|
18
19
|
});
|
|
19
20
|
var 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
|
var 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
|
var dividerDisabledStyles = css({
|
|
@@ -69,14 +72,14 @@ var splitButtonStyles = css({
|
|
|
69
72
|
whiteSpace: 'nowrap'
|
|
70
73
|
});
|
|
71
74
|
var 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
|
var 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
|
|
@@ -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", "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"];
|
|
3
|
+
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"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import Pressable from '@atlaskit/primitives/pressable';
|
|
6
6
|
import useDefaultButton from './use-default-button';
|
|
@@ -16,6 +16,8 @@ import useDefaultButton from './use-default-button';
|
|
|
16
16
|
var Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
|
|
17
17
|
var analyticsContext = _ref.analyticsContext,
|
|
18
18
|
appearance = _ref.appearance,
|
|
19
|
+
ariaLabel = _ref['aria-label'],
|
|
20
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
19
21
|
autoFocus = _ref.autoFocus,
|
|
20
22
|
children = _ref.children,
|
|
21
23
|
iconAfter = _ref.iconAfter,
|
|
@@ -44,6 +46,8 @@ var Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function But
|
|
|
44
46
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
|
|
45
47
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
46
48
|
var baseProps = useDefaultButton({
|
|
49
|
+
ariaLabel: ariaLabel,
|
|
50
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
47
51
|
analyticsContext: analyticsContext,
|
|
48
52
|
appearance: appearance,
|
|
49
53
|
autoFocus: autoFocus,
|
|
@@ -69,12 +73,15 @@ var Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function But
|
|
|
69
73
|
ref: ref,
|
|
70
74
|
shouldFitContainer: shouldFitContainer,
|
|
71
75
|
spacing: spacing,
|
|
76
|
+
testId: testId,
|
|
72
77
|
UNSAFE_iconAfter_size: UNSAFE_iconAfter_size,
|
|
73
78
|
UNSAFE_iconBefore_size: UNSAFE_iconBefore_size
|
|
74
79
|
});
|
|
75
80
|
return /*#__PURE__*/React.createElement(Pressable
|
|
76
81
|
// TODO: Remove spread props
|
|
77
82
|
, _extends({}, rest, {
|
|
83
|
+
"aria-label": baseProps['aria-label'],
|
|
84
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
78
85
|
ref: baseProps.ref,
|
|
79
86
|
xcss: baseProps.xcss,
|
|
80
87
|
isDisabled: baseProps.isDisabled,
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
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"];
|
|
3
|
+
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"];
|
|
4
4
|
import React, { forwardRef, memo } from 'react';
|
|
5
5
|
import Anchor from '@atlaskit/primitives/anchor';
|
|
6
6
|
import useDefaultButton from './use-default-button';
|
|
7
7
|
var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
8
8
|
var analyticsContext = _ref.analyticsContext,
|
|
9
9
|
appearance = _ref.appearance,
|
|
10
|
+
ariaLabel = _ref['aria-label'],
|
|
11
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
10
12
|
autoFocus = _ref.autoFocus,
|
|
11
13
|
children = _ref.children,
|
|
12
14
|
href = _ref.href,
|
|
@@ -33,6 +35,8 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
33
35
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
|
|
34
36
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
35
37
|
var baseProps = useDefaultButton({
|
|
38
|
+
ariaLabel: ariaLabel,
|
|
39
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
36
40
|
analyticsContext: analyticsContext,
|
|
37
41
|
appearance: appearance,
|
|
38
42
|
autoFocus: autoFocus,
|
|
@@ -57,12 +61,15 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
57
61
|
ref: ref,
|
|
58
62
|
shouldFitContainer: shouldFitContainer,
|
|
59
63
|
spacing: spacing,
|
|
64
|
+
testId: testId,
|
|
60
65
|
UNSAFE_iconAfter_size: UNSAFE_iconAfter_size,
|
|
61
66
|
UNSAFE_iconBefore_size: UNSAFE_iconBefore_size
|
|
62
67
|
});
|
|
63
68
|
return /*#__PURE__*/React.createElement(Anchor
|
|
64
69
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
65
70
|
, _extends({}, rest, {
|
|
71
|
+
"aria-label": baseProps['aria-label'],
|
|
72
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
66
73
|
ref: baseProps.ref,
|
|
67
74
|
xcss: baseProps.xcss,
|
|
68
75
|
onClick: baseProps.onClick,
|
|
@@ -14,6 +14,8 @@ import useButtonBase from '../shared/use-button-base';
|
|
|
14
14
|
var useDefaultButton = function useDefaultButton(_ref) {
|
|
15
15
|
var analyticsContext = _ref.analyticsContext,
|
|
16
16
|
appearance = _ref.appearance,
|
|
17
|
+
ariaLabel = _ref.ariaLabel,
|
|
18
|
+
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
17
19
|
autoFocus = _ref.autoFocus,
|
|
18
20
|
buttonType = _ref.buttonType,
|
|
19
21
|
children = _ref.children,
|
|
@@ -38,6 +40,7 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
38
40
|
ref = _ref.ref,
|
|
39
41
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
40
42
|
spacing = _ref.spacing,
|
|
43
|
+
testId = _ref.testId,
|
|
41
44
|
UNSAFE_iconAfter_size = _ref.UNSAFE_iconAfter_size,
|
|
42
45
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size;
|
|
43
46
|
var hasOverlay = Boolean(overlay || isLoading);
|
|
@@ -45,6 +48,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
45
48
|
analyticsContext: analyticsContext,
|
|
46
49
|
appearance: appearance,
|
|
47
50
|
autoFocus: autoFocus,
|
|
51
|
+
ariaLabel: ariaLabel,
|
|
52
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
48
53
|
buttonType: buttonType,
|
|
49
54
|
children: /*#__PURE__*/React.createElement(Fragment, null, IconBefore && /*#__PURE__*/React.createElement(Content, {
|
|
50
55
|
type: "icon",
|
|
@@ -83,7 +88,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
83
88
|
spacing: spacing,
|
|
84
89
|
appearance: appearance,
|
|
85
90
|
isDisabled: isDisabled,
|
|
86
|
-
isSelected: isSelected
|
|
91
|
+
isSelected: isSelected,
|
|
92
|
+
testId: testId
|
|
87
93
|
}) : overlay,
|
|
88
94
|
ref: ref,
|
|
89
95
|
shouldFitContainer: shouldFitContainer,
|
|
@@ -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 = ["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"];
|
|
3
|
+
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"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import Pressable from '@atlaskit/primitives/pressable';
|
|
6
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
@@ -16,6 +16,7 @@ import useIconButton from './use-icon-button';
|
|
|
16
16
|
*/
|
|
17
17
|
var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
|
|
18
18
|
var preventedAriaLabel = _ref['aria-label'],
|
|
19
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
19
20
|
analyticsContext = _ref.analyticsContext,
|
|
20
21
|
appearance = _ref.appearance,
|
|
21
22
|
autoFocus = _ref.autoFocus,
|
|
@@ -53,6 +54,7 @@ var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
53
54
|
var baseProps = useIconButton({
|
|
54
55
|
analyticsContext: analyticsContext,
|
|
55
56
|
appearance: appearance,
|
|
57
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
56
58
|
autoFocus: autoFocus,
|
|
57
59
|
buttonType: 'button',
|
|
58
60
|
icon: icon,
|
|
@@ -75,6 +77,7 @@ var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
75
77
|
ref: ref,
|
|
76
78
|
shape: shape,
|
|
77
79
|
spacing: spacing,
|
|
80
|
+
testId: testId,
|
|
78
81
|
UNSAFE_size: UNSAFE_size
|
|
79
82
|
});
|
|
80
83
|
if (!isTooltipDisabled) {
|
|
@@ -98,6 +101,7 @@ var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
98
101
|
return /*#__PURE__*/React.createElement(Pressable
|
|
99
102
|
// Top level props
|
|
100
103
|
, _extends({}, rest, {
|
|
104
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
101
105
|
type: type,
|
|
102
106
|
testId: testId,
|
|
103
107
|
componentName: "IconButton",
|
|
@@ -164,6 +168,7 @@ var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
164
168
|
});
|
|
165
169
|
}
|
|
166
170
|
return /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
|
|
171
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
167
172
|
ref: baseProps.ref,
|
|
168
173
|
xcss: baseProps.xcss,
|
|
169
174
|
isDisabled: baseProps.isDisabled,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
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"];
|
|
3
|
+
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"];
|
|
4
4
|
import React, { forwardRef, memo } from 'react';
|
|
5
5
|
import Anchor from '@atlaskit/primitives/anchor';
|
|
6
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
7
|
import useIconButton from './use-icon-button';
|
|
8
8
|
var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
9
9
|
var preventedAriaLabel = _ref['aria-label'],
|
|
10
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
10
11
|
analyticsContext = _ref.analyticsContext,
|
|
11
12
|
appearance = _ref.appearance,
|
|
12
13
|
autoFocus = _ref.autoFocus,
|
|
@@ -38,6 +39,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
38
39
|
var baseProps = useIconButton({
|
|
39
40
|
analyticsContext: analyticsContext,
|
|
40
41
|
appearance: appearance,
|
|
42
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
41
43
|
autoFocus: autoFocus,
|
|
42
44
|
buttonType: 'link',
|
|
43
45
|
icon: icon,
|
|
@@ -59,6 +61,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
59
61
|
ref: ref,
|
|
60
62
|
shape: shape,
|
|
61
63
|
spacing: spacing,
|
|
64
|
+
testId: testId,
|
|
62
65
|
UNSAFE_size: UNSAFE_size
|
|
63
66
|
});
|
|
64
67
|
if (!isTooltipDisabled) {
|
|
@@ -82,6 +85,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
82
85
|
return /*#__PURE__*/React.createElement(Anchor
|
|
83
86
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
84
87
|
, _extends({}, rest, {
|
|
88
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
85
89
|
testId: testId,
|
|
86
90
|
componentName: "LinkIconButton",
|
|
87
91
|
analyticsContext: analyticsContext,
|
|
@@ -157,6 +161,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
157
161
|
return /*#__PURE__*/React.createElement(Anchor
|
|
158
162
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
159
163
|
, _extends({}, rest, {
|
|
164
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
160
165
|
ref: baseProps.ref,
|
|
161
166
|
xcss: baseProps.xcss,
|
|
162
167
|
onClick: baseProps.onClick,
|
|
@@ -15,6 +15,8 @@ import useButtonBase from '../shared/use-button-base';
|
|
|
15
15
|
var useIconButton = function useIconButton(_ref) {
|
|
16
16
|
var analyticsContext = _ref.analyticsContext,
|
|
17
17
|
appearance = _ref.appearance,
|
|
18
|
+
ariaLabel = _ref.ariaLabel,
|
|
19
|
+
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
18
20
|
autoFocus = _ref.autoFocus,
|
|
19
21
|
buttonType = _ref.buttonType,
|
|
20
22
|
Icon = _ref.icon,
|
|
@@ -38,6 +40,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
38
40
|
shape = _ref.shape,
|
|
39
41
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
40
42
|
spacing = _ref.spacing,
|
|
43
|
+
testId = _ref.testId,
|
|
41
44
|
UNSAFE_size = _ref.UNSAFE_size;
|
|
42
45
|
var hasOverlay = Boolean(overlay || isLoading);
|
|
43
46
|
var isCircle = shape === 'circle';
|
|
@@ -45,6 +48,8 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
45
48
|
analyticsContext: analyticsContext,
|
|
46
49
|
appearance: appearance,
|
|
47
50
|
autoFocus: autoFocus,
|
|
51
|
+
ariaLabel: ariaLabel,
|
|
52
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
48
53
|
buttonType: buttonType,
|
|
49
54
|
children: /*#__PURE__*/React.createElement(Content, {
|
|
50
55
|
type: "icon",
|
|
@@ -74,7 +79,8 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
74
79
|
spacing: spacing,
|
|
75
80
|
appearance: appearance,
|
|
76
81
|
isDisabled: isDisabled,
|
|
77
|
-
isSelected: isSelected
|
|
82
|
+
isSelected: isSelected,
|
|
83
|
+
testId: testId
|
|
78
84
|
}) : overlay,
|
|
79
85
|
ref: ref,
|
|
80
86
|
shouldFitContainer: shouldFitContainer,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var LOADING_LABEL = ', Loading';
|
|
@@ -26,14 +26,15 @@ export default function renderLoadingOverlay(_ref2) {
|
|
|
26
26
|
var appearance = _ref2.appearance,
|
|
27
27
|
spacing = _ref2.spacing,
|
|
28
28
|
isDisabled = _ref2.isDisabled,
|
|
29
|
-
isSelected = _ref2.isSelected
|
|
29
|
+
isSelected = _ref2.isSelected,
|
|
30
|
+
testId = _ref2.testId;
|
|
30
31
|
return /*#__PURE__*/React.createElement(Spinner, {
|
|
31
|
-
label: ", Loading",
|
|
32
32
|
size: getIconSpacing(spacing),
|
|
33
33
|
appearance: getSpinnerAppearance({
|
|
34
34
|
appearance: appearance,
|
|
35
35
|
isDisabled: isDisabled,
|
|
36
36
|
isSelected: isSelected
|
|
37
|
-
})
|
|
37
|
+
}),
|
|
38
|
+
testId: testId ? "".concat(testId, "--loading-spinner") : undefined
|
|
38
39
|
});
|
|
39
40
|
}
|