@atlaskit/button 17.11.1 → 17.12.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 +12 -0
- package/dist/cjs/new-button/variants/shared/use-button-base.js +4 -16
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/variants/shared/use-button-base.js +5 -17
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/variants/shared/use-button-base.js +5 -17
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/new-button/variants/default/types.d.ts +4 -0
- package/dist/types/new-button/variants/icon/types.d.ts +3 -1
- package/dist/types-ts4.5/new-button/variants/default/types.d.ts +4 -0
- package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +3 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 17.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#90619](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90619) [`acbd9680ed68`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/acbd9680ed68) - Replaces internal ref merge with one from our util set
|
|
8
|
+
|
|
9
|
+
## 17.12.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#89657](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89657) [`aa76565f1f5b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/aa76565f1f5b) - New buttons now accept render props for icon properties. This can be useful when setting props on icons directly.
|
|
14
|
+
|
|
3
15
|
## 17.11.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
11
12
|
var _useAutoFocus = _interopRequireDefault(require("@atlaskit/ds-lib/use-auto-focus"));
|
|
12
13
|
var _primitives = require("@atlaskit/primitives");
|
|
13
14
|
var _splitButtonContext = require("../../containers/split-button/split-button-context");
|
|
@@ -78,7 +79,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
78
79
|
shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
|
|
79
80
|
_ref$spacing = _ref.spacing,
|
|
80
81
|
propSpacing = _ref$spacing === void 0 ? 'default' : _ref$spacing;
|
|
81
|
-
var
|
|
82
|
+
var localRef = (0, _react.useRef)(null);
|
|
82
83
|
var splitButtonContext = (0, _splitButtonContext.useSplitButtonContext)();
|
|
83
84
|
var isSplitButton = Boolean(splitButtonContext);
|
|
84
85
|
var isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
|
|
@@ -87,20 +88,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
87
88
|
var isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
|
|
88
89
|
var isHighlighted = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isHighlighted) || false;
|
|
89
90
|
var isActiveOverSelected = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isActiveOverSelected) || false;
|
|
90
|
-
|
|
91
|
-
ourRef.current = node;
|
|
92
|
-
if (ref === null) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (typeof ref === 'function') {
|
|
96
|
-
ref(node);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// @ts-ignore
|
|
101
|
-
ref.current = node;
|
|
102
|
-
}, [ourRef, ref]);
|
|
103
|
-
(0, _useAutoFocus.default)(ourRef, autoFocus);
|
|
91
|
+
(0, _useAutoFocus.default)(localRef, autoFocus);
|
|
104
92
|
var buttonXCSS = (0, _react.useMemo)(function () {
|
|
105
93
|
return (0, _xcss.getXCSS)({
|
|
106
94
|
appearance: appearance,
|
|
@@ -123,7 +111,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
123
111
|
}, [appearance, buttonType, spacing, isDisabled, isLoading, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
124
112
|
var isEffectivelyDisabled = isDisabled || Boolean(overlay);
|
|
125
113
|
return _objectSpread({
|
|
126
|
-
ref:
|
|
114
|
+
ref: (0, _mergeRefs.default)([localRef, ref]),
|
|
127
115
|
xcss: buttonXCSS,
|
|
128
116
|
// Consider overlay buttons to be effectively disabled
|
|
129
117
|
isDisabled: isEffectivelyDisabled,
|
|
@@ -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.
|
|
120
|
+
packageVersion: "17.12.1",
|
|
121
121
|
analyticsData: analyticsContext
|
|
122
122
|
});
|
|
123
123
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { Fragment,
|
|
1
|
+
import React, { Fragment, useMemo, useRef } from 'react';
|
|
2
|
+
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
2
3
|
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
3
4
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
4
5
|
import { useSplitButtonContext } from '../../containers/split-button/split-button-context';
|
|
@@ -57,7 +58,7 @@ const useButtonBase = ({
|
|
|
57
58
|
shouldFitContainer = false,
|
|
58
59
|
spacing: propSpacing = 'default'
|
|
59
60
|
}) => {
|
|
60
|
-
const
|
|
61
|
+
const localRef = useRef(null);
|
|
61
62
|
const splitButtonContext = useSplitButtonContext();
|
|
62
63
|
const isSplitButton = Boolean(splitButtonContext);
|
|
63
64
|
const isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
|
|
@@ -66,20 +67,7 @@ const useButtonBase = ({
|
|
|
66
67
|
const isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
|
|
67
68
|
const isHighlighted = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isHighlighted) || false;
|
|
68
69
|
const isActiveOverSelected = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isActiveOverSelected) || false;
|
|
69
|
-
|
|
70
|
-
ourRef.current = node;
|
|
71
|
-
if (ref === null) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (typeof ref === 'function') {
|
|
75
|
-
ref(node);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// @ts-ignore
|
|
80
|
-
ref.current = node;
|
|
81
|
-
}, [ourRef, ref]);
|
|
82
|
-
useAutoFocus(ourRef, autoFocus);
|
|
70
|
+
useAutoFocus(localRef, autoFocus);
|
|
83
71
|
const buttonXCSS = useMemo(() => getXCSS({
|
|
84
72
|
appearance,
|
|
85
73
|
spacing,
|
|
@@ -100,7 +88,7 @@ const useButtonBase = ({
|
|
|
100
88
|
}), [appearance, buttonType, spacing, isDisabled, isLoading, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
101
89
|
const isEffectivelyDisabled = isDisabled || Boolean(overlay);
|
|
102
90
|
return {
|
|
103
|
-
ref:
|
|
91
|
+
ref: mergeRefs([localRef, ref]),
|
|
104
92
|
xcss: buttonXCSS,
|
|
105
93
|
// Consider overlay buttons to be effectively disabled
|
|
106
94
|
isDisabled: isEffectivelyDisabled,
|
|
@@ -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.
|
|
105
|
+
packageVersion: "17.12.1",
|
|
106
106
|
analyticsData: analyticsContext
|
|
107
107
|
});
|
|
108
108
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import React, { Fragment,
|
|
4
|
+
import React, { Fragment, useMemo, useRef } from 'react';
|
|
5
|
+
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
5
6
|
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
6
7
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
7
8
|
import { useSplitButtonContext } from '../../containers/split-button/split-button-context';
|
|
@@ -68,7 +69,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
68
69
|
shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
|
|
69
70
|
_ref$spacing = _ref.spacing,
|
|
70
71
|
propSpacing = _ref$spacing === void 0 ? 'default' : _ref$spacing;
|
|
71
|
-
var
|
|
72
|
+
var localRef = useRef(null);
|
|
72
73
|
var splitButtonContext = useSplitButtonContext();
|
|
73
74
|
var isSplitButton = Boolean(splitButtonContext);
|
|
74
75
|
var isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
|
|
@@ -77,20 +78,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
77
78
|
var isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
|
|
78
79
|
var isHighlighted = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isHighlighted) || false;
|
|
79
80
|
var isActiveOverSelected = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isActiveOverSelected) || false;
|
|
80
|
-
|
|
81
|
-
ourRef.current = node;
|
|
82
|
-
if (ref === null) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (typeof ref === 'function') {
|
|
86
|
-
ref(node);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// @ts-ignore
|
|
91
|
-
ref.current = node;
|
|
92
|
-
}, [ourRef, ref]);
|
|
93
|
-
useAutoFocus(ourRef, autoFocus);
|
|
81
|
+
useAutoFocus(localRef, autoFocus);
|
|
94
82
|
var buttonXCSS = useMemo(function () {
|
|
95
83
|
return getXCSS({
|
|
96
84
|
appearance: appearance,
|
|
@@ -113,7 +101,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
113
101
|
}, [appearance, buttonType, spacing, isDisabled, isLoading, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
114
102
|
var isEffectivelyDisabled = isDisabled || Boolean(overlay);
|
|
115
103
|
return _objectSpread({
|
|
116
|
-
ref:
|
|
104
|
+
ref: mergeRefs([localRef, ref]),
|
|
117
105
|
xcss: buttonXCSS,
|
|
118
106
|
// Consider overlay buttons to be effectively disabled
|
|
119
107
|
isDisabled: isEffectivelyDisabled,
|
|
@@ -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.
|
|
111
|
+
packageVersion: "17.12.1",
|
|
112
112
|
analyticsData: analyticsContext
|
|
113
113
|
});
|
|
114
114
|
|
|
@@ -10,6 +10,8 @@ export type CommonDefaultButtonProps = {
|
|
|
10
10
|
*/
|
|
11
11
|
iconAfter?: IconProp;
|
|
12
12
|
/**
|
|
13
|
+
* @deprecated Prefer `iconAfter` render prop for icon customizations.
|
|
14
|
+
*
|
|
13
15
|
* Set the size of the icon after. `medium` is default, so it does not need to be specified.
|
|
14
16
|
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API
|
|
15
17
|
*/
|
|
@@ -19,6 +21,8 @@ export type CommonDefaultButtonProps = {
|
|
|
19
21
|
*/
|
|
20
22
|
iconBefore?: IconProp;
|
|
21
23
|
/**
|
|
24
|
+
* @deprecated Prefer `iconBefore` render prop for icon customizations.
|
|
25
|
+
*
|
|
22
26
|
* Set the size of the icon before. `medium` is default, so it does not need to be specified.
|
|
23
27
|
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API
|
|
24
28
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TooltipProps } from '@atlaskit/tooltip';
|
|
2
|
+
import { type TooltipProps } from '@atlaskit/tooltip';
|
|
3
3
|
import { type IconButtonAppearance, type IconButtonSpacing, type IconProp, type IconSize } from '../types';
|
|
4
4
|
export type CommonIconButtonProps = {
|
|
5
5
|
'aria-label'?: never;
|
|
@@ -36,6 +36,8 @@ export type CommonIconButtonProps = {
|
|
|
36
36
|
*/
|
|
37
37
|
tooltip?: Partial<Omit<TooltipProps, 'children'>>;
|
|
38
38
|
/**
|
|
39
|
+
* @deprecated Prefer `icon` render prop for icon customizations.
|
|
40
|
+
*
|
|
39
41
|
* Set the size of the icon. `medium` is default, so it does not need to be specified.
|
|
40
42
|
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API.
|
|
41
43
|
*/
|
|
@@ -10,6 +10,8 @@ export type CommonDefaultButtonProps = {
|
|
|
10
10
|
*/
|
|
11
11
|
iconAfter?: IconProp;
|
|
12
12
|
/**
|
|
13
|
+
* @deprecated Prefer `iconAfter` render prop for icon customizations.
|
|
14
|
+
*
|
|
13
15
|
* Set the size of the icon after. `medium` is default, so it does not need to be specified.
|
|
14
16
|
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API
|
|
15
17
|
*/
|
|
@@ -19,6 +21,8 @@ export type CommonDefaultButtonProps = {
|
|
|
19
21
|
*/
|
|
20
22
|
iconBefore?: IconProp;
|
|
21
23
|
/**
|
|
24
|
+
* @deprecated Prefer `iconBefore` render prop for icon customizations.
|
|
25
|
+
*
|
|
22
26
|
* Set the size of the icon before. `medium` is default, so it does not need to be specified.
|
|
23
27
|
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API
|
|
24
28
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TooltipProps } from '@atlaskit/tooltip';
|
|
2
|
+
import { type TooltipProps } from '@atlaskit/tooltip';
|
|
3
3
|
import { type IconButtonAppearance, type IconButtonSpacing, type IconProp, type IconSize } from '../types';
|
|
4
4
|
export type CommonIconButtonProps = {
|
|
5
5
|
'aria-label'?: never;
|
|
@@ -36,6 +36,8 @@ export type CommonIconButtonProps = {
|
|
|
36
36
|
*/
|
|
37
37
|
tooltip?: Partial<Omit<TooltipProps, 'children'>>;
|
|
38
38
|
/**
|
|
39
|
+
* @deprecated Prefer `icon` render prop for icon customizations.
|
|
40
|
+
*
|
|
39
41
|
* Set the size of the icon. `medium` is default, so it does not need to be specified.
|
|
40
42
|
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API.
|
|
41
43
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.12.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/"
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@atlaskit/spinner": "^16.0.0",
|
|
92
92
|
"@atlaskit/theme": "^12.7.0",
|
|
93
93
|
"@atlaskit/tokens": "^1.43.0",
|
|
94
|
-
"@atlaskit/tooltip": "^18.
|
|
94
|
+
"@atlaskit/tooltip": "^18.2.0",
|
|
95
95
|
"@atlaskit/visually-hidden": "^1.2.4",
|
|
96
96
|
"@babel/runtime": "^7.0.0",
|
|
97
97
|
"@emotion/react": "^11.7.1"
|
|
@@ -104,6 +104,7 @@
|
|
|
104
104
|
"@af/integration-testing": "*",
|
|
105
105
|
"@af/visual-regression": "*",
|
|
106
106
|
"@atlaskit/app-provider": "^1.3.0",
|
|
107
|
+
"@atlaskit/checkbox": "*",
|
|
107
108
|
"@atlaskit/ssr": "*",
|
|
108
109
|
"@atlaskit/visual-regression": "*",
|
|
109
110
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|