@atlaskit/button 17.21.0 → 17.22.1
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 +13 -0
- package/dist/cjs/new-button/variants/default/use-default-button.js +13 -14
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +5 -5
- package/dist/cjs/new-button/variants/shared/icon-renderer.js +38 -0
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/variants/default/use-default-button.js +13 -14
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +5 -5
- package/dist/es2019/new-button/variants/shared/icon-renderer.js +32 -0
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/variants/default/use-default-button.js +13 -14
- package/dist/esm/new-button/variants/icon/use-icon-button.js +5 -5
- package/dist/esm/new-button/variants/shared/icon-renderer.js +31 -0
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/new-button/variants/default/use-default-button.d.ts +1 -1
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +1 -1
- package/dist/types/new-button/variants/shared/icon-renderer.d.ts +14 -0
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/shared/icon-renderer.d.ts +14 -0
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 17.22.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 17.22.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`5081c9ca53507`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5081c9ca53507) -
|
|
14
|
+
Correctly handle render props for icons in order to prevent unintentional renders.
|
|
15
|
+
|
|
3
16
|
## 17.21.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _content = _interopRequireDefault(require("../shared/content"));
|
|
11
|
+
var _iconRenderer = _interopRequireDefault(require("../shared/icon-renderer"));
|
|
11
12
|
var _loadingOverlay = _interopRequireDefault(require("../shared/loading-overlay"));
|
|
12
13
|
var _useButtonBase = _interopRequireDefault(require("../shared/use-button-base"));
|
|
13
14
|
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); }
|
|
@@ -29,8 +30,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
29
30
|
autoFocus = _ref.autoFocus,
|
|
30
31
|
buttonType = _ref.buttonType,
|
|
31
32
|
children = _ref.children,
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
iconAfter = _ref.iconAfter,
|
|
34
|
+
iconBefore = _ref.iconBefore,
|
|
34
35
|
interactionName = _ref.interactionName,
|
|
35
36
|
isDisabled = _ref.isDisabled,
|
|
36
37
|
_ref$isLoading = _ref.isLoading,
|
|
@@ -61,24 +62,22 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
61
62
|
ariaLabel: ariaLabel,
|
|
62
63
|
ariaLabelledBy: ariaLabelledBy,
|
|
63
64
|
buttonType: buttonType,
|
|
64
|
-
children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null,
|
|
65
|
+
children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, iconBefore && /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
65
66
|
type: "icon",
|
|
66
67
|
position: "before",
|
|
67
68
|
hasOverlay: hasOverlay
|
|
68
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
69
|
-
|
|
70
|
-
size: UNSAFE_iconBefore_size
|
|
71
|
-
color: 'currentColor'
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement(_iconRenderer.default, {
|
|
70
|
+
icon: iconBefore,
|
|
71
|
+
size: UNSAFE_iconBefore_size
|
|
72
72
|
})), children && /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
73
73
|
hasOverlay: hasOverlay
|
|
74
|
-
}, children),
|
|
74
|
+
}, children), iconAfter && /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
75
75
|
type: "icon",
|
|
76
76
|
position: "after",
|
|
77
77
|
hasOverlay: hasOverlay
|
|
78
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
79
|
-
|
|
80
|
-
size: UNSAFE_iconAfter_size
|
|
81
|
-
color: 'currentColor'
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement(_iconRenderer.default, {
|
|
79
|
+
icon: iconAfter,
|
|
80
|
+
size: UNSAFE_iconAfter_size
|
|
82
81
|
}))),
|
|
83
82
|
interactionName: interactionName,
|
|
84
83
|
isDisabled: isDisabled,
|
|
@@ -104,8 +103,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
104
103
|
ref: ref,
|
|
105
104
|
shouldFitContainer: shouldFitContainer,
|
|
106
105
|
spacing: spacing,
|
|
107
|
-
hasIconBefore: Boolean(
|
|
108
|
-
hasIconAfter: Boolean(
|
|
106
|
+
hasIconBefore: Boolean(iconBefore),
|
|
107
|
+
hasIconAfter: Boolean(iconAfter)
|
|
109
108
|
});
|
|
110
109
|
return baseProps;
|
|
111
110
|
};
|
|
@@ -8,6 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
10
10
|
var _content = _interopRequireDefault(require("../shared/content"));
|
|
11
|
+
var _iconRenderer = _interopRequireDefault(require("../shared/icon-renderer"));
|
|
11
12
|
var _loadingOverlay = _interopRequireDefault(require("../shared/loading-overlay"));
|
|
12
13
|
var _useButtonBase = _interopRequireDefault(require("../shared/use-button-base"));
|
|
13
14
|
/**
|
|
@@ -26,7 +27,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
26
27
|
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
27
28
|
autoFocus = _ref.autoFocus,
|
|
28
29
|
buttonType = _ref.buttonType,
|
|
29
|
-
|
|
30
|
+
icon = _ref.icon,
|
|
30
31
|
interactionName = _ref.interactionName,
|
|
31
32
|
isDisabled = _ref.isDisabled,
|
|
32
33
|
isLoading = _ref.isLoading,
|
|
@@ -61,10 +62,9 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
61
62
|
children: /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
62
63
|
type: "icon",
|
|
63
64
|
hasOverlay: hasOverlay
|
|
64
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
65
|
-
|
|
66
|
-
size: UNSAFE_size
|
|
67
|
-
color: 'currentColor'
|
|
65
|
+
}, /*#__PURE__*/_react.default.createElement(_iconRenderer.default, {
|
|
66
|
+
icon: icon,
|
|
67
|
+
size: UNSAFE_size
|
|
68
68
|
}), /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, null, label)),
|
|
69
69
|
interactionName: interactionName,
|
|
70
70
|
isDisabled: isDisabled,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
+
function isIconRenderProp(func) {
|
|
11
|
+
return !func.displayName &&
|
|
12
|
+
// most function components and class components have a displayName, negate them
|
|
13
|
+
!func.render &&
|
|
14
|
+
// forwardRef doesn't require a display name, however it does include a render function, negate them
|
|
15
|
+
typeof func === 'function' // at the very least we need to be a function
|
|
16
|
+
;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* __Icon renderer__
|
|
21
|
+
*
|
|
22
|
+
* Used to support render props with icons.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
var IconRenderer = function IconRenderer(_ref) {
|
|
26
|
+
var Icon = _ref.icon,
|
|
27
|
+
size = _ref.size;
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.button-render-prop-fix_lyo55') && isIconRenderProp(Icon) ? Icon({
|
|
29
|
+
label: '',
|
|
30
|
+
size: size,
|
|
31
|
+
color: 'currentColor'
|
|
32
|
+
}) : /*#__PURE__*/_react.default.createElement(Icon, {
|
|
33
|
+
label: "",
|
|
34
|
+
size: size,
|
|
35
|
+
color: 'currentColor'
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
var _default = exports.default = IconRenderer;
|
|
@@ -133,7 +133,7 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
|
|
|
133
133
|
action: 'clicked',
|
|
134
134
|
componentName: 'button',
|
|
135
135
|
packageName: "@atlaskit/button",
|
|
136
|
-
packageVersion: "17.
|
|
136
|
+
packageVersion: "17.22.1",
|
|
137
137
|
analyticsData: analyticsContext
|
|
138
138
|
});
|
|
139
139
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
2
|
import Content from '../shared/content';
|
|
3
|
+
import IconRenderer from '../shared/icon-renderer';
|
|
3
4
|
import renderLoadingOverlay from '../shared/loading-overlay';
|
|
4
5
|
import useButtonBase from '../shared/use-button-base';
|
|
5
6
|
/**
|
|
@@ -19,8 +20,8 @@ const useDefaultButton = ({
|
|
|
19
20
|
autoFocus,
|
|
20
21
|
buttonType,
|
|
21
22
|
children,
|
|
22
|
-
iconAfter
|
|
23
|
-
iconBefore
|
|
23
|
+
iconAfter,
|
|
24
|
+
iconBefore,
|
|
24
25
|
interactionName,
|
|
25
26
|
isDisabled,
|
|
26
27
|
isLoading = false,
|
|
@@ -51,24 +52,22 @@ const useDefaultButton = ({
|
|
|
51
52
|
ariaLabel,
|
|
52
53
|
ariaLabelledBy,
|
|
53
54
|
buttonType,
|
|
54
|
-
children: /*#__PURE__*/React.createElement(Fragment, null,
|
|
55
|
+
children: /*#__PURE__*/React.createElement(Fragment, null, iconBefore && /*#__PURE__*/React.createElement(Content, {
|
|
55
56
|
type: "icon",
|
|
56
57
|
position: "before",
|
|
57
58
|
hasOverlay: hasOverlay
|
|
58
|
-
}, /*#__PURE__*/React.createElement(
|
|
59
|
-
|
|
60
|
-
size: UNSAFE_iconBefore_size
|
|
61
|
-
color: 'currentColor'
|
|
59
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
60
|
+
icon: iconBefore,
|
|
61
|
+
size: UNSAFE_iconBefore_size
|
|
62
62
|
})), children && /*#__PURE__*/React.createElement(Content, {
|
|
63
63
|
hasOverlay: hasOverlay
|
|
64
|
-
}, children),
|
|
64
|
+
}, children), iconAfter && /*#__PURE__*/React.createElement(Content, {
|
|
65
65
|
type: "icon",
|
|
66
66
|
position: "after",
|
|
67
67
|
hasOverlay: hasOverlay
|
|
68
|
-
}, /*#__PURE__*/React.createElement(
|
|
69
|
-
|
|
70
|
-
size: UNSAFE_iconAfter_size
|
|
71
|
-
color: 'currentColor'
|
|
68
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
69
|
+
icon: iconAfter,
|
|
70
|
+
size: UNSAFE_iconAfter_size
|
|
72
71
|
}))),
|
|
73
72
|
interactionName,
|
|
74
73
|
isDisabled,
|
|
@@ -94,8 +93,8 @@ const useDefaultButton = ({
|
|
|
94
93
|
ref,
|
|
95
94
|
shouldFitContainer,
|
|
96
95
|
spacing,
|
|
97
|
-
hasIconBefore: Boolean(
|
|
98
|
-
hasIconAfter: Boolean(
|
|
96
|
+
hasIconBefore: Boolean(iconBefore),
|
|
97
|
+
hasIconAfter: Boolean(iconAfter)
|
|
99
98
|
});
|
|
100
99
|
return baseProps;
|
|
101
100
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
3
3
|
import Content from '../shared/content';
|
|
4
|
+
import IconRenderer from '../shared/icon-renderer';
|
|
4
5
|
import renderLoadingOverlay from '../shared/loading-overlay';
|
|
5
6
|
import useButtonBase from '../shared/use-button-base';
|
|
6
7
|
/**
|
|
@@ -19,7 +20,7 @@ const useIconButton = ({
|
|
|
19
20
|
ariaLabelledBy,
|
|
20
21
|
autoFocus,
|
|
21
22
|
buttonType,
|
|
22
|
-
icon
|
|
23
|
+
icon,
|
|
23
24
|
interactionName,
|
|
24
25
|
isDisabled,
|
|
25
26
|
isLoading,
|
|
@@ -55,10 +56,9 @@ const useIconButton = ({
|
|
|
55
56
|
children: /*#__PURE__*/React.createElement(Content, {
|
|
56
57
|
type: "icon",
|
|
57
58
|
hasOverlay: hasOverlay
|
|
58
|
-
}, /*#__PURE__*/React.createElement(
|
|
59
|
-
|
|
60
|
-
size: UNSAFE_size
|
|
61
|
-
color: 'currentColor'
|
|
59
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
60
|
+
icon: icon,
|
|
61
|
+
size: UNSAFE_size
|
|
62
62
|
}), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)),
|
|
63
63
|
interactionName,
|
|
64
64
|
isDisabled,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
function isIconRenderProp(func) {
|
|
4
|
+
return !func.displayName &&
|
|
5
|
+
// most function components and class components have a displayName, negate them
|
|
6
|
+
!func.render &&
|
|
7
|
+
// forwardRef doesn't require a display name, however it does include a render function, negate them
|
|
8
|
+
typeof func === 'function' // at the very least we need to be a function
|
|
9
|
+
;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* __Icon renderer__
|
|
14
|
+
*
|
|
15
|
+
* Used to support render props with icons.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
const IconRenderer = ({
|
|
19
|
+
icon: Icon,
|
|
20
|
+
size
|
|
21
|
+
}) => {
|
|
22
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, getBooleanFF('platform.design-system-team.button-render-prop-fix_lyo55') && isIconRenderProp(Icon) ? Icon({
|
|
23
|
+
label: '',
|
|
24
|
+
size: size,
|
|
25
|
+
color: 'currentColor'
|
|
26
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
27
|
+
label: "",
|
|
28
|
+
size: size,
|
|
29
|
+
color: 'currentColor'
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
export default IconRenderer;
|
|
@@ -119,7 +119,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
119
119
|
action: 'clicked',
|
|
120
120
|
componentName: 'button',
|
|
121
121
|
packageName: "@atlaskit/button",
|
|
122
|
-
packageVersion: "17.
|
|
122
|
+
packageVersion: "17.22.1",
|
|
123
123
|
analyticsData: analyticsContext
|
|
124
124
|
});
|
|
125
125
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
2
|
import Content from '../shared/content';
|
|
3
|
+
import IconRenderer from '../shared/icon-renderer';
|
|
3
4
|
import renderLoadingOverlay from '../shared/loading-overlay';
|
|
4
5
|
import useButtonBase from '../shared/use-button-base';
|
|
5
6
|
/**
|
|
@@ -19,8 +20,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
19
20
|
autoFocus = _ref.autoFocus,
|
|
20
21
|
buttonType = _ref.buttonType,
|
|
21
22
|
children = _ref.children,
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
iconAfter = _ref.iconAfter,
|
|
24
|
+
iconBefore = _ref.iconBefore,
|
|
24
25
|
interactionName = _ref.interactionName,
|
|
25
26
|
isDisabled = _ref.isDisabled,
|
|
26
27
|
_ref$isLoading = _ref.isLoading,
|
|
@@ -51,24 +52,22 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
51
52
|
ariaLabel: ariaLabel,
|
|
52
53
|
ariaLabelledBy: ariaLabelledBy,
|
|
53
54
|
buttonType: buttonType,
|
|
54
|
-
children: /*#__PURE__*/React.createElement(Fragment, null,
|
|
55
|
+
children: /*#__PURE__*/React.createElement(Fragment, null, iconBefore && /*#__PURE__*/React.createElement(Content, {
|
|
55
56
|
type: "icon",
|
|
56
57
|
position: "before",
|
|
57
58
|
hasOverlay: hasOverlay
|
|
58
|
-
}, /*#__PURE__*/React.createElement(
|
|
59
|
-
|
|
60
|
-
size: UNSAFE_iconBefore_size
|
|
61
|
-
color: 'currentColor'
|
|
59
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
60
|
+
icon: iconBefore,
|
|
61
|
+
size: UNSAFE_iconBefore_size
|
|
62
62
|
})), children && /*#__PURE__*/React.createElement(Content, {
|
|
63
63
|
hasOverlay: hasOverlay
|
|
64
|
-
}, children),
|
|
64
|
+
}, children), iconAfter && /*#__PURE__*/React.createElement(Content, {
|
|
65
65
|
type: "icon",
|
|
66
66
|
position: "after",
|
|
67
67
|
hasOverlay: hasOverlay
|
|
68
|
-
}, /*#__PURE__*/React.createElement(
|
|
69
|
-
|
|
70
|
-
size: UNSAFE_iconAfter_size
|
|
71
|
-
color: 'currentColor'
|
|
68
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
69
|
+
icon: iconAfter,
|
|
70
|
+
size: UNSAFE_iconAfter_size
|
|
72
71
|
}))),
|
|
73
72
|
interactionName: interactionName,
|
|
74
73
|
isDisabled: isDisabled,
|
|
@@ -94,8 +93,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
94
93
|
ref: ref,
|
|
95
94
|
shouldFitContainer: shouldFitContainer,
|
|
96
95
|
spacing: spacing,
|
|
97
|
-
hasIconBefore: Boolean(
|
|
98
|
-
hasIconAfter: Boolean(
|
|
96
|
+
hasIconBefore: Boolean(iconBefore),
|
|
97
|
+
hasIconAfter: Boolean(iconAfter)
|
|
99
98
|
});
|
|
100
99
|
return baseProps;
|
|
101
100
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
3
3
|
import Content from '../shared/content';
|
|
4
|
+
import IconRenderer from '../shared/icon-renderer';
|
|
4
5
|
import renderLoadingOverlay from '../shared/loading-overlay';
|
|
5
6
|
import useButtonBase from '../shared/use-button-base';
|
|
6
7
|
/**
|
|
@@ -19,7 +20,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
19
20
|
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
20
21
|
autoFocus = _ref.autoFocus,
|
|
21
22
|
buttonType = _ref.buttonType,
|
|
22
|
-
|
|
23
|
+
icon = _ref.icon,
|
|
23
24
|
interactionName = _ref.interactionName,
|
|
24
25
|
isDisabled = _ref.isDisabled,
|
|
25
26
|
isLoading = _ref.isLoading,
|
|
@@ -54,10 +55,9 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
54
55
|
children: /*#__PURE__*/React.createElement(Content, {
|
|
55
56
|
type: "icon",
|
|
56
57
|
hasOverlay: hasOverlay
|
|
57
|
-
}, /*#__PURE__*/React.createElement(
|
|
58
|
-
|
|
59
|
-
size: UNSAFE_size
|
|
60
|
-
color: 'currentColor'
|
|
58
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
59
|
+
icon: icon,
|
|
60
|
+
size: UNSAFE_size
|
|
61
61
|
}), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)),
|
|
62
62
|
interactionName: interactionName,
|
|
63
63
|
isDisabled: isDisabled,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
function isIconRenderProp(func) {
|
|
4
|
+
return !func.displayName &&
|
|
5
|
+
// most function components and class components have a displayName, negate them
|
|
6
|
+
!func.render &&
|
|
7
|
+
// forwardRef doesn't require a display name, however it does include a render function, negate them
|
|
8
|
+
typeof func === 'function' // at the very least we need to be a function
|
|
9
|
+
;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* __Icon renderer__
|
|
14
|
+
*
|
|
15
|
+
* Used to support render props with icons.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
var IconRenderer = function IconRenderer(_ref) {
|
|
19
|
+
var Icon = _ref.icon,
|
|
20
|
+
size = _ref.size;
|
|
21
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, getBooleanFF('platform.design-system-team.button-render-prop-fix_lyo55') && isIconRenderProp(Icon) ? Icon({
|
|
22
|
+
label: '',
|
|
23
|
+
size: size,
|
|
24
|
+
color: 'currentColor'
|
|
25
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
26
|
+
label: "",
|
|
27
|
+
size: size,
|
|
28
|
+
color: 'currentColor'
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
export default IconRenderer;
|
|
@@ -125,7 +125,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
125
125
|
action: 'clicked',
|
|
126
126
|
componentName: 'button',
|
|
127
127
|
packageName: "@atlaskit/button",
|
|
128
|
-
packageVersion: "17.
|
|
128
|
+
packageVersion: "17.22.1",
|
|
129
129
|
analyticsData: analyticsContext
|
|
130
130
|
});
|
|
131
131
|
|
|
@@ -12,5 +12,5 @@ type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>
|
|
|
12
12
|
*
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
|
-
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter
|
|
15
|
+
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter, iconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
|
|
16
16
|
export default useDefaultButton;
|
|
@@ -12,5 +12,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
|
|
|
12
12
|
*
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
|
-
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon
|
|
15
|
+
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shape, shouldFitContainer, spacing, testId, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
16
16
|
export default useIconButton;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type IconProps, type UNSAFE_NewIconProps } from '@atlaskit/icon/types';
|
|
3
|
+
import { type IconProp } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* __Icon renderer__
|
|
6
|
+
*
|
|
7
|
+
* Used to support render props with icons.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
declare const IconRenderer: ({ icon: Icon, size, }: {
|
|
11
|
+
icon: IconProp;
|
|
12
|
+
size: IconProps['size'] | UNSAFE_NewIconProps['LEGACY_size'];
|
|
13
|
+
}) => JSX.Element;
|
|
14
|
+
export default IconRenderer;
|
|
@@ -12,5 +12,5 @@ type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>
|
|
|
12
12
|
*
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
|
-
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter
|
|
15
|
+
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter, iconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
|
|
16
16
|
export default useDefaultButton;
|
|
@@ -12,5 +12,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
|
|
|
12
12
|
*
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
|
-
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon
|
|
15
|
+
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shape, shouldFitContainer, spacing, testId, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
16
16
|
export default useIconButton;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type IconProps, type UNSAFE_NewIconProps } from '@atlaskit/icon/types';
|
|
3
|
+
import { type IconProp } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* __Icon renderer__
|
|
6
|
+
*
|
|
7
|
+
* Used to support render props with icons.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
declare const IconRenderer: ({ icon: Icon, size, }: {
|
|
11
|
+
icon: IconProp;
|
|
12
|
+
size: IconProps['size'] | UNSAFE_NewIconProps['LEGACY_size'];
|
|
13
|
+
}) => JSX.Element;
|
|
14
|
+
export default IconRenderer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.22.1",
|
|
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/"
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"@atlaskit/icon": "^22.4.0",
|
|
136
136
|
"@atlaskit/interaction-context": "^2.1.0",
|
|
137
137
|
"@atlaskit/platform-feature-flags": "^0.2.5",
|
|
138
|
-
"@atlaskit/primitives": "^
|
|
138
|
+
"@atlaskit/primitives": "^8.0.0",
|
|
139
139
|
"@atlaskit/spinner": "^16.2.0",
|
|
140
140
|
"@atlaskit/theme": "^12.10.0",
|
|
141
141
|
"@atlaskit/tokens": "^1.51.0",
|
|
@@ -155,9 +155,11 @@
|
|
|
155
155
|
"@atlaskit/app-provider": "^1.3.0",
|
|
156
156
|
"@atlaskit/calendar": "^14.3.0",
|
|
157
157
|
"@atlaskit/checkbox": "^13.5.0",
|
|
158
|
+
"@atlaskit/dropdown-menu": "^12.12.0",
|
|
158
159
|
"@atlaskit/ssr": "*",
|
|
159
160
|
"@atlaskit/toggle": "^13.2.0",
|
|
160
161
|
"@atlaskit/visual-regression": "*",
|
|
162
|
+
"@atlassian/feature-flags-test-utils": "^0.2.1",
|
|
161
163
|
"@testing-library/react": "^12.1.5",
|
|
162
164
|
"@testing-library/user-event": "^14.4.3",
|
|
163
165
|
"@types/react-router-dom": "^4.3.1",
|
|
@@ -201,6 +203,9 @@
|
|
|
201
203
|
},
|
|
202
204
|
"platform.design-system-team.component-visual-refresh_t8zbo": {
|
|
203
205
|
"type": "boolean"
|
|
206
|
+
},
|
|
207
|
+
"platform.design-system-team.button-render-prop-fix_lyo55": {
|
|
208
|
+
"type": "boolean"
|
|
204
209
|
}
|
|
205
210
|
}
|
|
206
211
|
}
|