@atlaskit/button 16.3.2 → 16.3.5
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 +19 -0
- package/__perf__/customised.tsx +1 -1
- package/codemods/{15.0.0-lite-mode.ts → 15.0.0-lite-mode.tsx} +0 -0
- package/codemods/{15.1.1-data-testid.ts → 15.1.1-data-testid.tsx} +0 -0
- package/codemods/__tests__/15.0.0-lite-mode/{optimistic.ts → optimistic.tsx} +0 -2
- package/codemods/__tests__/15.0.0-lite-mode/{safe.ts → safe.tsx} +0 -0
- package/codemods/__tests__/15.0.0-lite-mode/{shared.ts → shared.tsx} +0 -0
- package/codemods/__tests__/15.1.1-data-testid/{rename-data-testid.ts → rename-data-testid.tsx} +0 -0
- package/codemods/__tests__/{_framework.ts → _framework.tsx} +2 -2
- package/codemods/helpers/{15.0.0-runner.ts → 15.0.0-runner.tsx} +0 -0
- package/codemods/helpers/{helpers-generic.ts → helpers-generic.tsx} +0 -0
- package/codemods/{optimistic-15.0.0-lite-mode.ts → optimistic-15.0.0-lite-mode.tsx} +0 -0
- package/dist/cjs/button-group.js +4 -1
- package/dist/cjs/button.js +13 -4
- package/dist/cjs/custom-theme-button/custom-theme-button.js +7 -0
- package/dist/cjs/custom-theme-button/theme.js +2 -1
- package/dist/cjs/loading-button.js +7 -0
- package/dist/cjs/shared/button-base.js +8 -7
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/button-group.js +4 -1
- package/dist/es2019/button.js +11 -3
- package/dist/es2019/custom-theme-button/custom-theme-button.js +8 -0
- package/dist/es2019/custom-theme-button/theme.js +2 -1
- package/dist/es2019/loading-button.js +8 -0
- package/dist/es2019/shared/button-base.js +5 -6
- package/dist/es2019/version.json +1 -1
- package/dist/esm/button-group.js +4 -1
- package/dist/esm/button.js +11 -3
- package/dist/esm/custom-theme-button/custom-theme-button.js +8 -0
- package/dist/esm/custom-theme-button/theme.js +2 -1
- package/dist/esm/loading-button.js +8 -0
- package/dist/esm/shared/button-base.js +5 -6
- package/dist/esm/version.json +1 -1
- package/dist/types/button-group.d.ts +3 -1
- package/dist/types/button.d.ts +9 -0
- package/dist/types/custom-theme-button/custom-theme-button-types.d.ts +2 -1
- package/dist/types/custom-theme-button/custom-theme-button.d.ts +7 -0
- package/dist/types/loading-button.d.ts +7 -0
- package/dist/types/shared/loading-spinner.d.ts +2 -2
- package/dist/types/types.d.ts +57 -19
- package/package.json +13 -12
- package/report.api.md +177 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 16.3.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e09f1576233`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e09f1576233) - Internal code change turning on new linting rules.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 16.3.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`65a90f6ba14`](https://bitbucket.org/atlassian/atlassian-frontend/commits/65a90f6ba14) - Use medium icons for button examples
|
|
15
|
+
|
|
16
|
+
## 16.3.3
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [`8a5bdb3c844`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8a5bdb3c844) - Upgrading internal dependency (bind-event-listener) for improved internal types
|
|
21
|
+
|
|
3
22
|
## 16.3.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/__perf__/customised.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import AddIcon from '@atlaskit/icon/glyph/editor/add';
|
|
|
5
5
|
import { CustomThemeButton } from '../src';
|
|
6
6
|
|
|
7
7
|
export default () => (
|
|
8
|
-
<CustomThemeButton iconBefore={<AddIcon label="
|
|
8
|
+
<CustomThemeButton iconBefore={<AddIcon label="" />}>
|
|
9
9
|
Button
|
|
10
10
|
</CustomThemeButton>
|
|
11
11
|
);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/codemods/__tests__/15.1.1-data-testid/{rename-data-testid.ts → rename-data-testid.tsx}
RENAMED
|
File without changes
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { API, FileInfo, Options } from 'jscodeshift';
|
|
2
2
|
|
|
3
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
4
|
+
|
|
3
5
|
const applyTransform = require('jscodeshift/dist/testUtils').applyTransform;
|
|
4
6
|
|
|
5
7
|
type Transformer = (file: FileInfo, jscodeshift: API, options: Options) => void;
|
|
@@ -14,8 +16,6 @@ type TestArgs = {
|
|
|
14
16
|
after?: () => void;
|
|
15
17
|
};
|
|
16
18
|
|
|
17
|
-
function noop() {}
|
|
18
|
-
|
|
19
19
|
export function check({
|
|
20
20
|
it: name,
|
|
21
21
|
original,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/cjs/button-group.js
CHANGED
|
@@ -43,7 +43,10 @@ function ButtonGroup(_ref) {
|
|
|
43
43
|
return (0, _core.jsx)("div", {
|
|
44
44
|
key: idx,
|
|
45
45
|
css: groupItemStyles
|
|
46
|
-
}, appearance ?
|
|
46
|
+
}, appearance ?
|
|
47
|
+
/*#__PURE__*/
|
|
48
|
+
// eslint-disable-next-line @repo/internal/react/no-clone-element
|
|
49
|
+
_react.default.cloneElement(child, {
|
|
47
50
|
appearance: appearance
|
|
48
51
|
}) : child);
|
|
49
52
|
}));
|
package/dist/cjs/button.js
CHANGED
|
@@ -17,6 +17,8 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
|
|
20
|
+
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
21
|
+
|
|
20
22
|
var _components = require("@atlaskit/theme/components");
|
|
21
23
|
|
|
22
24
|
var _buttonBase = _interopRequireDefault(require("./shared/button-base"));
|
|
@@ -31,15 +33,22 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
31
33
|
|
|
32
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
35
|
|
|
34
|
-
function noop() {}
|
|
35
|
-
|
|
36
36
|
var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* __Button__
|
|
40
|
+
*
|
|
41
|
+
* A button triggers an event or action. They let users know what will happen next.
|
|
42
|
+
*
|
|
43
|
+
* - [Examples](https://atlassian.design/components/button/examples)
|
|
44
|
+
* - [Code](https://atlassian.design/components/button/code)
|
|
45
|
+
* - [Usage](https://atlassian.design/components/button/usage)
|
|
46
|
+
*/
|
|
38
47
|
var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function Button(_ref, ref) {
|
|
39
48
|
var _ref$onMouseDown = _ref.onMouseDown,
|
|
40
|
-
providedOnMouseDown = _ref$onMouseDown === void 0 ?
|
|
49
|
+
providedOnMouseDown = _ref$onMouseDown === void 0 ? _noop.default : _ref$onMouseDown,
|
|
41
50
|
_ref$onMouseUp = _ref.onMouseUp,
|
|
42
|
-
providedOnMouseUp = _ref$onMouseUp === void 0 ?
|
|
51
|
+
providedOnMouseUp = _ref$onMouseUp === void 0 ? _noop.default : _ref$onMouseUp,
|
|
43
52
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
44
53
|
|
|
45
54
|
var _useGlobalTheme = (0, _components.useGlobalTheme)(),
|
|
@@ -86,6 +86,13 @@ var initial = {
|
|
|
86
86
|
isActive: false,
|
|
87
87
|
isFocus: false
|
|
88
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* __Custom theme button__
|
|
91
|
+
*
|
|
92
|
+
* A custom theme button. Avoid using this component. It exists for those already using custom theming, which is hard to use and has performance issues.
|
|
93
|
+
*
|
|
94
|
+
* - [Examples](https://atlassian.design/components/button/examples#custom-theme-button)
|
|
95
|
+
*/
|
|
89
96
|
|
|
90
97
|
var CustomThemeButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function CustomThemeButton(_ref2, ref) {
|
|
91
98
|
var _ref2$appearance = _ref2.appearance,
|
|
@@ -103,6 +103,7 @@ var Theme = (0, _components.createTheme)(function (themeProps) {
|
|
|
103
103
|
// that we are changing theme soon there is no point
|
|
104
104
|
spinnerStyles: {}
|
|
105
105
|
};
|
|
106
|
-
});
|
|
106
|
+
}); // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
107
|
+
|
|
107
108
|
var _default = Theme;
|
|
108
109
|
exports.default = _default;
|
|
@@ -19,6 +19,13 @@ var _loadingSpinner = _interopRequireDefault(require("./shared/loading-spinner")
|
|
|
19
19
|
|
|
20
20
|
var _excluded = ["isLoading"];
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* __Loading button__
|
|
24
|
+
*
|
|
25
|
+
* A small wrapper around Button that allows you to show an @atlaskit/spinner as an overlay on the button when you set an isLoading prop to true.
|
|
26
|
+
*
|
|
27
|
+
* - [Examples](https://atlassian.design/components/button/examples#loading-button)
|
|
28
|
+
*/
|
|
22
29
|
var LoadingButton = /*#__PURE__*/_react.default.forwardRef(function LoadingButton(_ref, ref) {
|
|
23
30
|
var _ref$isLoading = _ref.isLoading,
|
|
24
31
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
@@ -19,6 +19,8 @@ var _core = require("@emotion/core");
|
|
|
19
19
|
|
|
20
20
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
21
21
|
|
|
22
|
+
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
23
|
+
|
|
22
24
|
var _useAutoFocus = _interopRequireDefault(require("@atlaskit/ds-lib/use-auto-focus"));
|
|
23
25
|
|
|
24
26
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -33,12 +35,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
33
35
|
|
|
34
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
// Disabled buttons will still publish events for nested elements in webkit.
|
|
37
39
|
// We are disabling pointer events on child elements so that
|
|
38
40
|
// the button will always be the target of events
|
|
39
41
|
// Note: firefox does not have this behaviour for child elements
|
|
40
|
-
|
|
41
|
-
|
|
42
42
|
var noPointerEventsOnChildrenCss = {
|
|
43
43
|
'> *': {
|
|
44
44
|
pointerEvents: 'none'
|
|
@@ -70,9 +70,9 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
|
|
|
70
70
|
_props$type = props.type,
|
|
71
71
|
type = _props$type === void 0 ? !href ? 'button' : undefined : _props$type,
|
|
72
72
|
_props$onMouseDown = props.onMouseDown,
|
|
73
|
-
providedOnMouseDown = _props$onMouseDown === void 0 ?
|
|
73
|
+
providedOnMouseDown = _props$onMouseDown === void 0 ? _noop.default : _props$onMouseDown,
|
|
74
74
|
_props$onClick = props.onClick,
|
|
75
|
-
providedOnClick = _props$onClick === void 0 ?
|
|
75
|
+
providedOnClick = _props$onClick === void 0 ? _noop.default : _props$onClick,
|
|
76
76
|
_props$component = props.component,
|
|
77
77
|
Component = _props$component === void 0 ? href ? 'a' : 'button' : _props$component,
|
|
78
78
|
testId = props.testId,
|
|
@@ -101,7 +101,7 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
|
|
|
101
101
|
action: 'clicked',
|
|
102
102
|
componentName: 'button',
|
|
103
103
|
packageName: "@atlaskit/button",
|
|
104
|
-
packageVersion: "16.3.
|
|
104
|
+
packageVersion: "16.3.5",
|
|
105
105
|
analyticsData: analyticsContext
|
|
106
106
|
}); // Button currently calls preventDefault, which is not standard button behaviour
|
|
107
107
|
|
|
@@ -123,7 +123,8 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
|
|
|
123
123
|
hasOverlay: hasOverlay
|
|
124
124
|
});
|
|
125
125
|
var isInteractive = !isDisabled && !hasOverlay;
|
|
126
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* HACK: Spinner needs to have different colours in the "new" tokens design compared to the old design.
|
|
127
128
|
* For now, while we support both, these styles reach into Spinner when a theme is set, applies the right color.
|
|
128
129
|
* Ticket to remove: https://product-fabric.atlassian.net/browse/DSP-2067
|
|
129
130
|
*/
|
package/dist/cjs/version.json
CHANGED
|
@@ -29,7 +29,10 @@ export default function ButtonGroup({
|
|
|
29
29
|
return jsx("div", {
|
|
30
30
|
key: idx,
|
|
31
31
|
css: groupItemStyles
|
|
32
|
-
}, appearance ?
|
|
32
|
+
}, appearance ?
|
|
33
|
+
/*#__PURE__*/
|
|
34
|
+
// eslint-disable-next-line @repo/internal/react/no-clone-element
|
|
35
|
+
React.cloneElement(child, {
|
|
33
36
|
appearance
|
|
34
37
|
}) : child);
|
|
35
38
|
}));
|
package/dist/es2019/button.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
3
4
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
4
5
|
import ButtonBase from './shared/button-base';
|
|
5
6
|
import { getCss } from './shared/css';
|
|
6
7
|
import getIsOnlySingleIcon from './shared/get-is-only-single-icon';
|
|
7
|
-
|
|
8
|
-
function noop() {}
|
|
9
|
-
|
|
10
8
|
const isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* __Button__
|
|
12
|
+
*
|
|
13
|
+
* A button triggers an event or action. They let users know what will happen next.
|
|
14
|
+
*
|
|
15
|
+
* - [Examples](https://atlassian.design/components/button/examples)
|
|
16
|
+
* - [Code](https://atlassian.design/components/button/code)
|
|
17
|
+
* - [Usage](https://atlassian.design/components/button/usage)
|
|
18
|
+
*/
|
|
11
19
|
const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button({
|
|
12
20
|
onMouseDown: providedOnMouseDown = noop,
|
|
13
21
|
onMouseUp: providedOnMouseUp = noop,
|
|
@@ -47,6 +47,14 @@ const initial = {
|
|
|
47
47
|
isActive: false,
|
|
48
48
|
isFocus: false
|
|
49
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* __Custom theme button__
|
|
52
|
+
*
|
|
53
|
+
* A custom theme button. Avoid using this component. It exists for those already using custom theming, which is hard to use and has performance issues.
|
|
54
|
+
*
|
|
55
|
+
* - [Examples](https://atlassian.design/components/button/examples#custom-theme-button)
|
|
56
|
+
*/
|
|
57
|
+
|
|
50
58
|
const CustomThemeButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function CustomThemeButton({
|
|
51
59
|
// Calculate default props for use in custom themes
|
|
52
60
|
appearance = 'default',
|
|
@@ -77,5 +77,6 @@ const Theme = createTheme(themeProps => ({
|
|
|
77
77
|
// Keeping this for legacy compat. We could remove it, but given
|
|
78
78
|
// that we are changing theme soon there is no point
|
|
79
79
|
spinnerStyles: {}
|
|
80
|
-
}));
|
|
80
|
+
})); // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
81
|
+
|
|
81
82
|
export default Theme;
|
|
@@ -2,6 +2,14 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import Button from './button';
|
|
4
4
|
import LoadingSpinner from './shared/loading-spinner';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* __Loading button__
|
|
8
|
+
*
|
|
9
|
+
* A small wrapper around Button that allows you to show an @atlaskit/spinner as an overlay on the button when you set an isLoading prop to true.
|
|
10
|
+
*
|
|
11
|
+
* - [Examples](https://atlassian.design/components/button/examples#loading-button)
|
|
12
|
+
*/
|
|
5
13
|
const LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton({
|
|
6
14
|
isLoading = false,
|
|
7
15
|
...rest
|
|
@@ -4,17 +4,15 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
5
5
|
import { jsx } from '@emotion/core';
|
|
6
6
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
7
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
7
8
|
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
8
9
|
import { N500 } from '@atlaskit/theme/colors';
|
|
9
10
|
import blockEvents from './block-events';
|
|
10
|
-
import { getContentStyle, getFadingCss, getIconStyle, overlayCss } from './css';
|
|
11
|
-
|
|
12
|
-
function noop() {} // Disabled buttons will still publish events for nested elements in webkit.
|
|
11
|
+
import { getContentStyle, getFadingCss, getIconStyle, overlayCss } from './css'; // Disabled buttons will still publish events for nested elements in webkit.
|
|
13
12
|
// We are disabling pointer events on child elements so that
|
|
14
13
|
// the button will always be the target of events
|
|
15
14
|
// Note: firefox does not have this behaviour for child elements
|
|
16
15
|
|
|
17
|
-
|
|
18
16
|
const noPointerEventsOnChildrenCss = {
|
|
19
17
|
'> *': {
|
|
20
18
|
pointerEvents: 'none'
|
|
@@ -70,7 +68,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
70
68
|
action: 'clicked',
|
|
71
69
|
componentName: 'button',
|
|
72
70
|
packageName: "@atlaskit/button",
|
|
73
|
-
packageVersion: "16.3.
|
|
71
|
+
packageVersion: "16.3.5",
|
|
74
72
|
analyticsData: analyticsContext
|
|
75
73
|
}); // Button currently calls preventDefault, which is not standard button behaviour
|
|
76
74
|
|
|
@@ -92,7 +90,8 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
92
90
|
hasOverlay
|
|
93
91
|
});
|
|
94
92
|
const isInteractive = !isDisabled && !hasOverlay;
|
|
95
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* HACK: Spinner needs to have different colours in the "new" tokens design compared to the old design.
|
|
96
95
|
* For now, while we support both, these styles reach into Spinner when a theme is set, applies the right color.
|
|
97
96
|
* Ticket to remove: https://product-fabric.atlassian.net/browse/DSP-2067
|
|
98
97
|
*/
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/button-group.js
CHANGED
|
@@ -28,7 +28,10 @@ export default function ButtonGroup(_ref) {
|
|
|
28
28
|
return jsx("div", {
|
|
29
29
|
key: idx,
|
|
30
30
|
css: groupItemStyles
|
|
31
|
-
}, appearance ?
|
|
31
|
+
}, appearance ?
|
|
32
|
+
/*#__PURE__*/
|
|
33
|
+
// eslint-disable-next-line @repo/internal/react/no-clone-element
|
|
34
|
+
React.cloneElement(child, {
|
|
32
35
|
appearance: appearance
|
|
33
36
|
}) : child);
|
|
34
37
|
}));
|
package/dist/esm/button.js
CHANGED
|
@@ -3,14 +3,22 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["onMouseDown", "onMouseUp"];
|
|
5
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
6
7
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
7
8
|
import ButtonBase from './shared/button-base';
|
|
8
9
|
import { getCss } from './shared/css';
|
|
9
10
|
import getIsOnlySingleIcon from './shared/get-is-only-single-icon';
|
|
10
|
-
|
|
11
|
-
function noop() {}
|
|
12
|
-
|
|
13
11
|
var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* __Button__
|
|
15
|
+
*
|
|
16
|
+
* A button triggers an event or action. They let users know what will happen next.
|
|
17
|
+
*
|
|
18
|
+
* - [Examples](https://atlassian.design/components/button/examples)
|
|
19
|
+
* - [Code](https://atlassian.design/components/button/code)
|
|
20
|
+
* - [Usage](https://atlassian.design/components/button/usage)
|
|
21
|
+
*/
|
|
14
22
|
var Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
|
|
15
23
|
var _ref$onMouseDown = _ref.onMouseDown,
|
|
16
24
|
providedOnMouseDown = _ref$onMouseDown === void 0 ? noop : _ref$onMouseDown,
|
|
@@ -62,6 +62,14 @@ var initial = {
|
|
|
62
62
|
isActive: false,
|
|
63
63
|
isFocus: false
|
|
64
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* __Custom theme button__
|
|
67
|
+
*
|
|
68
|
+
* A custom theme button. Avoid using this component. It exists for those already using custom theming, which is hard to use and has performance issues.
|
|
69
|
+
*
|
|
70
|
+
* - [Examples](https://atlassian.design/components/button/examples#custom-theme-button)
|
|
71
|
+
*/
|
|
72
|
+
|
|
65
73
|
var CustomThemeButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function CustomThemeButton(_ref2, ref) {
|
|
66
74
|
var _ref2$appearance = _ref2.appearance,
|
|
67
75
|
appearance = _ref2$appearance === void 0 ? 'default' : _ref2$appearance,
|
|
@@ -4,6 +4,14 @@ var _excluded = ["isLoading"];
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import Button from './button';
|
|
6
6
|
import LoadingSpinner from './shared/loading-spinner';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* __Loading button__
|
|
10
|
+
*
|
|
11
|
+
* A small wrapper around Button that allows you to show an @atlaskit/spinner as an overlay on the button when you set an isLoading prop to true.
|
|
12
|
+
*
|
|
13
|
+
* - [Examples](https://atlassian.design/components/button/examples#loading-button)
|
|
14
|
+
*/
|
|
7
15
|
var LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton(_ref, ref) {
|
|
8
16
|
var _ref$isLoading = _ref.isLoading,
|
|
9
17
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
@@ -6,17 +6,15 @@ var _excluded = ["appearance", "buttonCss", "spacing", "autoFocus", "isDisabled"
|
|
|
6
6
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
7
7
|
import { jsx } from '@emotion/core';
|
|
8
8
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
9
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
9
10
|
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
10
11
|
import { N500 } from '@atlaskit/theme/colors';
|
|
11
12
|
import blockEvents from './block-events';
|
|
12
|
-
import { getContentStyle, getFadingCss, getIconStyle, overlayCss } from './css';
|
|
13
|
-
|
|
14
|
-
function noop() {} // Disabled buttons will still publish events for nested elements in webkit.
|
|
13
|
+
import { getContentStyle, getFadingCss, getIconStyle, overlayCss } from './css'; // Disabled buttons will still publish events for nested elements in webkit.
|
|
15
14
|
// We are disabling pointer events on child elements so that
|
|
16
15
|
// the button will always be the target of events
|
|
17
16
|
// Note: firefox does not have this behaviour for child elements
|
|
18
17
|
|
|
19
|
-
|
|
20
18
|
var noPointerEventsOnChildrenCss = {
|
|
21
19
|
'> *': {
|
|
22
20
|
pointerEvents: 'none'
|
|
@@ -79,7 +77,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
79
77
|
action: 'clicked',
|
|
80
78
|
componentName: 'button',
|
|
81
79
|
packageName: "@atlaskit/button",
|
|
82
|
-
packageVersion: "16.3.
|
|
80
|
+
packageVersion: "16.3.5",
|
|
83
81
|
analyticsData: analyticsContext
|
|
84
82
|
}); // Button currently calls preventDefault, which is not standard button behaviour
|
|
85
83
|
|
|
@@ -101,7 +99,8 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
101
99
|
hasOverlay: hasOverlay
|
|
102
100
|
});
|
|
103
101
|
var isInteractive = !isDisabled && !hasOverlay;
|
|
104
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* HACK: Spinner needs to have different colours in the "new" tokens design compared to the old design.
|
|
105
104
|
* For now, while we support both, these styles reach into Spinner when a theme is set, applies the right color.
|
|
106
105
|
* Ticket to remove: https://product-fabric.atlassian.net/browse/DSP-2067
|
|
107
106
|
*/
|
package/dist/esm/version.json
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Appearance } from './types';
|
|
4
4
|
export declare type ButtonGroupProps = {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* The appearance to apply to all buttons.
|
|
7
|
+
*/
|
|
6
8
|
appearance?: Appearance;
|
|
7
9
|
children?: React.ReactNode;
|
|
8
10
|
};
|
package/dist/types/button.d.ts
CHANGED
|
@@ -2,5 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import { BaseProps } from './types';
|
|
3
3
|
export interface ButtonProps extends BaseProps {
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* __Button__
|
|
7
|
+
*
|
|
8
|
+
* A button triggers an event or action. They let users know what will happen next.
|
|
9
|
+
*
|
|
10
|
+
* - [Examples](https://atlassian.design/components/button/examples)
|
|
11
|
+
* - [Code](https://atlassian.design/components/button/code)
|
|
12
|
+
* - [Usage](https://atlassian.design/components/button/usage)
|
|
13
|
+
*/
|
|
5
14
|
declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>>>;
|
|
6
15
|
export default Button;
|
|
@@ -8,7 +8,8 @@ export declare type ThemeTokens = {
|
|
|
8
8
|
export declare type InteractionState = 'disabled' | 'focusSelected' | 'selected' | 'active' | 'hover' | 'focus' | 'default';
|
|
9
9
|
export declare type CustomThemeButtonOwnProps = {
|
|
10
10
|
isLoading?: boolean;
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Slow + discouraged custom theme API
|
|
12
13
|
* See custom theme guide for usage details
|
|
13
14
|
*/
|
|
14
15
|
theme?: (current: (props: ThemeProps) => ThemeTokens, props: ThemeProps) => ThemeTokens;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __Custom theme button__
|
|
4
|
+
*
|
|
5
|
+
* A custom theme button. Avoid using this component. It exists for those already using custom theming, which is hard to use and has performance issues.
|
|
6
|
+
*
|
|
7
|
+
* - [Examples](https://atlassian.design/components/button/examples#custom-theme-button)
|
|
8
|
+
*/
|
|
2
9
|
declare const CustomThemeButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<import("..").BaseProps, "overlay"> & import("./custom-theme-button-types").CustomThemeButtonOwnProps & React.RefAttributes<HTMLElement>>>;
|
|
3
10
|
export default CustomThemeButton;
|
|
@@ -4,5 +4,12 @@ export declare type LoadingButtonOwnProps = {
|
|
|
4
4
|
isLoading?: boolean;
|
|
5
5
|
};
|
|
6
6
|
export declare type LoadingButtonProps = Omit<BaseProps, 'overlay'> & LoadingButtonOwnProps;
|
|
7
|
+
/**
|
|
8
|
+
* __Loading button__
|
|
9
|
+
*
|
|
10
|
+
* A small wrapper around Button that allows you to show an @atlaskit/spinner as an overlay on the button when you set an isLoading prop to true.
|
|
11
|
+
*
|
|
12
|
+
* - [Examples](https://atlassian.design/components/button/examples#loading-button)
|
|
13
|
+
*/
|
|
7
14
|
declare const LoadingButton: React.ForwardRefExoticComponent<Omit<BaseProps, "overlay"> & LoadingButtonOwnProps & React.RefAttributes<HTMLElement>>;
|
|
8
15
|
export default LoadingButton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseProps } from '../types';
|
|
3
|
-
declare type
|
|
4
|
-
export default function LoadingSpinner({ spacing, ...rest }:
|
|
3
|
+
declare type LoadingSpinnerProps = Pick<BaseProps, 'appearance' | 'isDisabled' | 'isSelected' | 'spacing'>;
|
|
4
|
+
export default function LoadingSpinner({ spacing, ...rest }: LoadingSpinnerProps): JSX.Element;
|
|
5
5
|
export {};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -4,44 +4,82 @@ export declare type Appearance = 'default' | 'danger' | 'link' | 'primary' | 'su
|
|
|
4
4
|
export declare type Spacing = 'compact' | 'default' | 'none';
|
|
5
5
|
declare type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
6
6
|
export declare type BaseOwnProps = {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* The base styling to apply to the button
|
|
9
|
+
*/
|
|
8
10
|
appearance?: Appearance;
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Set the button to autofocus on mount
|
|
13
|
+
*/
|
|
10
14
|
autoFocus?: boolean;
|
|
11
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Add a classname to the button
|
|
17
|
+
*/
|
|
12
18
|
className?: string;
|
|
13
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Used to 'overlay' something over a button. This is commonly used to display a loading spinner
|
|
21
|
+
*/
|
|
14
22
|
overlay?: React.ReactNode;
|
|
15
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Provides a url for buttons being used as a link
|
|
25
|
+
*/
|
|
16
26
|
href?: string;
|
|
17
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Places an icon within the button, after the button's text
|
|
29
|
+
*/
|
|
18
30
|
iconAfter?: React.ReactChild;
|
|
19
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Places an icon within the button, before the button's text
|
|
33
|
+
*/
|
|
20
34
|
iconBefore?: React.ReactChild;
|
|
21
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Set if the button is disabled
|
|
37
|
+
*/
|
|
22
38
|
isDisabled?: boolean;
|
|
23
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Change the style to indicate the button is selected
|
|
41
|
+
*/
|
|
24
42
|
isSelected?: boolean;
|
|
25
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Handler to be called on blur
|
|
45
|
+
*/
|
|
26
46
|
onBlur?: React.FocusEventHandler<HTMLElement>;
|
|
27
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details
|
|
49
|
+
*/
|
|
28
50
|
onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
29
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Handler to be called on focus
|
|
53
|
+
*/
|
|
30
54
|
onFocus?: React.FocusEventHandler<HTMLElement>;
|
|
31
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Set the amount of padding in the button
|
|
57
|
+
*/
|
|
32
58
|
spacing?: Spacing;
|
|
33
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Pass target down to a link within the button component, if a href is provided
|
|
61
|
+
*/
|
|
34
62
|
target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
35
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Pass type down to a button
|
|
65
|
+
*/
|
|
36
66
|
type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
37
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Option to fit button width to its parent width
|
|
69
|
+
*/
|
|
38
70
|
shouldFitContainer?: boolean;
|
|
39
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Text content to be rendered in the button
|
|
73
|
+
*/
|
|
40
74
|
children?: React.ReactNode;
|
|
41
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
77
|
+
*/
|
|
42
78
|
testId?: string;
|
|
43
79
|
component?: React.ComponentType<React.AllHTMLAttributes<HTMLElement>> | React.ElementType;
|
|
44
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* Additional information to be included in the `context` of analytics events that come from button
|
|
82
|
+
*/
|
|
45
83
|
analyticsContext?: Record<string, any>;
|
|
46
84
|
};
|
|
47
85
|
export declare type BaseProps = Combine<Combine<Omit<React.AllHTMLAttributes<HTMLElement>, 'disabled'>, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "16.3.
|
|
3
|
+
"version": "16.3.5",
|
|
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/"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
15
|
"sideEffects": false,
|
|
16
|
-
"atlaskit:src": "src/index.
|
|
16
|
+
"atlaskit:src": "src/index.tsx",
|
|
17
17
|
"atlassian": {
|
|
18
18
|
"team": "Design System Team",
|
|
19
19
|
"releaseModel": "scheduled",
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"af:exports": {
|
|
26
|
-
"./button-group": "./src/entry-points/button-group.
|
|
27
|
-
"./custom-theme-button": "./src/entry-points/custom-theme-button.
|
|
28
|
-
"./loading-button": "./src/entry-points/loading-button.
|
|
29
|
-
"./standard-button": "./src/entry-points/standard-button.
|
|
30
|
-
"./types": "./src/entry-points/types.
|
|
31
|
-
".": "./src/index.
|
|
26
|
+
"./button-group": "./src/entry-points/button-group.tsx",
|
|
27
|
+
"./custom-theme-button": "./src/entry-points/custom-theme-button.tsx",
|
|
28
|
+
"./loading-button": "./src/entry-points/loading-button.tsx",
|
|
29
|
+
"./standard-button": "./src/entry-points/standard-button.tsx",
|
|
30
|
+
"./types": "./src/entry-points/types.tsx",
|
|
31
|
+
".": "./src/index.tsx"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
35
|
-
"@atlaskit/ds-lib": "^2.
|
|
35
|
+
"@atlaskit/ds-lib": "^2.1.0",
|
|
36
36
|
"@atlaskit/spinner": "^15.1.0",
|
|
37
37
|
"@atlaskit/theme": "^12.1.0",
|
|
38
38
|
"@atlaskit/tokens": "^0.10.0",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"@atlaskit/checkbox": "^12.3.0",
|
|
47
47
|
"@atlaskit/docs": "*",
|
|
48
48
|
"@atlaskit/icon": "^21.10.0",
|
|
49
|
-
"@atlaskit/logo": "^13.
|
|
49
|
+
"@atlaskit/logo": "^13.8.0",
|
|
50
50
|
"@atlaskit/section-message": "^6.1.0",
|
|
51
|
-
"@atlaskit/select": "^15.
|
|
51
|
+
"@atlaskit/select": "^15.5.0",
|
|
52
52
|
"@atlaskit/ssr": "*",
|
|
53
53
|
"@atlaskit/visual-regression": "*",
|
|
54
54
|
"@atlaskit/webdriver-runner": "*",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@testing-library/react": "^8.0.1",
|
|
57
57
|
"@types/react-router-dom": "^4.3.1",
|
|
58
58
|
"ast-types": "^0.13.3",
|
|
59
|
-
"bind-event-listener": "^2.1.
|
|
59
|
+
"bind-event-listener": "^2.1.1",
|
|
60
60
|
"jest-emotion": "^10.0.32",
|
|
61
61
|
"jest-in-case": "^1.0.2",
|
|
62
62
|
"jscodeshift": "^0.13.0",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"@repo/internal": {
|
|
75
75
|
"dom-events": "use-bind-event-listener",
|
|
76
|
+
"design-system": "v1",
|
|
76
77
|
"ui-components": "lite-mode",
|
|
77
78
|
"analytics": "analytics-next",
|
|
78
79
|
"theming": "tokens",
|
package/report.api.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
7
|
+
|
|
8
|
+
import { ComponentType } from 'react';
|
|
9
|
+
import { CSSObject } from '@emotion/core';
|
|
10
|
+
import { default as React_2 } from 'react';
|
|
11
|
+
import { ReactNode } from 'react';
|
|
12
|
+
import { ThemeModes } from '@atlaskit/theme/types';
|
|
13
|
+
import { ThemeModes as ThemeModes_2 } from '@atlaskit/theme';
|
|
14
|
+
import { ThemeProp } from '@atlaskit/theme/components';
|
|
15
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
16
|
+
|
|
17
|
+
export declare type Appearance =
|
|
18
|
+
| 'default'
|
|
19
|
+
| 'danger'
|
|
20
|
+
| 'link'
|
|
21
|
+
| 'primary'
|
|
22
|
+
| 'subtle'
|
|
23
|
+
| 'subtle-link'
|
|
24
|
+
| 'warning';
|
|
25
|
+
|
|
26
|
+
export declare type BaseOwnProps = {
|
|
27
|
+
/** The base styling to apply to the button */
|
|
28
|
+
appearance?: Appearance;
|
|
29
|
+
/** Set the button to autofocus on mount */
|
|
30
|
+
autoFocus?: boolean;
|
|
31
|
+
/** Add a classname to the button */
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Used to 'overlay' something over a button. This is commonly used to display a loading spinner */
|
|
34
|
+
overlay?: React_2.ReactNode;
|
|
35
|
+
/** Provides a url for buttons being used as a link */
|
|
36
|
+
href?: string;
|
|
37
|
+
/** Places an icon within the button, after the button's text */
|
|
38
|
+
iconAfter?: React_2.ReactChild;
|
|
39
|
+
/** Places an icon within the button, before the button's text */
|
|
40
|
+
iconBefore?: React_2.ReactChild;
|
|
41
|
+
/** Set if the button is disabled */
|
|
42
|
+
isDisabled?: boolean;
|
|
43
|
+
/** Change the style to indicate the button is selected */
|
|
44
|
+
isSelected?: boolean;
|
|
45
|
+
/** Handler to be called on blur */
|
|
46
|
+
onBlur?: React_2.FocusEventHandler<HTMLElement>;
|
|
47
|
+
/** Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details */
|
|
48
|
+
onClick?: (
|
|
49
|
+
e: React_2.MouseEvent<HTMLElement>,
|
|
50
|
+
analyticsEvent: UIAnalyticsEvent,
|
|
51
|
+
) => void;
|
|
52
|
+
/** Handler to be called on focus */
|
|
53
|
+
onFocus?: React_2.FocusEventHandler<HTMLElement>;
|
|
54
|
+
/** Set the amount of padding in the button */
|
|
55
|
+
spacing?: Spacing;
|
|
56
|
+
/** Pass target down to a link within the button component, if a href is provided */
|
|
57
|
+
target?: React_2.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
58
|
+
/** Pass type down to a button */
|
|
59
|
+
type?: React_2.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
60
|
+
/** Option to fit button width to its parent width */
|
|
61
|
+
shouldFitContainer?: boolean;
|
|
62
|
+
/** Text content to be rendered in the button */
|
|
63
|
+
children?: React_2.ReactNode;
|
|
64
|
+
/** A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests */
|
|
65
|
+
testId?: string;
|
|
66
|
+
component?:
|
|
67
|
+
| React_2.ComponentType<React_2.AllHTMLAttributes<HTMLElement>>
|
|
68
|
+
| React_2.ElementType;
|
|
69
|
+
/** Additional information to be included in the `context` of analytics events that come from button */
|
|
70
|
+
analyticsContext?: Record<string, any>;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export declare type BaseProps = Combine<
|
|
74
|
+
Combine<
|
|
75
|
+
Omit<React_2.AllHTMLAttributes<HTMLElement>, 'disabled'>,
|
|
76
|
+
{
|
|
77
|
+
'data-testid'?: never;
|
|
78
|
+
'data-has-overlay'?: never;
|
|
79
|
+
}
|
|
80
|
+
>,
|
|
81
|
+
BaseOwnProps
|
|
82
|
+
>;
|
|
83
|
+
|
|
84
|
+
declare const Button: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<
|
|
85
|
+
ButtonProps & React_2.RefAttributes<HTMLElement>
|
|
86
|
+
>>;
|
|
87
|
+
export default Button;
|
|
88
|
+
|
|
89
|
+
export declare function ButtonGroup({
|
|
90
|
+
appearance,
|
|
91
|
+
children,
|
|
92
|
+
}: ButtonGroupProps): JSX.Element;
|
|
93
|
+
|
|
94
|
+
declare type ButtonGroupProps = {
|
|
95
|
+
/** The appearance to apply to all buttons. */
|
|
96
|
+
appearance?: Appearance;
|
|
97
|
+
children?: React_2.ReactNode;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export declare interface ButtonProps extends BaseProps {}
|
|
101
|
+
|
|
102
|
+
declare type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
103
|
+
|
|
104
|
+
export declare const CustomThemeButton: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<
|
|
105
|
+
Omit<BaseProps, 'overlay'> &
|
|
106
|
+
CustomThemeButtonOwnProps &
|
|
107
|
+
React_2.RefAttributes<HTMLElement>
|
|
108
|
+
>>;
|
|
109
|
+
|
|
110
|
+
export declare type CustomThemeButtonOwnProps = {
|
|
111
|
+
isLoading?: boolean;
|
|
112
|
+
/** Slow + discouraged custom theme API
|
|
113
|
+
* See custom theme guide for usage details
|
|
114
|
+
*/
|
|
115
|
+
theme?: (
|
|
116
|
+
current: (props: ThemeProps) => ThemeTokens,
|
|
117
|
+
props: ThemeProps,
|
|
118
|
+
) => ThemeTokens;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export declare type CustomThemeButtonProps = Omit<BaseProps, 'overlay'> &
|
|
122
|
+
CustomThemeButtonOwnProps;
|
|
123
|
+
|
|
124
|
+
export declare type InteractionState =
|
|
125
|
+
| 'disabled'
|
|
126
|
+
| 'focusSelected'
|
|
127
|
+
| 'selected'
|
|
128
|
+
| 'active'
|
|
129
|
+
| 'hover'
|
|
130
|
+
| 'focus'
|
|
131
|
+
| 'default';
|
|
132
|
+
|
|
133
|
+
export declare const LoadingButton: React_2.ForwardRefExoticComponent<
|
|
134
|
+
Omit<BaseProps, 'overlay'> &
|
|
135
|
+
LoadingButtonOwnProps &
|
|
136
|
+
React_2.RefAttributes<HTMLElement>
|
|
137
|
+
>;
|
|
138
|
+
|
|
139
|
+
export declare type LoadingButtonOwnProps = {
|
|
140
|
+
isLoading?: boolean;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export declare type LoadingButtonProps = Omit<BaseProps, 'overlay'> &
|
|
144
|
+
LoadingButtonOwnProps;
|
|
145
|
+
|
|
146
|
+
export declare type Spacing = 'compact' | 'default' | 'none';
|
|
147
|
+
|
|
148
|
+
export declare const Theme: {
|
|
149
|
+
Consumer: ComponentType<
|
|
150
|
+
{
|
|
151
|
+
children: (tokens: ThemeTokens) => ReactNode;
|
|
152
|
+
} & Partial<CustomThemeButtonProps> & {
|
|
153
|
+
state: InteractionState;
|
|
154
|
+
iconIsOnlyChild?: boolean | undefined;
|
|
155
|
+
mode?: ThemeModes_2 | undefined;
|
|
156
|
+
}
|
|
157
|
+
>;
|
|
158
|
+
Provider: ComponentType<{
|
|
159
|
+
children?: ReactNode;
|
|
160
|
+
value?: ThemeProp<ThemeTokens, ThemeProps> | undefined;
|
|
161
|
+
}>;
|
|
162
|
+
useTheme: (props: ThemeProps) => ThemeTokens;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export declare type ThemeProps = Partial<CustomThemeButtonProps> & {
|
|
166
|
+
state: InteractionState;
|
|
167
|
+
iconIsOnlyChild?: boolean;
|
|
168
|
+
mode?: ThemeModes;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export declare type ThemeTokens = {
|
|
172
|
+
buttonStyles: CSSObject;
|
|
173
|
+
spinnerStyles: CSSObject;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export {};
|
|
177
|
+
```
|