@atlaskit/button 16.3.10 → 16.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/codemods/15.1.1-data-testid.tsx +10 -12
- package/codemods/__tests__/15.0.0-lite-mode/optimistic.tsx +6 -12
- package/codemods/__tests__/15.0.0-lite-mode/shared.tsx +1 -2
- package/codemods/__tests__/15.1.1-data-testid/rename-data-testid.tsx +1 -2
- package/codemods/helpers/helpers-generic.tsx +10 -12
- package/dist/cjs/button-group.js +5 -5
- 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 +2 -2
- 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 +2 -2
- 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/package.json +5 -13
- package/report.api.md +58 -117
- package/dist/types-ts4.0/button-group.d.ts +0 -11
- package/dist/types-ts4.0/button.d.ts +0 -15
- package/dist/types-ts4.0/custom-theme-button/custom-theme-button-types.d.ts +0 -22
- package/dist/types-ts4.0/custom-theme-button/custom-theme-button.d.ts +0 -10
- package/dist/types-ts4.0/custom-theme-button/index.d.ts +0 -2
- package/dist/types-ts4.0/custom-theme-button/theme.d.ts +0 -21
- package/dist/types-ts4.0/entry-points/button-group.d.ts +0 -1
- package/dist/types-ts4.0/entry-points/custom-theme-button.d.ts +0 -2
- package/dist/types-ts4.0/entry-points/loading-button.d.ts +0 -2
- package/dist/types-ts4.0/entry-points/standard-button.d.ts +0 -7
- package/dist/types-ts4.0/entry-points/types.d.ts +0 -4
- package/dist/types-ts4.0/index.d.ts +0 -8
- package/dist/types-ts4.0/loading-button.d.ts +0 -15
- package/dist/types-ts4.0/shared/block-events.d.ts +0 -3
- package/dist/types-ts4.0/shared/button-base.d.ts +0 -10
- package/dist/types-ts4.0/shared/colors.d.ts +0 -31
- package/dist/types-ts4.0/shared/css.d.ts +0 -22
- package/dist/types-ts4.0/shared/get-is-only-single-icon.d.ts +0 -2
- package/dist/types-ts4.0/shared/loading-spinner.d.ts +0 -5
- package/dist/types-ts4.0/types.d.ts +0 -89
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 16.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 16.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`9f6369f5505`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9f6369f5505) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behaviour change.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 16.3.10
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -87,20 +87,18 @@ export function getNamedImportName({
|
|
|
87
87
|
.filter((path) => path.node.source.value === importPath)
|
|
88
88
|
.find(j.ImportSpecifier)
|
|
89
89
|
.nodes()
|
|
90
|
-
.map(
|
|
91
|
-
(specifier
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return specifier.local.name;
|
|
96
|
-
}
|
|
97
|
-
// not aliased
|
|
98
|
-
return originalName;
|
|
90
|
+
.map((specifier): Nullable<string> => {
|
|
91
|
+
if (specifier.imported.name === originalName) {
|
|
92
|
+
// aliased
|
|
93
|
+
if (specifier.local) {
|
|
94
|
+
return specifier.local.name;
|
|
99
95
|
}
|
|
96
|
+
// not aliased
|
|
97
|
+
return originalName;
|
|
98
|
+
}
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
)
|
|
100
|
+
return null;
|
|
101
|
+
})
|
|
104
102
|
.filter(Boolean)[0] || null;
|
|
105
103
|
return name;
|
|
106
104
|
}
|
|
@@ -369,8 +369,7 @@ describe('Non exclusive JSX usage of <Button />', () => {
|
|
|
369
369
|
|
|
370
370
|
check({
|
|
371
371
|
transformer,
|
|
372
|
-
it:
|
|
373
|
-
'should use standard button if Button is used in JSX and also not in JSX',
|
|
372
|
+
it: 'should use standard button if Button is used in JSX and also not in JSX',
|
|
374
373
|
original: `
|
|
375
374
|
import React from 'react';
|
|
376
375
|
import Button from './our-button';
|
|
@@ -419,8 +418,7 @@ describe('Non exclusive JSX usage of <Button />', () => {
|
|
|
419
418
|
describe('Spreading props', () => {
|
|
420
419
|
check({
|
|
421
420
|
transformer,
|
|
422
|
-
it:
|
|
423
|
-
'should try to choose the right button if there are locally spread values (seperate object)',
|
|
421
|
+
it: 'should try to choose the right button if there are locally spread values (seperate object)',
|
|
424
422
|
original: `
|
|
425
423
|
import React from 'react';
|
|
426
424
|
import Button from '@atlaskit/button';
|
|
@@ -451,8 +449,7 @@ describe('Spreading props', () => {
|
|
|
451
449
|
|
|
452
450
|
check({
|
|
453
451
|
transformer,
|
|
454
|
-
it:
|
|
455
|
-
'should try to choose the right button if there are locally spread values (inline object)',
|
|
452
|
+
it: 'should try to choose the right button if there are locally spread values (inline object)',
|
|
456
453
|
original: `
|
|
457
454
|
import React from 'react';
|
|
458
455
|
import Button from '@atlaskit/button';
|
|
@@ -475,8 +472,7 @@ describe('Spreading props', () => {
|
|
|
475
472
|
|
|
476
473
|
check({
|
|
477
474
|
transformer,
|
|
478
|
-
it:
|
|
479
|
-
'should try to choose the right button if there are multiple local spread values',
|
|
475
|
+
it: 'should try to choose the right button if there are multiple local spread values',
|
|
480
476
|
original: `
|
|
481
477
|
import React from 'react';
|
|
482
478
|
import Button from '@atlaskit/button';
|
|
@@ -513,8 +509,7 @@ describe('Spreading props', () => {
|
|
|
513
509
|
|
|
514
510
|
check({
|
|
515
511
|
transformer,
|
|
516
|
-
it:
|
|
517
|
-
'should try to choose the right button if there are locally spread values (custom theme button)',
|
|
512
|
+
it: 'should try to choose the right button if there are locally spread values (custom theme button)',
|
|
518
513
|
original: `
|
|
519
514
|
import React from 'react';
|
|
520
515
|
import Button from '@atlaskit/button';
|
|
@@ -549,8 +544,7 @@ describe('Spreading props', () => {
|
|
|
549
544
|
|
|
550
545
|
check({
|
|
551
546
|
transformer,
|
|
552
|
-
it:
|
|
553
|
-
'should try to choose the right button if there is a spread value being mixed with a local values',
|
|
547
|
+
it: 'should try to choose the right button if there is a spread value being mixed with a local values',
|
|
554
548
|
original: `
|
|
555
549
|
import React from 'react';
|
|
556
550
|
import Button from '@atlaskit/button';
|
|
@@ -47,8 +47,7 @@ import { check } from '../_framework';
|
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
check({
|
|
50
|
-
it:
|
|
51
|
-
'should fallback to a `DSButtonAppearance` type alias if the `Appearance` identifier name is unavailable',
|
|
50
|
+
it: 'should fallback to a `DSButtonAppearance` type alias if the `Appearance` identifier name is unavailable',
|
|
52
51
|
transformer,
|
|
53
52
|
original: `
|
|
54
53
|
import { Appearance } from 'some-other-package';
|
|
@@ -135,8 +135,7 @@ check({
|
|
|
135
135
|
|
|
136
136
|
check({
|
|
137
137
|
transformer,
|
|
138
|
-
it:
|
|
139
|
-
'should add a warning when both the testId and data-testid props are being used',
|
|
138
|
+
it: 'should add a warning when both the testId and data-testid props are being used',
|
|
140
139
|
original: `
|
|
141
140
|
import StandardButton from '@atlaskit/button';
|
|
142
141
|
|
|
@@ -550,19 +550,17 @@ export function changeImportFor({
|
|
|
550
550
|
.filter((path) => path.node.source.value === oldPackagePath)
|
|
551
551
|
.find(j.ImportSpecifier)
|
|
552
552
|
.nodes()
|
|
553
|
-
.map(
|
|
554
|
-
(specifier
|
|
555
|
-
if (specifier.imported.name !== currentName) {
|
|
556
|
-
return null;
|
|
557
|
-
}
|
|
558
|
-
// If aliased: return the alias
|
|
559
|
-
if (specifier.local && specifier.local.name !== currentName) {
|
|
560
|
-
return specifier.local.name;
|
|
561
|
-
}
|
|
562
|
-
|
|
553
|
+
.map((specifier): Nullable<string> => {
|
|
554
|
+
if (specifier.imported.name !== currentName) {
|
|
563
555
|
return null;
|
|
564
|
-
}
|
|
565
|
-
|
|
556
|
+
}
|
|
557
|
+
// If aliased: return the alias
|
|
558
|
+
if (specifier.local && specifier.local.name !== currentName) {
|
|
559
|
+
return specifier.local.name;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
return null;
|
|
563
|
+
})
|
|
566
564
|
.filter(Boolean)[0] || null;
|
|
567
565
|
|
|
568
566
|
base
|
package/dist/cjs/button-group.js
CHANGED
|
@@ -9,14 +9,14 @@ 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
22
|
gap: "var(--ds-scale-050, 4px)",
|
|
@@ -28,14 +28,14 @@ var buttonGroupStyles = (0, _core.css)({
|
|
|
28
28
|
function ButtonGroup(_ref) {
|
|
29
29
|
var appearance = _ref.appearance,
|
|
30
30
|
children = _ref.children;
|
|
31
|
-
return (0,
|
|
31
|
+
return (0, _react2.jsx)("div", {
|
|
32
32
|
css: buttonGroupStyles
|
|
33
|
-
}, _react.default.Children.map(children, function (child, idx) {
|
|
33
|
+
}, _react.default.Children.map(_react.default.Children.toArray(children), function (child, idx) {
|
|
34
34
|
if (!child) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
return (0,
|
|
38
|
+
return (0, _react2.jsx)(_react.Fragment, {
|
|
39
39
|
key: idx
|
|
40
40
|
}, appearance ?
|
|
41
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.1",
|
|
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,6 +1,6 @@
|
|
|
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`
|
|
@@ -15,7 +15,7 @@ export default function ButtonGroup({
|
|
|
15
15
|
}) {
|
|
16
16
|
return jsx("div", {
|
|
17
17
|
css: buttonGroupStyles
|
|
18
|
-
}, React.Children.map(children, (child, idx) => {
|
|
18
|
+
}, React.Children.map(React.Children.toArray(children), (child, idx) => {
|
|
19
19
|
if (!child) {
|
|
20
20
|
return null;
|
|
21
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.1",
|
|
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,6 +1,6 @@
|
|
|
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`
|
|
@@ -14,7 +14,7 @@ export default function ButtonGroup(_ref) {
|
|
|
14
14
|
children = _ref.children;
|
|
15
15
|
return jsx("div", {
|
|
16
16
|
css: buttonGroupStyles
|
|
17
|
-
}, React.Children.map(children, function (child, idx) {
|
|
17
|
+
}, React.Children.map(React.Children.toArray(children), function (child, idx) {
|
|
18
18
|
if (!child) {
|
|
19
19
|
return null;
|
|
20
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.1",
|
|
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;
|