@atlaskit/button 16.7.6 → 16.8.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 +6 -0
- package/dist/cjs/custom-theme-button/custom-theme-button.js +1 -0
- package/dist/cjs/loading-button.js +1 -0
- package/dist/cjs/shared/button-base.js +3 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/custom-theme-button/custom-theme-button.js +1 -0
- package/dist/es2019/loading-button.js +1 -0
- package/dist/es2019/shared/button-base.js +6 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/custom-theme-button/custom-theme-button.js +1 -0
- package/dist/esm/loading-button.js +1 -0
- package/dist/esm/shared/button-base.js +3 -2
- package/dist/esm/version.json +1 -1
- package/package.json +10 -3
- package/tmp/api-report-tmp.d.ts +133 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 16.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`5104149700b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5104149700b) - Button no longer unnecessarily sets `tabindex` as `0` for focus when using default `<button>` or `<a>` elements, as they are already focusable. This is still set when using the `component` prop so other elements can still be be focused. (This change is feature flagged)
|
|
8
|
+
|
|
3
9
|
## 16.7.6
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -185,6 +185,7 @@ var CustomThemeButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.de
|
|
|
185
185
|
return /*#__PURE__*/_react.default.createElement(_buttonBase.default, (0, _extends2.default)({}, restProps, {
|
|
186
186
|
ref: ref,
|
|
187
187
|
overlay: isLoading ? /*#__PURE__*/_react.default.createElement(_loadingSpinner.default, restProps) : null,
|
|
188
|
+
"aria-busy": isLoading,
|
|
188
189
|
onMouseEnter: onMouseEnter,
|
|
189
190
|
onMouseLeave: onMouseLeave,
|
|
190
191
|
onMouseDown: onMouseDown,
|
|
@@ -25,6 +25,7 @@ var LoadingButton = /*#__PURE__*/_react.default.forwardRef(function LoadingButto
|
|
|
25
25
|
// Button already has React.memo, so just leaning on that
|
|
26
26
|
return /*#__PURE__*/_react.default.createElement(_button.default, (0, _extends2.default)({}, rest, {
|
|
27
27
|
ref: ref,
|
|
28
|
+
"aria-busy": isLoading,
|
|
28
29
|
overlay: isLoading ? /*#__PURE__*/_react.default.createElement(_loadingSpinner.default, rest) : null
|
|
29
30
|
}));
|
|
30
31
|
});
|
|
@@ -15,6 +15,7 @@ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
|
15
15
|
var _useAutoFocus = _interopRequireDefault(require("@atlaskit/ds-lib/use-auto-focus"));
|
|
16
16
|
var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
|
|
17
17
|
var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-context"));
|
|
18
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
var _colors = require("@atlaskit/theme/colors");
|
|
19
20
|
var _blockEvents = _interopRequireDefault(require("./block-events"));
|
|
20
21
|
var _css = require("./css");
|
|
@@ -53,7 +54,7 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
|
|
|
53
54
|
href = props.href,
|
|
54
55
|
overlay = props.overlay,
|
|
55
56
|
_props$tabIndex = props.tabIndex,
|
|
56
|
-
tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
|
|
57
|
+
tabIndex = _props$tabIndex === void 0 ? !props.component && (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.clove-sprint-a11y-button_5rz5j') ? undefined : 0 : _props$tabIndex,
|
|
57
58
|
_props$type = props.type,
|
|
58
59
|
type = _props$type === void 0 ? !href ? 'button' : undefined : _props$type,
|
|
59
60
|
_props$onMouseDown = props.onMouseDown,
|
|
@@ -93,7 +94,7 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
|
|
|
93
94
|
action: 'clicked',
|
|
94
95
|
componentName: 'button',
|
|
95
96
|
packageName: "@atlaskit/button",
|
|
96
|
-
packageVersion: "16.
|
|
97
|
+
packageVersion: "16.8.0",
|
|
97
98
|
analyticsData: analyticsContext
|
|
98
99
|
});
|
|
99
100
|
|
package/dist/cjs/version.json
CHANGED
|
@@ -151,6 +151,7 @@ const CustomThemeButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef
|
|
|
151
151
|
}) => /*#__PURE__*/React.createElement(ButtonBase, _extends({}, restProps, {
|
|
152
152
|
ref: ref,
|
|
153
153
|
overlay: isLoading ? /*#__PURE__*/React.createElement(LoadingSpinner, restProps) : null,
|
|
154
|
+
"aria-busy": isLoading,
|
|
154
155
|
onMouseEnter: onMouseEnter,
|
|
155
156
|
onMouseLeave: onMouseLeave,
|
|
156
157
|
onMouseDown: onMouseDown,
|
|
@@ -16,6 +16,7 @@ const LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton({
|
|
|
16
16
|
// Button already has React.memo, so just leaning on that
|
|
17
17
|
return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
|
|
18
18
|
ref: ref,
|
|
19
|
+
"aria-busy": isLoading,
|
|
19
20
|
overlay: isLoading ? /*#__PURE__*/React.createElement(LoadingSpinner, rest) : null
|
|
20
21
|
}));
|
|
21
22
|
});
|
|
@@ -8,6 +8,7 @@ import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
|
8
8
|
import FocusRing from '@atlaskit/focus-ring';
|
|
9
9
|
// eslint-disable-next-line no-duplicate-imports
|
|
10
10
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
11
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { N500 } from '@atlaskit/theme/colors';
|
|
12
13
|
import blockEvents from './block-events';
|
|
13
14
|
import { getContentStyle, getFadingCss, getIconStyle, overlayCss } from './css';
|
|
@@ -36,7 +37,10 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
36
37
|
className,
|
|
37
38
|
href,
|
|
38
39
|
overlay,
|
|
39
|
-
tabIndex
|
|
40
|
+
// Don't set unnecessary tabIndex for focus if using standard <button> or <a>
|
|
41
|
+
// html elements. Set to `0` for custom components to ensure other elements can
|
|
42
|
+
// be focused (although the custom component could be a <button> or <a>...)
|
|
43
|
+
tabIndex = !props.component && getBooleanFF('platform.design-system-team.clove-sprint-a11y-button_5rz5j') ? undefined : 0,
|
|
40
44
|
type = !href ? 'button' : undefined,
|
|
41
45
|
onMouseDown: providedOnMouseDown = noop,
|
|
42
46
|
onClick: providedOnClick = noop,
|
|
@@ -76,7 +80,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
76
80
|
action: 'clicked',
|
|
77
81
|
componentName: 'button',
|
|
78
82
|
packageName: "@atlaskit/button",
|
|
79
|
-
packageVersion: "16.
|
|
83
|
+
packageVersion: "16.8.0",
|
|
80
84
|
analyticsData: analyticsContext
|
|
81
85
|
});
|
|
82
86
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -175,6 +175,7 @@ var CustomThemeButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(f
|
|
|
175
175
|
return /*#__PURE__*/React.createElement(ButtonBase, _extends({}, restProps, {
|
|
176
176
|
ref: ref,
|
|
177
177
|
overlay: isLoading ? /*#__PURE__*/React.createElement(LoadingSpinner, restProps) : null,
|
|
178
|
+
"aria-busy": isLoading,
|
|
178
179
|
onMouseEnter: onMouseEnter,
|
|
179
180
|
onMouseLeave: onMouseLeave,
|
|
180
181
|
onMouseDown: onMouseDown,
|
|
@@ -18,6 +18,7 @@ var LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton(_ref, r
|
|
|
18
18
|
// Button already has React.memo, so just leaning on that
|
|
19
19
|
return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
|
|
20
20
|
ref: ref,
|
|
21
|
+
"aria-busy": isLoading,
|
|
21
22
|
overlay: isLoading ? /*#__PURE__*/React.createElement(LoadingSpinner, rest) : null
|
|
22
23
|
}));
|
|
23
24
|
});
|
|
@@ -10,6 +10,7 @@ import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
|
10
10
|
import FocusRing from '@atlaskit/focus-ring';
|
|
11
11
|
// eslint-disable-next-line no-duplicate-imports
|
|
12
12
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
13
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { N500 } from '@atlaskit/theme/colors';
|
|
14
15
|
import blockEvents from './block-events';
|
|
15
16
|
import { getContentStyle, getFadingCss, getIconStyle, overlayCss } from './css';
|
|
@@ -44,7 +45,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
44
45
|
href = props.href,
|
|
45
46
|
overlay = props.overlay,
|
|
46
47
|
_props$tabIndex = props.tabIndex,
|
|
47
|
-
tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
|
|
48
|
+
tabIndex = _props$tabIndex === void 0 ? !props.component && getBooleanFF('platform.design-system-team.clove-sprint-a11y-button_5rz5j') ? undefined : 0 : _props$tabIndex,
|
|
48
49
|
_props$type = props.type,
|
|
49
50
|
type = _props$type === void 0 ? !href ? 'button' : undefined : _props$type,
|
|
50
51
|
_props$onMouseDown = props.onMouseDown,
|
|
@@ -84,7 +85,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
84
85
|
action: 'clicked',
|
|
85
86
|
componentName: 'button',
|
|
86
87
|
packageName: "@atlaskit/button",
|
|
87
|
-
packageVersion: "16.
|
|
88
|
+
packageVersion: "16.8.0",
|
|
88
89
|
analyticsData: analyticsContext
|
|
89
90
|
});
|
|
90
91
|
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.8.0",
|
|
4
4
|
"description": "A button triggers an event or action. They let users know what will happen next.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"atlaskit:src": "src/index.tsx",
|
|
25
25
|
"atlassian": {
|
|
26
26
|
"team": "Design System Team",
|
|
27
|
-
"releaseModel": "
|
|
27
|
+
"releaseModel": "continuous",
|
|
28
28
|
"website": {
|
|
29
29
|
"name": "Button",
|
|
30
30
|
"category": "Components"
|
|
@@ -38,14 +38,20 @@
|
|
|
38
38
|
"./types": "./src/entry-points/types.tsx",
|
|
39
39
|
".": "./src/index.tsx"
|
|
40
40
|
},
|
|
41
|
+
"platform-feature-flags": {
|
|
42
|
+
"platform.design-system-team.clove-sprint-a11y-button_5rz5j": {
|
|
43
|
+
"type": "boolean"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
41
46
|
"dependencies": {
|
|
42
47
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
43
48
|
"@atlaskit/ds-lib": "^2.2.0",
|
|
44
49
|
"@atlaskit/focus-ring": "^1.3.0",
|
|
45
50
|
"@atlaskit/interaction-context": "^2.1.0",
|
|
51
|
+
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
46
52
|
"@atlaskit/spinner": "^15.5.0",
|
|
47
53
|
"@atlaskit/theme": "^12.5.0",
|
|
48
|
-
"@atlaskit/tokens": "^1.
|
|
54
|
+
"@atlaskit/tokens": "^1.8.0",
|
|
49
55
|
"@babel/runtime": "^7.0.0",
|
|
50
56
|
"@emotion/react": "^11.7.1"
|
|
51
57
|
},
|
|
@@ -67,6 +73,7 @@
|
|
|
67
73
|
"@types/react-router-dom": "^4.3.1",
|
|
68
74
|
"ast-types": "^0.13.3",
|
|
69
75
|
"bind-event-listener": "^2.1.1",
|
|
76
|
+
"jest-axe": "^4.0.0",
|
|
70
77
|
"jest-emotion": "^10.0.32",
|
|
71
78
|
"jest-in-case": "^1.0.2",
|
|
72
79
|
"jscodeshift": "^0.13.0",
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/button"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
|
|
9
|
+
import { ComponentType } from 'react';
|
|
10
|
+
import { CSSObject } from '@emotion/react';
|
|
11
|
+
import { jsx } from '@emotion/react';
|
|
12
|
+
import { default as React_2 } from 'react';
|
|
13
|
+
import { ReactNode } from 'react';
|
|
14
|
+
import { ThemeModes } from '@atlaskit/theme/types';
|
|
15
|
+
import { ThemeModes as ThemeModes_2 } from '@atlaskit/theme';
|
|
16
|
+
import { ThemeProp } from '@atlaskit/theme/components';
|
|
17
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
18
|
+
|
|
19
|
+
// @public (undocumented)
|
|
20
|
+
export type Appearance = 'danger' | 'default' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
|
|
21
|
+
|
|
22
|
+
// @public (undocumented)
|
|
23
|
+
export type BaseOwnProps = {
|
|
24
|
+
appearance?: Appearance;
|
|
25
|
+
autoFocus?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
overlay?: React_2.ReactNode;
|
|
28
|
+
href?: string;
|
|
29
|
+
iconAfter?: React_2.ReactChild;
|
|
30
|
+
iconBefore?: React_2.ReactChild;
|
|
31
|
+
isDisabled?: boolean;
|
|
32
|
+
isSelected?: boolean;
|
|
33
|
+
onBlur?: React_2.FocusEventHandler<HTMLElement>;
|
|
34
|
+
onClick?: (e: React_2.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
35
|
+
onFocus?: React_2.FocusEventHandler<HTMLElement>;
|
|
36
|
+
spacing?: Spacing;
|
|
37
|
+
target?: React_2.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
38
|
+
type?: React_2.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
39
|
+
shouldFitContainer?: boolean;
|
|
40
|
+
children?: React_2.ReactNode;
|
|
41
|
+
testId?: string;
|
|
42
|
+
component?: React_2.ComponentType<React_2.AllHTMLAttributes<HTMLElement>> | React_2.ElementType;
|
|
43
|
+
interactionName?: string;
|
|
44
|
+
analyticsContext?: Record<string, any>;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// @public (undocumented)
|
|
48
|
+
export type BaseProps = Combine<Combine<Omit<React_2.AllHTMLAttributes<HTMLElement>, 'disabled'>, {
|
|
49
|
+
'data-testid'?: never;
|
|
50
|
+
'data-has-overlay'?: never;
|
|
51
|
+
}>, BaseOwnProps>;
|
|
52
|
+
|
|
53
|
+
// @public
|
|
54
|
+
const Button: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<HTMLElement>>>;
|
|
55
|
+
export default Button;
|
|
56
|
+
|
|
57
|
+
// @public (undocumented)
|
|
58
|
+
export function ButtonGroup({ appearance, children, }: ButtonGroupProps): jsx.JSX.Element;
|
|
59
|
+
|
|
60
|
+
// @public (undocumented)
|
|
61
|
+
type ButtonGroupProps = {
|
|
62
|
+
appearance?: Appearance;
|
|
63
|
+
children?: React_2.ReactNode;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// @public (undocumented)
|
|
67
|
+
export interface ButtonProps extends BaseProps {
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// @public (undocumented)
|
|
71
|
+
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
72
|
+
|
|
73
|
+
// @public
|
|
74
|
+
export const CustomThemeButton: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<Omit<BaseProps, "overlay"> & CustomThemeButtonOwnProps & React_2.RefAttributes<HTMLElement>>>;
|
|
75
|
+
|
|
76
|
+
// @public (undocumented)
|
|
77
|
+
export type CustomThemeButtonOwnProps = {
|
|
78
|
+
isLoading?: boolean;
|
|
79
|
+
theme?: (current: (props: ThemeProps) => ThemeTokens, props: ThemeProps) => ThemeTokens;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// @public (undocumented)
|
|
83
|
+
export type CustomThemeButtonProps = Omit<BaseProps, 'overlay'> & CustomThemeButtonOwnProps;
|
|
84
|
+
|
|
85
|
+
// @public (undocumented)
|
|
86
|
+
export type InteractionState = 'active' | 'default' | 'disabled' | 'focus' | 'focusSelected' | 'hover' | 'selected';
|
|
87
|
+
|
|
88
|
+
// @public
|
|
89
|
+
export const LoadingButton: React_2.ForwardRefExoticComponent<Omit<BaseProps, "overlay"> & LoadingButtonOwnProps & React_2.RefAttributes<HTMLElement>>;
|
|
90
|
+
|
|
91
|
+
// @public (undocumented)
|
|
92
|
+
export type LoadingButtonOwnProps = {
|
|
93
|
+
isLoading?: boolean;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// @public (undocumented)
|
|
97
|
+
export type LoadingButtonProps = Omit<BaseProps, 'overlay'> & LoadingButtonOwnProps;
|
|
98
|
+
|
|
99
|
+
// @public (undocumented)
|
|
100
|
+
export type Spacing = 'compact' | 'default' | 'none';
|
|
101
|
+
|
|
102
|
+
// @public (undocumented)
|
|
103
|
+
export const Theme: {
|
|
104
|
+
Consumer: ComponentType< {
|
|
105
|
+
children: (tokens: ThemeTokens) => ReactNode;
|
|
106
|
+
} & Partial<CustomThemeButtonProps> & {
|
|
107
|
+
state: InteractionState;
|
|
108
|
+
iconIsOnlyChild?: boolean | undefined;
|
|
109
|
+
mode?: ThemeModes_2 | undefined;
|
|
110
|
+
}>;
|
|
111
|
+
Provider: ComponentType< {
|
|
112
|
+
children?: ReactNode;
|
|
113
|
+
value?: ThemeProp<ThemeTokens, ThemeProps> | undefined;
|
|
114
|
+
}>;
|
|
115
|
+
useTheme: (props: ThemeProps) => ThemeTokens;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// @public (undocumented)
|
|
119
|
+
export type ThemeProps = Partial<CustomThemeButtonProps> & {
|
|
120
|
+
state: InteractionState;
|
|
121
|
+
iconIsOnlyChild?: boolean;
|
|
122
|
+
mode?: ThemeModes;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// @public (undocumented)
|
|
126
|
+
export type ThemeTokens = {
|
|
127
|
+
buttonStyles: CSSObject;
|
|
128
|
+
spinnerStyles: CSSObject;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// (No @packageDocumentation comment for this package)
|
|
132
|
+
|
|
133
|
+
```
|