@atlaskit/button 16.3.9 → 16.4.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 +16 -0
- package/dist/cjs/button-group.js +7 -6
- package/dist/cjs/entry-points/standard-button.js +1 -1
- package/dist/cjs/shared/button-base.js +9 -9
- package/dist/cjs/shared/css.js +14 -12
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/button-group.js +4 -3
- package/dist/es2019/entry-points/standard-button.js +1 -1
- package/dist/es2019/shared/button-base.js +4 -4
- package/dist/es2019/shared/css.js +13 -12
- package/dist/es2019/version.json +1 -1
- package/dist/esm/button-group.js +4 -3
- package/dist/esm/entry-points/standard-button.js +1 -1
- package/dist/esm/shared/button-base.js +4 -4
- package/dist/esm/shared/css.js +13 -12
- package/dist/esm/version.json +1 -1
- package/dist/types/button-group.d.ts +2 -1
- package/dist/types/custom-theme-button/custom-theme-button-types.d.ts +1 -1
- package/dist/types/custom-theme-button/theme.d.ts +1 -1
- package/dist/types/entry-points/standard-button.d.ts +1 -1
- package/dist/types/shared/block-events.d.ts +1 -0
- package/dist/types/shared/button-base.d.ts +1 -1
- package/dist/types/shared/css.d.ts +5 -5
- package/dist/types-ts4.0/button-group.d.ts +2 -1
- package/dist/types-ts4.0/custom-theme-button/custom-theme-button-types.d.ts +1 -1
- package/dist/types-ts4.0/custom-theme-button/theme.d.ts +1 -1
- package/dist/types-ts4.0/entry-points/standard-button.d.ts +1 -1
- package/dist/types-ts4.0/shared/block-events.d.ts +1 -0
- package/dist/types-ts4.0/shared/button-base.d.ts +1 -1
- package/dist/types-ts4.0/shared/css.d.ts +5 -5
- package/package.json +11 -8
- package/report.api.md +48 -45
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 16.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`9f6369f5505`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9f6369f5505) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behaviour change.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 16.3.10
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`bc989043572`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bc989043572) - Internal changes to apply spacing tokens. This should be a no-op change.
|
|
18
|
+
|
|
3
19
|
## 16.3.9
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cjs/button-group.js
CHANGED
|
@@ -9,16 +9,17 @@ exports.default = ButtonGroup;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
13
|
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
15
|
|
|
16
16
|
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; }
|
|
17
17
|
|
|
18
18
|
/** @jsx jsx */
|
|
19
|
-
var buttonGroupStyles = (0,
|
|
19
|
+
var buttonGroupStyles = (0, _react2.css)({
|
|
20
20
|
display: 'inline-flex',
|
|
21
|
-
|
|
21
|
+
// TODO Delete this comment after verifying spacing token -> previous value `4`
|
|
22
|
+
gap: "var(--ds-scale-050, 4px)",
|
|
22
23
|
'> *': {
|
|
23
24
|
flex: '1 0 auto'
|
|
24
25
|
}
|
|
@@ -27,14 +28,14 @@ var buttonGroupStyles = (0, _core.css)({
|
|
|
27
28
|
function ButtonGroup(_ref) {
|
|
28
29
|
var appearance = _ref.appearance,
|
|
29
30
|
children = _ref.children;
|
|
30
|
-
return (0,
|
|
31
|
+
return (0, _react2.jsx)("div", {
|
|
31
32
|
css: buttonGroupStyles
|
|
32
|
-
}, _react.default.Children.map(children, function (child, idx) {
|
|
33
|
+
}, _react.default.Children.map(_react.default.Children.toArray(children), function (child, idx) {
|
|
33
34
|
if (!child) {
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
return (0,
|
|
38
|
+
return (0, _react2.jsx)(_react.Fragment, {
|
|
38
39
|
key: idx
|
|
39
40
|
}, appearance ?
|
|
40
41
|
/*#__PURE__*/
|
|
@@ -15,7 +15,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
15
15
|
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _react2 = require("@emotion/react");
|
|
19
19
|
|
|
20
20
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
21
21
|
|
|
@@ -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.
|
|
104
|
+
packageVersion: "16.4.0",
|
|
105
105
|
analyticsData: analyticsContext
|
|
106
106
|
}); // Button currently calls preventDefault, which is not standard button behaviour
|
|
107
107
|
|
|
@@ -119,9 +119,9 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
|
|
|
119
119
|
}, [isDisabled]); // we are 'disabling' input with a button when there is an overlay
|
|
120
120
|
|
|
121
121
|
var hasOverlay = Boolean(overlay);
|
|
122
|
-
var fadeCss = (0, _css.getFadingCss)({
|
|
122
|
+
var fadeCss = (0, _react2.css)((0, _css.getFadingCss)({
|
|
123
123
|
hasOverlay: hasOverlay
|
|
124
|
-
});
|
|
124
|
+
}));
|
|
125
125
|
var isInteractive = !isDisabled && !hasOverlay;
|
|
126
126
|
/**
|
|
127
127
|
* HACK: Spinner needs to have different colours in the "new" tokens design compared to the old design.
|
|
@@ -139,7 +139,7 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
|
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
return (0,
|
|
142
|
+
return (0, _react2.jsx)(Component, (0, _extends2.default)({}, rest, {
|
|
143
143
|
css: [buttonCss, isInteractive ? null : noPointerEventsOnChildrenCss],
|
|
144
144
|
className: className,
|
|
145
145
|
ref: setRef,
|
|
@@ -157,19 +157,19 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
|
|
|
157
157
|
tabIndex: isDisabled ? -1 : tabIndex
|
|
158
158
|
}, (0, _blockEvents.default)({
|
|
159
159
|
isInteractive: isInteractive
|
|
160
|
-
})), iconBefore ? (0,
|
|
160
|
+
})), iconBefore ? (0, _react2.jsx)("span", {
|
|
161
161
|
css: [fadeCss, (0, _css.getIconStyle)({
|
|
162
162
|
spacing: spacing
|
|
163
163
|
})]
|
|
164
|
-
}, iconBefore) : null, children ? (0,
|
|
164
|
+
}, iconBefore) : null, children ? (0, _react2.jsx)("span", {
|
|
165
165
|
css: [fadeCss, (0, _css.getContentStyle)({
|
|
166
166
|
spacing: spacing
|
|
167
167
|
})]
|
|
168
|
-
}, children) : null, iconAfter ? (0,
|
|
168
|
+
}, children) : null, iconAfter ? (0, _react2.jsx)("span", {
|
|
169
169
|
css: [fadeCss, (0, _css.getIconStyle)({
|
|
170
170
|
spacing: spacing
|
|
171
171
|
})]
|
|
172
|
-
}, iconAfter) : null, overlay ? (0,
|
|
172
|
+
}, iconAfter) : null, overlay ? (0, _react2.jsx)("span", {
|
|
173
173
|
css: [_css.overlayCss, spinnerHackCss]
|
|
174
174
|
}, overlay) : null);
|
|
175
175
|
});
|
package/dist/cjs/shared/css.js
CHANGED
|
@@ -13,6 +13,8 @@ exports.overlayCss = void 0;
|
|
|
13
13
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
|
|
16
|
+
var _react = require("@emotion/react");
|
|
17
|
+
|
|
16
18
|
var _constants = require("@atlaskit/theme/constants");
|
|
17
19
|
|
|
18
20
|
var _colors = _interopRequireDefault(require("./colors"));
|
|
@@ -212,23 +214,23 @@ function getCss(_ref3) {
|
|
|
212
214
|
|
|
213
215
|
function getIconStyle(_ref4) {
|
|
214
216
|
var spacing = _ref4.spacing;
|
|
215
|
-
return {
|
|
216
|
-
alignSelf: 'center',
|
|
217
|
+
return (0, _react.css)({
|
|
217
218
|
display: 'flex',
|
|
219
|
+
margin: spacing === 'none' ? 0 : innerMargin.icon,
|
|
218
220
|
// icon size cannot grow and shrink
|
|
219
221
|
flexGrow: 0,
|
|
220
222
|
flexShrink: 0,
|
|
221
|
-
|
|
223
|
+
alignSelf: 'center',
|
|
222
224
|
fontSize: 0,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
};
|
|
225
|
+
lineHeight: 0,
|
|
226
|
+
userSelect: 'none'
|
|
227
|
+
});
|
|
226
228
|
} // inline-flex child
|
|
227
229
|
|
|
228
230
|
|
|
229
231
|
function getContentStyle(_ref5) {
|
|
230
232
|
var spacing = _ref5.spacing;
|
|
231
|
-
return {
|
|
233
|
+
return (0, _react.css)({
|
|
232
234
|
margin: spacing === 'none' ? 0 : innerMargin.content,
|
|
233
235
|
// content can grow and shrink
|
|
234
236
|
flexGrow: 1,
|
|
@@ -237,15 +239,15 @@ function getContentStyle(_ref5) {
|
|
|
237
239
|
overflow: 'hidden',
|
|
238
240
|
textOverflow: 'ellipsis',
|
|
239
241
|
whiteSpace: 'nowrap'
|
|
240
|
-
};
|
|
242
|
+
});
|
|
241
243
|
}
|
|
242
244
|
|
|
243
245
|
function getFadingCss(_ref6) {
|
|
244
246
|
var hasOverlay = _ref6.hasOverlay;
|
|
245
|
-
return {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
};
|
|
247
|
+
return (0, _react.css)({
|
|
248
|
+
opacity: hasOverlay ? 0 : 1,
|
|
249
|
+
transition: 'opacity 0.3s'
|
|
250
|
+
});
|
|
249
251
|
}
|
|
250
252
|
|
|
251
253
|
var overlayCss = {
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React, { Fragment } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
const buttonGroupStyles = css({
|
|
5
5
|
display: 'inline-flex',
|
|
6
|
-
|
|
6
|
+
// TODO Delete this comment after verifying spacing token -> previous value `4`
|
|
7
|
+
gap: "var(--ds-scale-050, 4px)",
|
|
7
8
|
'> *': {
|
|
8
9
|
flex: '1 0 auto'
|
|
9
10
|
}
|
|
@@ -14,7 +15,7 @@ export default function ButtonGroup({
|
|
|
14
15
|
}) {
|
|
15
16
|
return jsx("div", {
|
|
16
17
|
css: buttonGroupStyles
|
|
17
|
-
}, React.Children.map(children, (child, idx) => {
|
|
18
|
+
}, React.Children.map(React.Children.toArray(children), (child, idx) => {
|
|
18
19
|
if (!child) {
|
|
19
20
|
return null;
|
|
20
21
|
}
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
5
|
-
import { jsx } from '@emotion/
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
7
7
|
import noop from '@atlaskit/ds-lib/noop';
|
|
8
8
|
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
@@ -68,7 +68,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
68
68
|
action: 'clicked',
|
|
69
69
|
componentName: 'button',
|
|
70
70
|
packageName: "@atlaskit/button",
|
|
71
|
-
packageVersion: "16.
|
|
71
|
+
packageVersion: "16.4.0",
|
|
72
72
|
analyticsData: analyticsContext
|
|
73
73
|
}); // Button currently calls preventDefault, which is not standard button behaviour
|
|
74
74
|
|
|
@@ -86,9 +86,9 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
86
86
|
}, [isDisabled]); // we are 'disabling' input with a button when there is an overlay
|
|
87
87
|
|
|
88
88
|
const hasOverlay = Boolean(overlay);
|
|
89
|
-
const fadeCss = getFadingCss({
|
|
89
|
+
const fadeCss = css(getFadingCss({
|
|
90
90
|
hasOverlay
|
|
91
|
-
});
|
|
91
|
+
}));
|
|
92
92
|
const isInteractive = !isDisabled && !hasOverlay;
|
|
93
93
|
/**
|
|
94
94
|
* HACK: Spinner needs to have different colours in the "new" tokens design compared to the old design.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
1
2
|
import { borderRadius as getBorderRadius, fontSize as getFontSize, gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
2
3
|
import colors from './colors';
|
|
3
4
|
const borderRadius = getBorderRadius();
|
|
@@ -198,23 +199,23 @@ export function getCss({
|
|
|
198
199
|
export function getIconStyle({
|
|
199
200
|
spacing
|
|
200
201
|
}) {
|
|
201
|
-
return {
|
|
202
|
-
alignSelf: 'center',
|
|
202
|
+
return css({
|
|
203
203
|
display: 'flex',
|
|
204
|
+
margin: spacing === 'none' ? 0 : innerMargin.icon,
|
|
204
205
|
// icon size cannot grow and shrink
|
|
205
206
|
flexGrow: 0,
|
|
206
207
|
flexShrink: 0,
|
|
207
|
-
|
|
208
|
+
alignSelf: 'center',
|
|
208
209
|
fontSize: 0,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
};
|
|
210
|
+
lineHeight: 0,
|
|
211
|
+
userSelect: 'none'
|
|
212
|
+
});
|
|
212
213
|
} // inline-flex child
|
|
213
214
|
|
|
214
215
|
export function getContentStyle({
|
|
215
216
|
spacing
|
|
216
217
|
}) {
|
|
217
|
-
return {
|
|
218
|
+
return css({
|
|
218
219
|
margin: spacing === 'none' ? 0 : innerMargin.content,
|
|
219
220
|
// content can grow and shrink
|
|
220
221
|
flexGrow: 1,
|
|
@@ -223,15 +224,15 @@ export function getContentStyle({
|
|
|
223
224
|
overflow: 'hidden',
|
|
224
225
|
textOverflow: 'ellipsis',
|
|
225
226
|
whiteSpace: 'nowrap'
|
|
226
|
-
};
|
|
227
|
+
});
|
|
227
228
|
}
|
|
228
229
|
export function getFadingCss({
|
|
229
230
|
hasOverlay
|
|
230
231
|
}) {
|
|
231
|
-
return {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
};
|
|
232
|
+
return css({
|
|
233
|
+
opacity: hasOverlay ? 0 : 1,
|
|
234
|
+
transition: 'opacity 0.3s'
|
|
235
|
+
});
|
|
235
236
|
}
|
|
236
237
|
export const overlayCss = {
|
|
237
238
|
// stretching to full width / height of button
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/button-group.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React, { Fragment } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
var buttonGroupStyles = css({
|
|
5
5
|
display: 'inline-flex',
|
|
6
|
-
|
|
6
|
+
// TODO Delete this comment after verifying spacing token -> previous value `4`
|
|
7
|
+
gap: "var(--ds-scale-050, 4px)",
|
|
7
8
|
'> *': {
|
|
8
9
|
flex: '1 0 auto'
|
|
9
10
|
}
|
|
@@ -13,7 +14,7 @@ export default function ButtonGroup(_ref) {
|
|
|
13
14
|
children = _ref.children;
|
|
14
15
|
return jsx("div", {
|
|
15
16
|
css: buttonGroupStyles
|
|
16
|
-
}, React.Children.map(children, function (child, idx) {
|
|
17
|
+
}, React.Children.map(React.Children.toArray(children), function (child, idx) {
|
|
17
18
|
if (!child) {
|
|
18
19
|
return null;
|
|
19
20
|
}
|
|
@@ -4,7 +4,7 @@ var _excluded = ["appearance", "buttonCss", "spacing", "autoFocus", "isDisabled"
|
|
|
4
4
|
|
|
5
5
|
/** @jsx jsx */
|
|
6
6
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
7
|
-
import { jsx } from '@emotion/
|
|
7
|
+
import { css, jsx } from '@emotion/react';
|
|
8
8
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
9
9
|
import noop from '@atlaskit/ds-lib/noop';
|
|
10
10
|
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
@@ -77,7 +77,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
77
77
|
action: 'clicked',
|
|
78
78
|
componentName: 'button',
|
|
79
79
|
packageName: "@atlaskit/button",
|
|
80
|
-
packageVersion: "16.
|
|
80
|
+
packageVersion: "16.4.0",
|
|
81
81
|
analyticsData: analyticsContext
|
|
82
82
|
}); // Button currently calls preventDefault, which is not standard button behaviour
|
|
83
83
|
|
|
@@ -95,9 +95,9 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
95
95
|
}, [isDisabled]); // we are 'disabling' input with a button when there is an overlay
|
|
96
96
|
|
|
97
97
|
var hasOverlay = Boolean(overlay);
|
|
98
|
-
var fadeCss = getFadingCss({
|
|
98
|
+
var fadeCss = css(getFadingCss({
|
|
99
99
|
hasOverlay: hasOverlay
|
|
100
|
-
});
|
|
100
|
+
}));
|
|
101
101
|
var isInteractive = !isDisabled && !hasOverlay;
|
|
102
102
|
/**
|
|
103
103
|
* HACK: Spinner needs to have different colours in the "new" tokens design compared to the old design.
|
package/dist/esm/shared/css.js
CHANGED
|
@@ -4,6 +4,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
4
4
|
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
|
|
7
|
+
import { css } from '@emotion/react';
|
|
7
8
|
import { borderRadius as getBorderRadius, fontSize as getFontSize, gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
8
9
|
import colors from './colors';
|
|
9
10
|
var borderRadius = getBorderRadius();
|
|
@@ -196,22 +197,22 @@ export function getCss(_ref3) {
|
|
|
196
197
|
|
|
197
198
|
export function getIconStyle(_ref4) {
|
|
198
199
|
var spacing = _ref4.spacing;
|
|
199
|
-
return {
|
|
200
|
-
alignSelf: 'center',
|
|
200
|
+
return css({
|
|
201
201
|
display: 'flex',
|
|
202
|
+
margin: spacing === 'none' ? 0 : innerMargin.icon,
|
|
202
203
|
// icon size cannot grow and shrink
|
|
203
204
|
flexGrow: 0,
|
|
204
205
|
flexShrink: 0,
|
|
205
|
-
|
|
206
|
+
alignSelf: 'center',
|
|
206
207
|
fontSize: 0,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
};
|
|
208
|
+
lineHeight: 0,
|
|
209
|
+
userSelect: 'none'
|
|
210
|
+
});
|
|
210
211
|
} // inline-flex child
|
|
211
212
|
|
|
212
213
|
export function getContentStyle(_ref5) {
|
|
213
214
|
var spacing = _ref5.spacing;
|
|
214
|
-
return {
|
|
215
|
+
return css({
|
|
215
216
|
margin: spacing === 'none' ? 0 : innerMargin.content,
|
|
216
217
|
// content can grow and shrink
|
|
217
218
|
flexGrow: 1,
|
|
@@ -220,14 +221,14 @@ export function getContentStyle(_ref5) {
|
|
|
220
221
|
overflow: 'hidden',
|
|
221
222
|
textOverflow: 'ellipsis',
|
|
222
223
|
whiteSpace: 'nowrap'
|
|
223
|
-
};
|
|
224
|
+
});
|
|
224
225
|
}
|
|
225
226
|
export function getFadingCss(_ref6) {
|
|
226
227
|
var hasOverlay = _ref6.hasOverlay;
|
|
227
|
-
return {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
};
|
|
228
|
+
return css({
|
|
229
|
+
opacity: hasOverlay ? 0 : 1,
|
|
230
|
+
transition: 'opacity 0.3s'
|
|
231
|
+
});
|
|
231
232
|
}
|
|
232
233
|
export var overlayCss = {
|
|
233
234
|
// stretching to full width / height of button
|
package/dist/esm/version.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
3
4
|
import { Appearance } from './types';
|
|
4
5
|
export declare type ButtonGroupProps = {
|
|
5
6
|
/**
|
|
@@ -8,4 +9,4 @@ export declare type ButtonGroupProps = {
|
|
|
8
9
|
appearance?: Appearance;
|
|
9
10
|
children?: React.ReactNode;
|
|
10
11
|
};
|
|
11
|
-
export default function ButtonGroup({ appearance, children, }: ButtonGroupProps): JSX.Element;
|
|
12
|
+
export default function ButtonGroup({ appearance, children, }: ButtonGroupProps): jsx.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CSSObject } from '@emotion/
|
|
2
|
+
import { CSSObject } from '@emotion/react';
|
|
3
3
|
import { InteractionState, ThemeProps, ThemeTokens } from './custom-theme-button-types';
|
|
4
4
|
export declare function getCustomCss({ appearance, spacing, mode, isSelected, shouldFitContainer, iconIsOnlyChild, isLoading, state, }: ThemeProps): CSSObject;
|
|
5
5
|
export declare function getSpecifiers(styles: CSSObject): CSSObject;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { CSSObject } from '@emotion/
|
|
3
|
+
import { CSSObject } from '@emotion/react';
|
|
4
4
|
declare const _default: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.AllHTMLAttributes<HTMLElement>, "disabled">, "data-testid" | "data-has-overlay"> & {
|
|
5
5
|
'data-testid'?: undefined;
|
|
6
6
|
'data-has-overlay'?: undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSObject } from '@emotion/
|
|
1
|
+
import { CSSObject } from '@emotion/react';
|
|
2
2
|
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
3
|
import { Appearance, Spacing } from '../types';
|
|
4
4
|
export declare type GetCssArgs = {
|
|
@@ -12,11 +12,11 @@ export declare type GetCssArgs = {
|
|
|
12
12
|
export declare function getCss({ appearance, spacing, mode, isSelected, shouldFitContainer, isOnlySingleIcon, }: GetCssArgs): CSSObject;
|
|
13
13
|
export declare function getIconStyle({ spacing }: {
|
|
14
14
|
spacing: Spacing;
|
|
15
|
-
}):
|
|
15
|
+
}): import("@emotion/react").SerializedStyles;
|
|
16
16
|
export declare function getContentStyle({ spacing }: {
|
|
17
17
|
spacing: Spacing;
|
|
18
|
-
}):
|
|
19
|
-
export declare function getFadingCss({ hasOverlay
|
|
18
|
+
}): import("@emotion/react").SerializedStyles;
|
|
19
|
+
export declare function getFadingCss({ hasOverlay }: {
|
|
20
20
|
hasOverlay: boolean;
|
|
21
|
-
}):
|
|
21
|
+
}): import("@emotion/react").SerializedStyles;
|
|
22
22
|
export declare const overlayCss: CSSObject;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
3
4
|
import { Appearance } from './types';
|
|
4
5
|
export declare type ButtonGroupProps = {
|
|
5
6
|
/**
|
|
@@ -8,4 +9,4 @@ export declare type ButtonGroupProps = {
|
|
|
8
9
|
appearance?: Appearance;
|
|
9
10
|
children?: React.ReactNode;
|
|
10
11
|
};
|
|
11
|
-
export default function ButtonGroup({ appearance, children, }: ButtonGroupProps): JSX.Element;
|
|
12
|
+
export default function ButtonGroup({ appearance, children, }: ButtonGroupProps): jsx.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CSSObject } from '@emotion/
|
|
2
|
+
import { CSSObject } from '@emotion/react';
|
|
3
3
|
import { InteractionState, ThemeProps, ThemeTokens } from './custom-theme-button-types';
|
|
4
4
|
export declare function getCustomCss({ appearance, spacing, mode, isSelected, shouldFitContainer, iconIsOnlyChild, isLoading, state, }: ThemeProps): CSSObject;
|
|
5
5
|
export declare function getSpecifiers(styles: CSSObject): CSSObject;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { CSSObject } from '@emotion/
|
|
3
|
+
import { CSSObject } from '@emotion/react';
|
|
4
4
|
declare const _default: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.AllHTMLAttributes<HTMLElement>, "disabled">, "data-testid" | "data-has-overlay"> & {
|
|
5
5
|
'data-testid'?: undefined;
|
|
6
6
|
'data-has-overlay'?: undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSObject } from '@emotion/
|
|
1
|
+
import { CSSObject } from '@emotion/react';
|
|
2
2
|
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
3
|
import { Appearance, Spacing } from '../types';
|
|
4
4
|
export declare type GetCssArgs = {
|
|
@@ -12,11 +12,11 @@ export declare type GetCssArgs = {
|
|
|
12
12
|
export declare function getCss({ appearance, spacing, mode, isSelected, shouldFitContainer, isOnlySingleIcon, }: GetCssArgs): CSSObject;
|
|
13
13
|
export declare function getIconStyle({ spacing }: {
|
|
14
14
|
spacing: Spacing;
|
|
15
|
-
}):
|
|
15
|
+
}): import("@emotion/react").SerializedStyles;
|
|
16
16
|
export declare function getContentStyle({ spacing }: {
|
|
17
17
|
spacing: Spacing;
|
|
18
|
-
}):
|
|
19
|
-
export declare function getFadingCss({ hasOverlay
|
|
18
|
+
}): import("@emotion/react").SerializedStyles;
|
|
19
|
+
export declare function getFadingCss({ hasOverlay }: {
|
|
20
20
|
hasOverlay: boolean;
|
|
21
|
-
}):
|
|
21
|
+
}): import("@emotion/react").SerializedStyles;
|
|
22
22
|
export declare const overlayCss: CSSObject;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.4.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/"
|
|
@@ -15,13 +15,15 @@
|
|
|
15
15
|
"typesVersions": {
|
|
16
16
|
">=4.0 <4.5": {
|
|
17
17
|
"*": [
|
|
18
|
-
"dist/types-ts4.0/*"
|
|
18
|
+
"dist/types-ts4.0/*",
|
|
19
|
+
"dist/types-ts4.0/index.d.ts"
|
|
19
20
|
]
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
23
|
"sideEffects": false,
|
|
23
24
|
"atlaskit:src": "src/index.tsx",
|
|
24
25
|
"atlassian": {
|
|
26
|
+
"disableProductCI": true,
|
|
25
27
|
"team": "Design System Team",
|
|
26
28
|
"releaseModel": "scheduled",
|
|
27
29
|
"website": {
|
|
@@ -40,21 +42,21 @@
|
|
|
40
42
|
"dependencies": {
|
|
41
43
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
42
44
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
43
|
-
"@atlaskit/spinner": "^15.
|
|
45
|
+
"@atlaskit/spinner": "^15.2.0",
|
|
44
46
|
"@atlaskit/theme": "^12.2.0",
|
|
45
47
|
"@atlaskit/tokens": "^0.10.0",
|
|
46
48
|
"@babel/runtime": "^7.0.0",
|
|
47
|
-
"@emotion/
|
|
49
|
+
"@emotion/react": "^11.7.1"
|
|
48
50
|
},
|
|
49
51
|
"peerDependencies": {
|
|
50
52
|
"react": "^16.8.0"
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {
|
|
53
|
-
"@atlaskit/checkbox": "^12.
|
|
55
|
+
"@atlaskit/checkbox": "^12.4.0",
|
|
54
56
|
"@atlaskit/docs": "*",
|
|
55
|
-
"@atlaskit/icon": "^21.
|
|
56
|
-
"@atlaskit/logo": "^13.
|
|
57
|
-
"@atlaskit/section-message": "^6.
|
|
57
|
+
"@atlaskit/icon": "^21.11.0",
|
|
58
|
+
"@atlaskit/logo": "^13.10.0",
|
|
59
|
+
"@atlaskit/section-message": "^6.3.0",
|
|
58
60
|
"@atlaskit/select": "^15.7.0",
|
|
59
61
|
"@atlaskit/ssr": "*",
|
|
60
62
|
"@atlaskit/visual-regression": "*",
|
|
@@ -83,6 +85,7 @@
|
|
|
83
85
|
"design-system": "v1",
|
|
84
86
|
"ui-components": "lite-mode",
|
|
85
87
|
"analytics": "analytics-next",
|
|
88
|
+
"design-tokens": "spacing",
|
|
86
89
|
"theming": "tokens",
|
|
87
90
|
"deprecation": "no-deprecated-imports",
|
|
88
91
|
"styling": [
|
package/report.api.md
CHANGED
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
4
|
|
|
5
|
+
<!--
|
|
6
|
+
Generated API Report version: 2.0
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
10
|
+
|
|
5
11
|
```ts
|
|
6
12
|
/// <reference types="react" />
|
|
7
13
|
|
|
8
14
|
import { ComponentType } from 'react';
|
|
9
|
-
import { CSSObject } from '@emotion/
|
|
15
|
+
import { CSSObject } from '@emotion/react';
|
|
16
|
+
import { jsx } from '@emotion/react';
|
|
10
17
|
import { default as React_2 } from 'react';
|
|
11
18
|
import { ReactNode } from 'react';
|
|
12
19
|
import { ThemeModes } from '@atlaskit/theme/types';
|
|
@@ -14,7 +21,8 @@ import { ThemeModes as ThemeModes_2 } from '@atlaskit/theme';
|
|
|
14
21
|
import { ThemeProp } from '@atlaskit/theme/components';
|
|
15
22
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
// @public (undocumented)
|
|
25
|
+
export type Appearance =
|
|
18
26
|
| 'default'
|
|
19
27
|
| 'danger'
|
|
20
28
|
| 'link'
|
|
@@ -23,54 +31,37 @@ export declare type Appearance =
|
|
|
23
31
|
| 'subtle-link'
|
|
24
32
|
| 'warning';
|
|
25
33
|
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
// @public (undocumented)
|
|
35
|
+
export type BaseOwnProps = {
|
|
28
36
|
appearance?: Appearance;
|
|
29
|
-
/** Set the button to autofocus on mount */
|
|
30
37
|
autoFocus?: boolean;
|
|
31
|
-
/** Add a classname to the button */
|
|
32
38
|
className?: string;
|
|
33
|
-
/** Used to 'overlay' something over a button. This is commonly used to display a loading spinner */
|
|
34
39
|
overlay?: React_2.ReactNode;
|
|
35
|
-
/** Provides a url for buttons being used as a link */
|
|
36
40
|
href?: string;
|
|
37
|
-
/** Places an icon within the button, after the button's text */
|
|
38
41
|
iconAfter?: React_2.ReactChild;
|
|
39
|
-
/** Places an icon within the button, before the button's text */
|
|
40
42
|
iconBefore?: React_2.ReactChild;
|
|
41
|
-
/** Set if the button is disabled */
|
|
42
43
|
isDisabled?: boolean;
|
|
43
|
-
/** Change the style to indicate the button is selected */
|
|
44
44
|
isSelected?: boolean;
|
|
45
|
-
/** Handler to be called on blur */
|
|
46
45
|
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
46
|
onClick?: (
|
|
49
47
|
e: React_2.MouseEvent<HTMLElement>,
|
|
50
48
|
analyticsEvent: UIAnalyticsEvent,
|
|
51
49
|
) => void;
|
|
52
|
-
/** Handler to be called on focus */
|
|
53
50
|
onFocus?: React_2.FocusEventHandler<HTMLElement>;
|
|
54
|
-
/** Set the amount of padding in the button */
|
|
55
51
|
spacing?: Spacing;
|
|
56
|
-
/** Pass target down to a link within the button component, if a href is provided */
|
|
57
52
|
target?: React_2.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
58
|
-
/** Pass type down to a button */
|
|
59
53
|
type?: React_2.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
60
|
-
/** Option to fit button width to its parent width */
|
|
61
54
|
shouldFitContainer?: boolean;
|
|
62
|
-
/** Text content to be rendered in the button */
|
|
63
55
|
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
56
|
testId?: string;
|
|
66
57
|
component?:
|
|
67
58
|
| React_2.ComponentType<React_2.AllHTMLAttributes<HTMLElement>>
|
|
68
59
|
| React_2.ElementType;
|
|
69
|
-
/** Additional information to be included in the `context` of analytics events that come from button */
|
|
70
60
|
analyticsContext?: Record<string, any>;
|
|
71
61
|
};
|
|
72
62
|
|
|
73
|
-
|
|
63
|
+
// @public (undocumented)
|
|
64
|
+
export type BaseProps = Combine<
|
|
74
65
|
Combine<
|
|
75
66
|
Omit<React_2.AllHTMLAttributes<HTMLElement>, 'disabled'>,
|
|
76
67
|
{
|
|
@@ -81,47 +72,52 @@ export declare type BaseProps = Combine<
|
|
|
81
72
|
BaseOwnProps
|
|
82
73
|
>;
|
|
83
74
|
|
|
84
|
-
|
|
75
|
+
// @public
|
|
76
|
+
const Button: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<
|
|
85
77
|
ButtonProps & React_2.RefAttributes<HTMLElement>
|
|
86
78
|
>>;
|
|
87
79
|
export default Button;
|
|
88
80
|
|
|
89
|
-
|
|
81
|
+
// @public (undocumented)
|
|
82
|
+
export function ButtonGroup({
|
|
90
83
|
appearance,
|
|
91
84
|
children,
|
|
92
|
-
}: ButtonGroupProps): JSX.Element;
|
|
85
|
+
}: ButtonGroupProps): jsx.JSX.Element;
|
|
93
86
|
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
// @public (undocumented)
|
|
88
|
+
type ButtonGroupProps = {
|
|
96
89
|
appearance?: Appearance;
|
|
97
90
|
children?: React_2.ReactNode;
|
|
98
91
|
};
|
|
99
92
|
|
|
100
|
-
|
|
93
|
+
// @public (undocumented)
|
|
94
|
+
export interface ButtonProps extends BaseProps {}
|
|
101
95
|
|
|
102
|
-
|
|
96
|
+
// @public (undocumented)
|
|
97
|
+
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
103
98
|
|
|
104
|
-
|
|
99
|
+
// @public
|
|
100
|
+
export const CustomThemeButton: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<
|
|
105
101
|
Omit<BaseProps, 'overlay'> &
|
|
106
102
|
CustomThemeButtonOwnProps &
|
|
107
103
|
React_2.RefAttributes<HTMLElement>
|
|
108
104
|
>>;
|
|
109
105
|
|
|
110
|
-
|
|
106
|
+
// @public (undocumented)
|
|
107
|
+
export type CustomThemeButtonOwnProps = {
|
|
111
108
|
isLoading?: boolean;
|
|
112
|
-
/** Slow + discouraged custom theme API
|
|
113
|
-
* See custom theme guide for usage details
|
|
114
|
-
*/
|
|
115
109
|
theme?: (
|
|
116
110
|
current: (props: ThemeProps) => ThemeTokens,
|
|
117
111
|
props: ThemeProps,
|
|
118
112
|
) => ThemeTokens;
|
|
119
113
|
};
|
|
120
114
|
|
|
121
|
-
|
|
115
|
+
// @public (undocumented)
|
|
116
|
+
export type CustomThemeButtonProps = Omit<BaseProps, 'overlay'> &
|
|
122
117
|
CustomThemeButtonOwnProps;
|
|
123
118
|
|
|
124
|
-
|
|
119
|
+
// @public (undocumented)
|
|
120
|
+
export type InteractionState =
|
|
125
121
|
| 'disabled'
|
|
126
122
|
| 'focusSelected'
|
|
127
123
|
| 'selected'
|
|
@@ -130,22 +126,27 @@ export declare type InteractionState =
|
|
|
130
126
|
| 'focus'
|
|
131
127
|
| 'default';
|
|
132
128
|
|
|
133
|
-
|
|
129
|
+
// @public
|
|
130
|
+
export const LoadingButton: React_2.ForwardRefExoticComponent<
|
|
134
131
|
Omit<BaseProps, 'overlay'> &
|
|
135
132
|
LoadingButtonOwnProps &
|
|
136
133
|
React_2.RefAttributes<HTMLElement>
|
|
137
134
|
>;
|
|
138
135
|
|
|
139
|
-
|
|
136
|
+
// @public (undocumented)
|
|
137
|
+
export type LoadingButtonOwnProps = {
|
|
140
138
|
isLoading?: boolean;
|
|
141
139
|
};
|
|
142
140
|
|
|
143
|
-
|
|
141
|
+
// @public (undocumented)
|
|
142
|
+
export type LoadingButtonProps = Omit<BaseProps, 'overlay'> &
|
|
144
143
|
LoadingButtonOwnProps;
|
|
145
144
|
|
|
146
|
-
|
|
145
|
+
// @public (undocumented)
|
|
146
|
+
export type Spacing = 'compact' | 'default' | 'none';
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
// @public (undocumented)
|
|
149
|
+
export const Theme: {
|
|
149
150
|
Consumer: ComponentType<
|
|
150
151
|
{
|
|
151
152
|
children: (tokens: ThemeTokens) => ReactNode;
|
|
@@ -162,16 +163,18 @@ export declare const Theme: {
|
|
|
162
163
|
useTheme: (props: ThemeProps) => ThemeTokens;
|
|
163
164
|
};
|
|
164
165
|
|
|
165
|
-
|
|
166
|
+
// @public (undocumented)
|
|
167
|
+
export type ThemeProps = Partial<CustomThemeButtonProps> & {
|
|
166
168
|
state: InteractionState;
|
|
167
169
|
iconIsOnlyChild?: boolean;
|
|
168
170
|
mode?: ThemeModes;
|
|
169
171
|
};
|
|
170
172
|
|
|
171
|
-
|
|
173
|
+
// @public (undocumented)
|
|
174
|
+
export type ThemeTokens = {
|
|
172
175
|
buttonStyles: CSSObject;
|
|
173
176
|
spinnerStyles: CSSObject;
|
|
174
177
|
};
|
|
175
178
|
|
|
176
|
-
|
|
179
|
+
// (No @packageDocumentation comment for this package)
|
|
177
180
|
```
|