@atlaskit/button 20.4.1 → 20.5.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 +17 -58
- package/dist/cjs/new-button/containers/split-button/split-button.js +23 -1
- package/dist/cjs/new-button/variants/shared/use-button-base.js +55 -2
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/containers/split-button/split-button.js +23 -1
- package/dist/es2019/new-button/variants/shared/use-button-base.js +55 -2
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/containers/split-button/split-button.js +23 -1
- package/dist/esm/new-button/variants/shared/use-button-base.js +55 -2
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/new-button/containers/split-button/utils.d.ts +2 -2
- package/dist/types/new-button/variants/default/link.d.ts +2 -2
- package/dist/types/new-button/variants/icon/link.d.ts +2 -2
- package/dist/types/new-button/variants/shared/content.d.ts +1 -1
- package/dist/types/new-button/variants/shared/icon-renderer.d.ts +2 -2
- package/dist/types/new-button/variants/shared/loading-overlay.d.ts +2 -2
- package/dist/types/old-button/shared/loading-spinner.d.ts +2 -2
- package/dist/types-ts4.5/new-button/containers/split-button/utils.d.ts +2 -2
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +2 -2
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +2 -2
- package/dist/types-ts4.5/new-button/variants/shared/content.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/shared/icon-renderer.d.ts +2 -2
- package/dist/types-ts4.5/new-button/variants/shared/loading-overlay.d.ts +2 -2
- package/dist/types-ts4.5/old-button/shared/loading-spinner.d.ts +2 -2
- package/package.json +4 -3
- package/codemods/15.0.0-lite-mode.tsx +0 -45
- package/codemods/__tests__/15.0.0-lite-mode/optimistic.tsx +0 -638
- package/codemods/__tests__/15.0.0-lite-mode/safe.tsx +0 -223
- package/codemods/__tests__/15.0.0-lite-mode/shared.tsx +0 -255
- package/codemods/helpers/15.0.0-runner.tsx +0 -167
- package/codemods/optimistic-15.0.0-lite-mode.tsx +0 -263
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 20.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#110533](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110533)
|
|
8
|
+
[`9856bf5d3faeb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9856bf5d3faeb) -
|
|
9
|
+
Updated styles for new button to use `rem` unit for width and height instead of `em` with
|
|
10
|
+
fractional units.
|
|
11
|
+
|
|
12
|
+
## 20.4.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#109985](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109985)
|
|
17
|
+
[`f13dc94ee78bb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f13dc94ee78bb) -
|
|
18
|
+
Remove codemod for deprecated exports and remove now unused dev dependencies.
|
|
19
|
+
|
|
3
20
|
## 20.4.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -1661,36 +1678,6 @@ import CustomThemeButton from '@atlaskit/button/custom-theme-button';
|
|
|
1661
1678
|
You can also import them all from the root entry point if you like! Heads up though, **if your
|
|
1662
1679
|
bundler does not support tree shaking then you will not get the minimum possible bundle size**
|
|
1663
1680
|
|
|
1664
|
-
We have a **automated codemod** you can run to perform many upgrade processes for you. It comes in
|
|
1665
|
-
two flavours:
|
|
1666
|
-
|
|
1667
|
-
- `optimistic-15.0.0-lite-mode.ts`: An "optimistic" codemod that moves your buttons to the correct
|
|
1668
|
-
version based on the props you've provided. If you use the `isLoading` prop, it will change the
|
|
1669
|
-
import to use `loading-button`. If you use `theme` prop, imports to `custom-theme-button` will be
|
|
1670
|
-
used. If you have a ThemeProvider above your buttons in the React tree the optimistic codemod
|
|
1671
|
-
can't tell, and this could lead to regressions. Use this codemod with care!
|
|
1672
|
-
- `15.0.0-lite-mode.ts`: If you wrap your application in a ThemeProvider, you can use this "safe"
|
|
1673
|
-
codemod to change all usages of button to the `custom-theme-button`.
|
|
1674
|
-
|
|
1675
|
-
**Running the codemod cli**
|
|
1676
|
-
|
|
1677
|
-
To run the codemod: **You first need to have the latest version of button installed before you can
|
|
1678
|
-
run the codemod**
|
|
1679
|
-
|
|
1680
|
-
`yarn upgrade @atlaskit/button@^15.0.0`
|
|
1681
|
-
|
|
1682
|
-
Once upgraded, use the Atlaskit codemod-cli;
|
|
1683
|
-
|
|
1684
|
-
`npx @atlaskit/codemod-cli --parser [PARSER] --extensions [FILE_EXTENSIONS] [TARGET_PATH]`
|
|
1685
|
-
|
|
1686
|
-
Or run `npx @atlaskit/codemod-cli -h` for more details on usage. For Atlassians, refer to
|
|
1687
|
-
[this doc](https://hello.atlassian.net/wiki/spaces/AF/pages/2627171992/Codemods) for more details on
|
|
1688
|
-
the codemod CLI.
|
|
1689
|
-
|
|
1690
|
-
```js
|
|
1691
|
-
import Button, { LoadingButton, CustomThemeButton } from '@atlaskit/button';
|
|
1692
|
-
```
|
|
1693
|
-
|
|
1694
1681
|
### Change: default export
|
|
1695
1682
|
|
|
1696
1683
|
Previously the default export of the button package was a button that supported `theme`
|
|
@@ -1772,34 +1759,6 @@ content. This approach had a number of shortcomings.
|
|
|
1772
1759
|
- Documentation cleanup
|
|
1773
1760
|
- Examples cleanup
|
|
1774
1761
|
|
|
1775
|
-
**Automatic upgrading**
|
|
1776
|
-
|
|
1777
|
-
We have created some tooling to automatically upgrade your usage of Button!
|
|
1778
|
-
|
|
1779
|
-
```
|
|
1780
|
-
# You first need to have the latest button installed before you can run the codemod
|
|
1781
|
-
yarn add @atlaskit/button@^15.0.0
|
|
1782
|
-
|
|
1783
|
-
# Run the codemod cli
|
|
1784
|
-
# Pass in a parser for your codebase
|
|
1785
|
-
npx @atlaskit/codemod-cli /path/to/target/directory --parser [tsx | flow | babel]
|
|
1786
|
-
```
|
|
1787
|
-
|
|
1788
|
-
We have created **two** different codemods for you to choose from:
|
|
1789
|
-
|
|
1790
|
-
1. **Safe codemod**: This codemod will shift everything over to `CustomThemeButton` which is a 1:1
|
|
1791
|
-
of what exists today. This is super safe and you don’t need to do anything but sit back and
|
|
1792
|
-
enjoy. You get some nice performance wins for just doing this. You can then opportunistically
|
|
1793
|
-
move to the other `button` variants at your future convenience.
|
|
1794
|
-
2. **Optimistic codemod**: The codemod will try it’s hardest to move to the best `button` variant in
|
|
1795
|
-
a module based on usage. This is pretty tricky because we are splitting one thing into three. It
|
|
1796
|
-
can also be a bit dangerous because technically you can use a `ButtonTheme.Provider` higher in
|
|
1797
|
-
the React tree and all buttons will pick up that theme. The codemod cannot know about that
|
|
1798
|
-
nuance. This codemod will add comments to any files where it thinks you will need to make a
|
|
1799
|
-
decision and also point out when you might run into any `ButtonTheme.Provider` issues.
|
|
1800
|
-
|
|
1801
|
-
_When you use `@atlaskit/codemod-cli` you will be able to select which codemod you want to run_
|
|
1802
|
-
|
|
1803
1762
|
### Patch Changes
|
|
1804
1763
|
|
|
1805
1764
|
- [`83e32fa998`](https://bitbucket.org/atlassian/atlassian-frontend/commits/83e32fa998) - Now uses
|
|
@@ -68,6 +68,14 @@ var dividerHeight = {
|
|
|
68
68
|
height: "".concat(24 / 14, "em")
|
|
69
69
|
})
|
|
70
70
|
};
|
|
71
|
+
var dividerHeightWithRem = {
|
|
72
|
+
default: (0, _react.css)({
|
|
73
|
+
height: '2rem'
|
|
74
|
+
}),
|
|
75
|
+
compact: (0, _react.css)({
|
|
76
|
+
height: '1.5rem'
|
|
77
|
+
})
|
|
78
|
+
};
|
|
71
79
|
var defaultDividerHeight = {
|
|
72
80
|
// The divider height is calculated by subtracting twice the border width from the button height.
|
|
73
81
|
// This ensures the divider does not intersect with the button's border, avoiding visual issues
|
|
@@ -79,6 +87,17 @@ var defaultDividerHeight = {
|
|
|
79
87
|
height: "calc(".concat(24 / 14, "em - ", "var(--ds-border-width, 1px)", " - ", "var(--ds-border-width, 1px)", ")")
|
|
80
88
|
})
|
|
81
89
|
};
|
|
90
|
+
var defaultDividerHeightWithRem = {
|
|
91
|
+
// The divider height is calculated by subtracting twice the border width from the button height.
|
|
92
|
+
// This ensures the divider does not intersect with the button's border, avoiding visual issues
|
|
93
|
+
// caused by overlapping alpha colors (color.border) at the intersection.
|
|
94
|
+
default: (0, _react.css)({
|
|
95
|
+
height: "calc(2rem - ".concat("var(--ds-border-width, 1px)", " - ", "var(--ds-border-width, 1px)", ")")
|
|
96
|
+
}),
|
|
97
|
+
compact: (0, _react.css)({
|
|
98
|
+
height: "calc(1.5rem - ".concat("var(--ds-border-width, 1px)", " - ", "var(--ds-border-width, 1px)", ")")
|
|
99
|
+
})
|
|
100
|
+
};
|
|
82
101
|
/**
|
|
83
102
|
* TODO: Add JSDoc
|
|
84
103
|
*/
|
|
@@ -87,10 +106,13 @@ var Divider = exports.Divider = function Divider(_ref) {
|
|
|
87
106
|
spacing = _ref.spacing,
|
|
88
107
|
_ref$isDisabled = _ref.isDisabled,
|
|
89
108
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
|
|
109
|
+
// Pulling these out of the below `css` prop to avoid nested ternaries
|
|
110
|
+
var defaultDividerHeightStyles = (0, _platformFeatureFlags.fg)('platform_dst_button_replace_em_with_rem') ? defaultDividerHeightWithRem : defaultDividerHeight;
|
|
111
|
+
var dividerHeightStyles = (0, _platformFeatureFlags.fg)('platform_dst_button_replace_em_with_rem') ? dividerHeightWithRem : dividerHeight;
|
|
90
112
|
return (
|
|
91
113
|
// I find it funny to provide a div for Divider
|
|
92
114
|
(0, _react.jsx)("div", {
|
|
93
|
-
css: [baseDividerStyles, appearance === 'default' && !isDisabled && (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ?
|
|
115
|
+
css: [baseDividerStyles, appearance === 'default' && !isDisabled && (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? defaultDividerHeightStyles[spacing] : dividerHeightStyles[spacing], isDisabled && ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? dividerDisabledRefreshedStyles : dividerDisabledStyles), !isDisabled && ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? dividerRefreshedAppearance[appearance] : dividerAppearance[appearance]), (0, _platformFeatureFlags.fg)('platform-component-visual-refresh') && dividerRefreshedOffsetStyles]
|
|
94
116
|
})
|
|
95
117
|
);
|
|
96
118
|
};
|
|
@@ -23,6 +23,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
23
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
26
|
+
// If updating `buttonStyles`, also update `buttonStylesWithRem`.
|
|
26
27
|
var buttonStyles = (0, _primitives.xcss)({
|
|
27
28
|
display: 'inline-flex',
|
|
28
29
|
boxSizing: 'border-box',
|
|
@@ -53,6 +54,36 @@ var buttonStyles = (0, _primitives.xcss)({
|
|
|
53
54
|
position: 'absolute'
|
|
54
55
|
}
|
|
55
56
|
});
|
|
57
|
+
var buttonStylesWithRem = (0, _primitives.xcss)({
|
|
58
|
+
display: 'inline-flex',
|
|
59
|
+
boxSizing: 'border-box',
|
|
60
|
+
width: 'auto',
|
|
61
|
+
maxWidth: '100%',
|
|
62
|
+
position: 'relative',
|
|
63
|
+
alignItems: 'baseline',
|
|
64
|
+
justifyContent: 'center',
|
|
65
|
+
columnGap: 'space.050',
|
|
66
|
+
borderRadius: 'border.radius.100',
|
|
67
|
+
borderWidth: 'border.width.0',
|
|
68
|
+
flexShrink: 0,
|
|
69
|
+
height: '2rem',
|
|
70
|
+
font: 'font.body',
|
|
71
|
+
fontWeight: 'font.weight.medium',
|
|
72
|
+
paddingBlock: 'space.075',
|
|
73
|
+
paddingInlineEnd: 'space.150',
|
|
74
|
+
paddingInlineStart: 'space.150',
|
|
75
|
+
textAlign: 'center',
|
|
76
|
+
transition: 'background 0.1s ease-out',
|
|
77
|
+
verticalAlign: 'middle',
|
|
78
|
+
'::after': {
|
|
79
|
+
borderRadius: 'inherit',
|
|
80
|
+
inset: 'space.0',
|
|
81
|
+
borderStyle: 'solid',
|
|
82
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
83
|
+
pointerEvents: 'none',
|
|
84
|
+
position: 'absolute'
|
|
85
|
+
}
|
|
86
|
+
});
|
|
56
87
|
var defaultInteractiveStyles = (0, _primitives.xcss)({
|
|
57
88
|
':hover': {
|
|
58
89
|
background: "var(--ds-background-neutral-hovered, #091e4214)",
|
|
@@ -362,6 +393,8 @@ var selectedDiscoveryStyles = (0, _primitives.xcss)({
|
|
|
362
393
|
background: "var(--ds-background-selected, #403294)"
|
|
363
394
|
}
|
|
364
395
|
});
|
|
396
|
+
|
|
397
|
+
// If updating `spacingCompactStyles`, also update `spacingCompactStylesWithRem`.
|
|
365
398
|
var spacingCompactStyles = (0, _primitives.xcss)({
|
|
366
399
|
columnGap: 'space.050',
|
|
367
400
|
height: "".concat(24 / 14, "em"),
|
|
@@ -370,6 +403,14 @@ var spacingCompactStyles = (0, _primitives.xcss)({
|
|
|
370
403
|
paddingInlineStart: 'space.150',
|
|
371
404
|
verticalAlign: 'middle'
|
|
372
405
|
});
|
|
406
|
+
var spacingCompactStylesWithRem = (0, _primitives.xcss)({
|
|
407
|
+
columnGap: 'space.050',
|
|
408
|
+
height: '1.5rem',
|
|
409
|
+
paddingBlock: 'space.025',
|
|
410
|
+
paddingInlineEnd: 'space.150',
|
|
411
|
+
paddingInlineStart: 'space.150',
|
|
412
|
+
verticalAlign: 'middle'
|
|
413
|
+
});
|
|
373
414
|
var circleStyles = (0, _primitives.xcss)({
|
|
374
415
|
borderRadius: 'border.radius.circle'
|
|
375
416
|
});
|
|
@@ -379,16 +420,28 @@ var fullWidthStyles = (0, _primitives.xcss)({
|
|
|
379
420
|
var loadingStyles = (0, _primitives.xcss)({
|
|
380
421
|
cursor: 'progress'
|
|
381
422
|
});
|
|
423
|
+
// If updating `iconButtonStyles`, also update `iconButtonStylesWithRem`.
|
|
382
424
|
var iconButtonStyles = (0, _primitives.xcss)({
|
|
383
425
|
height: "".concat(32 / 14, "em"),
|
|
384
426
|
width: "".concat(32 / 14, "em"),
|
|
385
427
|
paddingInlineEnd: 'space.0',
|
|
386
428
|
paddingInlineStart: 'space.0'
|
|
387
429
|
});
|
|
430
|
+
var iconButtonStylesWithRem = (0, _primitives.xcss)({
|
|
431
|
+
height: '2rem',
|
|
432
|
+
width: '2rem',
|
|
433
|
+
paddingInlineEnd: 'space.0',
|
|
434
|
+
paddingInlineStart: 'space.0'
|
|
435
|
+
});
|
|
436
|
+
// If updating `iconButtonCompactStyles`, also update `iconButtonCompactStylesWithRem`.
|
|
388
437
|
var iconButtonCompactStyles = (0, _primitives.xcss)({
|
|
389
438
|
width: "".concat(24 / 14, "em"),
|
|
390
439
|
height: "".concat(24 / 14, "em")
|
|
391
440
|
});
|
|
441
|
+
var iconButtonCompactStylesWithRem = (0, _primitives.xcss)({
|
|
442
|
+
width: '1.5rem',
|
|
443
|
+
height: '1.5rem'
|
|
444
|
+
});
|
|
392
445
|
var buttonIconBeforeStyles = (0, _primitives.xcss)({
|
|
393
446
|
paddingInlineStart: 'space.100'
|
|
394
447
|
});
|
|
@@ -484,13 +537,13 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
484
537
|
(0, _useAutoFocus.default)(localRef, autoFocus);
|
|
485
538
|
return _objectSpread({
|
|
486
539
|
ref: (0, _mergeRefs.default)([localRef, ref]),
|
|
487
|
-
xcss: [buttonStyles, appearance === 'default' && ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? defaultRefreshedStyles : defaultStyles), appearance === 'default' && isInteractive && ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? defaultInteractiveRefreshedStyles : defaultInteractiveStyles), appearance === 'primary' && primaryStyles, appearance === 'primary' && isInteractive && primaryInteractiveStyles, appearance === 'warning' && warningStyles, appearance === 'warning' && isInteractive && warningInteractiveStyles, appearance === 'danger' && dangerStyles, appearance === 'danger' && isInteractive && dangerInteractiveStyles, appearance === 'discovery' && discoveryStyles, appearance === 'discovery' && isInteractive && discoveryInteractiveStyles, appearance === 'subtle' && ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? subtleRefreshedStyles : subtleStyles), appearance === 'subtle' && isInteractive && ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? subtleInteractiveRefreshedStyles : subtleInteractiveStyles), linkDecorationUnsetStyles, isSelected && ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? selectedRefreshedStyles : selectedStyles), isSelected && isSplitButton && selectedInsideSplitButtonStyles, isSelected && isInteractive && selectedInteractiveStyles,
|
|
540
|
+
xcss: [(0, _platformFeatureFlags.fg)('platform_dst_button_replace_em_with_rem') ? buttonStylesWithRem : buttonStyles, appearance === 'default' && ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? defaultRefreshedStyles : defaultStyles), appearance === 'default' && isInteractive && ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? defaultInteractiveRefreshedStyles : defaultInteractiveStyles), appearance === 'primary' && primaryStyles, appearance === 'primary' && isInteractive && primaryInteractiveStyles, appearance === 'warning' && warningStyles, appearance === 'warning' && isInteractive && warningInteractiveStyles, appearance === 'danger' && dangerStyles, appearance === 'danger' && isInteractive && dangerInteractiveStyles, appearance === 'discovery' && discoveryStyles, appearance === 'discovery' && isInteractive && discoveryInteractiveStyles, appearance === 'subtle' && ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? subtleRefreshedStyles : subtleStyles), appearance === 'subtle' && isInteractive && ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? subtleInteractiveRefreshedStyles : subtleInteractiveStyles), linkDecorationUnsetStyles, isSelected && ((0, _platformFeatureFlags.fg)('platform-component-visual-refresh') ? selectedRefreshedStyles : selectedStyles), isSelected && isSplitButton && selectedInsideSplitButtonStyles, isSelected && isInteractive && selectedInteractiveStyles,
|
|
488
541
|
// TODO: remove me once we kill color fallbacks
|
|
489
542
|
isSelected && appearance === 'danger' && selectedDangerStyles,
|
|
490
543
|
// TODO: remove me once we kill color fallbacks
|
|
491
544
|
isSelected && appearance === 'warning' && selectedWarningStyles,
|
|
492
545
|
// TODO: remove me once we kill color fallbacks
|
|
493
|
-
isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, hasIconBefore && buttonIconBeforeStyles, hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading && loadingStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
|
|
546
|
+
isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && ((0, _platformFeatureFlags.fg)('platform_dst_button_replace_em_with_rem') ? spacingCompactStylesWithRem : spacingCompactStyles), hasIconBefore && buttonIconBeforeStyles, hasIconAfter && buttonIconAfterStyles, isIconButton && ((0, _platformFeatureFlags.fg)('platform_dst_button_replace_em_with_rem') ? iconButtonStylesWithRem : iconButtonStyles), isIconButton && spacing === 'compact' && ((0, _platformFeatureFlags.fg)('platform_dst_button_replace_em_with_rem') ? iconButtonCompactStylesWithRem : iconButtonCompactStyles), shouldFitContainer && fullWidthStyles, isLoading && loadingStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
|
|
494
547
|
isDisabled: isEffectivelyDisabled,
|
|
495
548
|
children: /*#__PURE__*/_react.default.createElement(_splitButtonContext.SplitButtonContext.Provider, {
|
|
496
549
|
value: undefined
|
|
@@ -133,7 +133,7 @@ var ButtonBase = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(prop
|
|
|
133
133
|
action: 'clicked',
|
|
134
134
|
componentName: 'button',
|
|
135
135
|
packageName: "@atlaskit/button",
|
|
136
|
-
packageVersion: "20.
|
|
136
|
+
packageVersion: "20.5.0",
|
|
137
137
|
analyticsData: analyticsContext
|
|
138
138
|
});
|
|
139
139
|
|
|
@@ -62,6 +62,14 @@ const dividerHeight = {
|
|
|
62
62
|
height: `${24 / 14}em`
|
|
63
63
|
})
|
|
64
64
|
};
|
|
65
|
+
const dividerHeightWithRem = {
|
|
66
|
+
default: css({
|
|
67
|
+
height: '2rem'
|
|
68
|
+
}),
|
|
69
|
+
compact: css({
|
|
70
|
+
height: '1.5rem'
|
|
71
|
+
})
|
|
72
|
+
};
|
|
65
73
|
const defaultDividerHeight = {
|
|
66
74
|
// The divider height is calculated by subtracting twice the border width from the button height.
|
|
67
75
|
// This ensures the divider does not intersect with the button's border, avoiding visual issues
|
|
@@ -73,6 +81,17 @@ const defaultDividerHeight = {
|
|
|
73
81
|
height: `calc(${24 / 14}em - ${"var(--ds-border-width, 1px)"} - ${"var(--ds-border-width, 1px)"})`
|
|
74
82
|
})
|
|
75
83
|
};
|
|
84
|
+
const defaultDividerHeightWithRem = {
|
|
85
|
+
// The divider height is calculated by subtracting twice the border width from the button height.
|
|
86
|
+
// This ensures the divider does not intersect with the button's border, avoiding visual issues
|
|
87
|
+
// caused by overlapping alpha colors (color.border) at the intersection.
|
|
88
|
+
default: css({
|
|
89
|
+
height: `calc(2rem - ${"var(--ds-border-width, 1px)"} - ${"var(--ds-border-width, 1px)"})`
|
|
90
|
+
}),
|
|
91
|
+
compact: css({
|
|
92
|
+
height: `calc(1.5rem - ${"var(--ds-border-width, 1px)"} - ${"var(--ds-border-width, 1px)"})`
|
|
93
|
+
})
|
|
94
|
+
};
|
|
76
95
|
/**
|
|
77
96
|
* TODO: Add JSDoc
|
|
78
97
|
*/
|
|
@@ -81,10 +100,13 @@ export const Divider = ({
|
|
|
81
100
|
spacing,
|
|
82
101
|
isDisabled = false
|
|
83
102
|
}) => {
|
|
103
|
+
// Pulling these out of the below `css` prop to avoid nested ternaries
|
|
104
|
+
const defaultDividerHeightStyles = fg('platform_dst_button_replace_em_with_rem') ? defaultDividerHeightWithRem : defaultDividerHeight;
|
|
105
|
+
const dividerHeightStyles = fg('platform_dst_button_replace_em_with_rem') ? dividerHeightWithRem : dividerHeight;
|
|
84
106
|
return (
|
|
85
107
|
// I find it funny to provide a div for Divider
|
|
86
108
|
jsx("div", {
|
|
87
|
-
css: [baseDividerStyles, appearance === 'default' && !isDisabled && fg('platform-component-visual-refresh') ?
|
|
109
|
+
css: [baseDividerStyles, appearance === 'default' && !isDisabled && fg('platform-component-visual-refresh') ? defaultDividerHeightStyles[spacing] : dividerHeightStyles[spacing], isDisabled && (fg('platform-component-visual-refresh') ? dividerDisabledRefreshedStyles : dividerDisabledStyles), !isDisabled && (fg('platform-component-visual-refresh') ? dividerRefreshedAppearance[appearance] : dividerAppearance[appearance]), fg('platform-component-visual-refresh') && dividerRefreshedOffsetStyles]
|
|
88
110
|
})
|
|
89
111
|
);
|
|
90
112
|
};
|
|
@@ -10,6 +10,7 @@ import { SplitButtonContext, useSplitButtonContext } from '../../containers/spli
|
|
|
10
10
|
import blockEvents from './block-events';
|
|
11
11
|
import { LOADING_LABEL } from './constants';
|
|
12
12
|
import renderLoadingOverlay from './loading-overlay';
|
|
13
|
+
// If updating `buttonStyles`, also update `buttonStylesWithRem`.
|
|
13
14
|
const buttonStyles = xcss({
|
|
14
15
|
display: 'inline-flex',
|
|
15
16
|
boxSizing: 'border-box',
|
|
@@ -40,6 +41,36 @@ const buttonStyles = xcss({
|
|
|
40
41
|
position: 'absolute'
|
|
41
42
|
}
|
|
42
43
|
});
|
|
44
|
+
const buttonStylesWithRem = xcss({
|
|
45
|
+
display: 'inline-flex',
|
|
46
|
+
boxSizing: 'border-box',
|
|
47
|
+
width: 'auto',
|
|
48
|
+
maxWidth: '100%',
|
|
49
|
+
position: 'relative',
|
|
50
|
+
alignItems: 'baseline',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
columnGap: 'space.050',
|
|
53
|
+
borderRadius: 'border.radius.100',
|
|
54
|
+
borderWidth: 'border.width.0',
|
|
55
|
+
flexShrink: 0,
|
|
56
|
+
height: '2rem',
|
|
57
|
+
font: 'font.body',
|
|
58
|
+
fontWeight: 'font.weight.medium',
|
|
59
|
+
paddingBlock: 'space.075',
|
|
60
|
+
paddingInlineEnd: 'space.150',
|
|
61
|
+
paddingInlineStart: 'space.150',
|
|
62
|
+
textAlign: 'center',
|
|
63
|
+
transition: 'background 0.1s ease-out',
|
|
64
|
+
verticalAlign: 'middle',
|
|
65
|
+
'::after': {
|
|
66
|
+
borderRadius: 'inherit',
|
|
67
|
+
inset: 'space.0',
|
|
68
|
+
borderStyle: 'solid',
|
|
69
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
70
|
+
pointerEvents: 'none',
|
|
71
|
+
position: 'absolute'
|
|
72
|
+
}
|
|
73
|
+
});
|
|
43
74
|
const defaultInteractiveStyles = xcss({
|
|
44
75
|
':hover': {
|
|
45
76
|
background: "var(--ds-background-neutral-hovered, #091e4214)",
|
|
@@ -349,6 +380,8 @@ const selectedDiscoveryStyles = xcss({
|
|
|
349
380
|
background: "var(--ds-background-selected, #403294)"
|
|
350
381
|
}
|
|
351
382
|
});
|
|
383
|
+
|
|
384
|
+
// If updating `spacingCompactStyles`, also update `spacingCompactStylesWithRem`.
|
|
352
385
|
const spacingCompactStyles = xcss({
|
|
353
386
|
columnGap: 'space.050',
|
|
354
387
|
height: `${24 / 14}em`,
|
|
@@ -357,6 +390,14 @@ const spacingCompactStyles = xcss({
|
|
|
357
390
|
paddingInlineStart: 'space.150',
|
|
358
391
|
verticalAlign: 'middle'
|
|
359
392
|
});
|
|
393
|
+
const spacingCompactStylesWithRem = xcss({
|
|
394
|
+
columnGap: 'space.050',
|
|
395
|
+
height: '1.5rem',
|
|
396
|
+
paddingBlock: 'space.025',
|
|
397
|
+
paddingInlineEnd: 'space.150',
|
|
398
|
+
paddingInlineStart: 'space.150',
|
|
399
|
+
verticalAlign: 'middle'
|
|
400
|
+
});
|
|
360
401
|
const circleStyles = xcss({
|
|
361
402
|
borderRadius: 'border.radius.circle'
|
|
362
403
|
});
|
|
@@ -366,16 +407,28 @@ const fullWidthStyles = xcss({
|
|
|
366
407
|
const loadingStyles = xcss({
|
|
367
408
|
cursor: 'progress'
|
|
368
409
|
});
|
|
410
|
+
// If updating `iconButtonStyles`, also update `iconButtonStylesWithRem`.
|
|
369
411
|
const iconButtonStyles = xcss({
|
|
370
412
|
height: `${32 / 14}em`,
|
|
371
413
|
width: `${32 / 14}em`,
|
|
372
414
|
paddingInlineEnd: 'space.0',
|
|
373
415
|
paddingInlineStart: 'space.0'
|
|
374
416
|
});
|
|
417
|
+
const iconButtonStylesWithRem = xcss({
|
|
418
|
+
height: '2rem',
|
|
419
|
+
width: '2rem',
|
|
420
|
+
paddingInlineEnd: 'space.0',
|
|
421
|
+
paddingInlineStart: 'space.0'
|
|
422
|
+
});
|
|
423
|
+
// If updating `iconButtonCompactStyles`, also update `iconButtonCompactStylesWithRem`.
|
|
375
424
|
const iconButtonCompactStyles = xcss({
|
|
376
425
|
width: `${24 / 14}em`,
|
|
377
426
|
height: `${24 / 14}em`
|
|
378
427
|
});
|
|
428
|
+
const iconButtonCompactStylesWithRem = xcss({
|
|
429
|
+
width: '1.5rem',
|
|
430
|
+
height: '1.5rem'
|
|
431
|
+
});
|
|
379
432
|
const buttonIconBeforeStyles = xcss({
|
|
380
433
|
paddingInlineStart: 'space.100'
|
|
381
434
|
});
|
|
@@ -463,13 +516,13 @@ const useButtonBase = ({
|
|
|
463
516
|
useAutoFocus(localRef, autoFocus);
|
|
464
517
|
return {
|
|
465
518
|
ref: mergeRefs([localRef, ref]),
|
|
466
|
-
xcss: [buttonStyles, appearance === 'default' && (fg('platform-component-visual-refresh') ? defaultRefreshedStyles : defaultStyles), appearance === 'default' && isInteractive && (fg('platform-component-visual-refresh') ? defaultInteractiveRefreshedStyles : defaultInteractiveStyles), appearance === 'primary' && primaryStyles, appearance === 'primary' && isInteractive && primaryInteractiveStyles, appearance === 'warning' && warningStyles, appearance === 'warning' && isInteractive && warningInteractiveStyles, appearance === 'danger' && dangerStyles, appearance === 'danger' && isInteractive && dangerInteractiveStyles, appearance === 'discovery' && discoveryStyles, appearance === 'discovery' && isInteractive && discoveryInteractiveStyles, appearance === 'subtle' && (fg('platform-component-visual-refresh') ? subtleRefreshedStyles : subtleStyles), appearance === 'subtle' && isInteractive && (fg('platform-component-visual-refresh') ? subtleInteractiveRefreshedStyles : subtleInteractiveStyles), linkDecorationUnsetStyles, isSelected && (fg('platform-component-visual-refresh') ? selectedRefreshedStyles : selectedStyles), isSelected && isSplitButton && selectedInsideSplitButtonStyles, isSelected && isInteractive && selectedInteractiveStyles,
|
|
519
|
+
xcss: [fg('platform_dst_button_replace_em_with_rem') ? buttonStylesWithRem : buttonStyles, appearance === 'default' && (fg('platform-component-visual-refresh') ? defaultRefreshedStyles : defaultStyles), appearance === 'default' && isInteractive && (fg('platform-component-visual-refresh') ? defaultInteractiveRefreshedStyles : defaultInteractiveStyles), appearance === 'primary' && primaryStyles, appearance === 'primary' && isInteractive && primaryInteractiveStyles, appearance === 'warning' && warningStyles, appearance === 'warning' && isInteractive && warningInteractiveStyles, appearance === 'danger' && dangerStyles, appearance === 'danger' && isInteractive && dangerInteractiveStyles, appearance === 'discovery' && discoveryStyles, appearance === 'discovery' && isInteractive && discoveryInteractiveStyles, appearance === 'subtle' && (fg('platform-component-visual-refresh') ? subtleRefreshedStyles : subtleStyles), appearance === 'subtle' && isInteractive && (fg('platform-component-visual-refresh') ? subtleInteractiveRefreshedStyles : subtleInteractiveStyles), linkDecorationUnsetStyles, isSelected && (fg('platform-component-visual-refresh') ? selectedRefreshedStyles : selectedStyles), isSelected && isSplitButton && selectedInsideSplitButtonStyles, isSelected && isInteractive && selectedInteractiveStyles,
|
|
467
520
|
// TODO: remove me once we kill color fallbacks
|
|
468
521
|
isSelected && appearance === 'danger' && selectedDangerStyles,
|
|
469
522
|
// TODO: remove me once we kill color fallbacks
|
|
470
523
|
isSelected && appearance === 'warning' && selectedWarningStyles,
|
|
471
524
|
// TODO: remove me once we kill color fallbacks
|
|
472
|
-
isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, hasIconBefore && buttonIconBeforeStyles, hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading && loadingStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
|
|
525
|
+
isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && (fg('platform_dst_button_replace_em_with_rem') ? spacingCompactStylesWithRem : spacingCompactStyles), hasIconBefore && buttonIconBeforeStyles, hasIconAfter && buttonIconAfterStyles, isIconButton && (fg('platform_dst_button_replace_em_with_rem') ? iconButtonStylesWithRem : iconButtonStyles), isIconButton && spacing === 'compact' && (fg('platform_dst_button_replace_em_with_rem') ? iconButtonCompactStylesWithRem : iconButtonCompactStyles), shouldFitContainer && fullWidthStyles, isLoading && loadingStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
|
|
473
526
|
isDisabled: isEffectivelyDisabled,
|
|
474
527
|
children: /*#__PURE__*/React.createElement(SplitButtonContext.Provider, {
|
|
475
528
|
value: undefined
|
|
@@ -119,7 +119,7 @@ const ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref)
|
|
|
119
119
|
action: 'clicked',
|
|
120
120
|
componentName: 'button',
|
|
121
121
|
packageName: "@atlaskit/button",
|
|
122
|
-
packageVersion: "20.
|
|
122
|
+
packageVersion: "20.5.0",
|
|
123
123
|
analyticsData: analyticsContext
|
|
124
124
|
});
|
|
125
125
|
|
|
@@ -64,6 +64,14 @@ var dividerHeight = {
|
|
|
64
64
|
height: "".concat(24 / 14, "em")
|
|
65
65
|
})
|
|
66
66
|
};
|
|
67
|
+
var dividerHeightWithRem = {
|
|
68
|
+
default: css({
|
|
69
|
+
height: '2rem'
|
|
70
|
+
}),
|
|
71
|
+
compact: css({
|
|
72
|
+
height: '1.5rem'
|
|
73
|
+
})
|
|
74
|
+
};
|
|
67
75
|
var defaultDividerHeight = {
|
|
68
76
|
// The divider height is calculated by subtracting twice the border width from the button height.
|
|
69
77
|
// This ensures the divider does not intersect with the button's border, avoiding visual issues
|
|
@@ -75,6 +83,17 @@ var defaultDividerHeight = {
|
|
|
75
83
|
height: "calc(".concat(24 / 14, "em - ", "var(--ds-border-width, 1px)", " - ", "var(--ds-border-width, 1px)", ")")
|
|
76
84
|
})
|
|
77
85
|
};
|
|
86
|
+
var defaultDividerHeightWithRem = {
|
|
87
|
+
// The divider height is calculated by subtracting twice the border width from the button height.
|
|
88
|
+
// This ensures the divider does not intersect with the button's border, avoiding visual issues
|
|
89
|
+
// caused by overlapping alpha colors (color.border) at the intersection.
|
|
90
|
+
default: css({
|
|
91
|
+
height: "calc(2rem - ".concat("var(--ds-border-width, 1px)", " - ", "var(--ds-border-width, 1px)", ")")
|
|
92
|
+
}),
|
|
93
|
+
compact: css({
|
|
94
|
+
height: "calc(1.5rem - ".concat("var(--ds-border-width, 1px)", " - ", "var(--ds-border-width, 1px)", ")")
|
|
95
|
+
})
|
|
96
|
+
};
|
|
78
97
|
/**
|
|
79
98
|
* TODO: Add JSDoc
|
|
80
99
|
*/
|
|
@@ -83,10 +102,13 @@ export var Divider = function Divider(_ref) {
|
|
|
83
102
|
spacing = _ref.spacing,
|
|
84
103
|
_ref$isDisabled = _ref.isDisabled,
|
|
85
104
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
|
|
105
|
+
// Pulling these out of the below `css` prop to avoid nested ternaries
|
|
106
|
+
var defaultDividerHeightStyles = fg('platform_dst_button_replace_em_with_rem') ? defaultDividerHeightWithRem : defaultDividerHeight;
|
|
107
|
+
var dividerHeightStyles = fg('platform_dst_button_replace_em_with_rem') ? dividerHeightWithRem : dividerHeight;
|
|
86
108
|
return (
|
|
87
109
|
// I find it funny to provide a div for Divider
|
|
88
110
|
jsx("div", {
|
|
89
|
-
css: [baseDividerStyles, appearance === 'default' && !isDisabled && fg('platform-component-visual-refresh') ?
|
|
111
|
+
css: [baseDividerStyles, appearance === 'default' && !isDisabled && fg('platform-component-visual-refresh') ? defaultDividerHeightStyles[spacing] : dividerHeightStyles[spacing], isDisabled && (fg('platform-component-visual-refresh') ? dividerDisabledRefreshedStyles : dividerDisabledStyles), !isDisabled && (fg('platform-component-visual-refresh') ? dividerRefreshedAppearance[appearance] : dividerAppearance[appearance]), fg('platform-component-visual-refresh') && dividerRefreshedOffsetStyles]
|
|
90
112
|
})
|
|
91
113
|
);
|
|
92
114
|
};
|
|
@@ -13,6 +13,7 @@ import { SplitButtonContext, useSplitButtonContext } from '../../containers/spli
|
|
|
13
13
|
import blockEvents from './block-events';
|
|
14
14
|
import { LOADING_LABEL } from './constants';
|
|
15
15
|
import renderLoadingOverlay from './loading-overlay';
|
|
16
|
+
// If updating `buttonStyles`, also update `buttonStylesWithRem`.
|
|
16
17
|
var buttonStyles = xcss({
|
|
17
18
|
display: 'inline-flex',
|
|
18
19
|
boxSizing: 'border-box',
|
|
@@ -43,6 +44,36 @@ var buttonStyles = xcss({
|
|
|
43
44
|
position: 'absolute'
|
|
44
45
|
}
|
|
45
46
|
});
|
|
47
|
+
var buttonStylesWithRem = xcss({
|
|
48
|
+
display: 'inline-flex',
|
|
49
|
+
boxSizing: 'border-box',
|
|
50
|
+
width: 'auto',
|
|
51
|
+
maxWidth: '100%',
|
|
52
|
+
position: 'relative',
|
|
53
|
+
alignItems: 'baseline',
|
|
54
|
+
justifyContent: 'center',
|
|
55
|
+
columnGap: 'space.050',
|
|
56
|
+
borderRadius: 'border.radius.100',
|
|
57
|
+
borderWidth: 'border.width.0',
|
|
58
|
+
flexShrink: 0,
|
|
59
|
+
height: '2rem',
|
|
60
|
+
font: 'font.body',
|
|
61
|
+
fontWeight: 'font.weight.medium',
|
|
62
|
+
paddingBlock: 'space.075',
|
|
63
|
+
paddingInlineEnd: 'space.150',
|
|
64
|
+
paddingInlineStart: 'space.150',
|
|
65
|
+
textAlign: 'center',
|
|
66
|
+
transition: 'background 0.1s ease-out',
|
|
67
|
+
verticalAlign: 'middle',
|
|
68
|
+
'::after': {
|
|
69
|
+
borderRadius: 'inherit',
|
|
70
|
+
inset: 'space.0',
|
|
71
|
+
borderStyle: 'solid',
|
|
72
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
73
|
+
pointerEvents: 'none',
|
|
74
|
+
position: 'absolute'
|
|
75
|
+
}
|
|
76
|
+
});
|
|
46
77
|
var defaultInteractiveStyles = xcss({
|
|
47
78
|
':hover': {
|
|
48
79
|
background: "var(--ds-background-neutral-hovered, #091e4214)",
|
|
@@ -352,6 +383,8 @@ var selectedDiscoveryStyles = xcss({
|
|
|
352
383
|
background: "var(--ds-background-selected, #403294)"
|
|
353
384
|
}
|
|
354
385
|
});
|
|
386
|
+
|
|
387
|
+
// If updating `spacingCompactStyles`, also update `spacingCompactStylesWithRem`.
|
|
355
388
|
var spacingCompactStyles = xcss({
|
|
356
389
|
columnGap: 'space.050',
|
|
357
390
|
height: "".concat(24 / 14, "em"),
|
|
@@ -360,6 +393,14 @@ var spacingCompactStyles = xcss({
|
|
|
360
393
|
paddingInlineStart: 'space.150',
|
|
361
394
|
verticalAlign: 'middle'
|
|
362
395
|
});
|
|
396
|
+
var spacingCompactStylesWithRem = xcss({
|
|
397
|
+
columnGap: 'space.050',
|
|
398
|
+
height: '1.5rem',
|
|
399
|
+
paddingBlock: 'space.025',
|
|
400
|
+
paddingInlineEnd: 'space.150',
|
|
401
|
+
paddingInlineStart: 'space.150',
|
|
402
|
+
verticalAlign: 'middle'
|
|
403
|
+
});
|
|
363
404
|
var circleStyles = xcss({
|
|
364
405
|
borderRadius: 'border.radius.circle'
|
|
365
406
|
});
|
|
@@ -369,16 +410,28 @@ var fullWidthStyles = xcss({
|
|
|
369
410
|
var loadingStyles = xcss({
|
|
370
411
|
cursor: 'progress'
|
|
371
412
|
});
|
|
413
|
+
// If updating `iconButtonStyles`, also update `iconButtonStylesWithRem`.
|
|
372
414
|
var iconButtonStyles = xcss({
|
|
373
415
|
height: "".concat(32 / 14, "em"),
|
|
374
416
|
width: "".concat(32 / 14, "em"),
|
|
375
417
|
paddingInlineEnd: 'space.0',
|
|
376
418
|
paddingInlineStart: 'space.0'
|
|
377
419
|
});
|
|
420
|
+
var iconButtonStylesWithRem = xcss({
|
|
421
|
+
height: '2rem',
|
|
422
|
+
width: '2rem',
|
|
423
|
+
paddingInlineEnd: 'space.0',
|
|
424
|
+
paddingInlineStart: 'space.0'
|
|
425
|
+
});
|
|
426
|
+
// If updating `iconButtonCompactStyles`, also update `iconButtonCompactStylesWithRem`.
|
|
378
427
|
var iconButtonCompactStyles = xcss({
|
|
379
428
|
width: "".concat(24 / 14, "em"),
|
|
380
429
|
height: "".concat(24 / 14, "em")
|
|
381
430
|
});
|
|
431
|
+
var iconButtonCompactStylesWithRem = xcss({
|
|
432
|
+
width: '1.5rem',
|
|
433
|
+
height: '1.5rem'
|
|
434
|
+
});
|
|
382
435
|
var buttonIconBeforeStyles = xcss({
|
|
383
436
|
paddingInlineStart: 'space.100'
|
|
384
437
|
});
|
|
@@ -474,13 +527,13 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
474
527
|
useAutoFocus(localRef, autoFocus);
|
|
475
528
|
return _objectSpread({
|
|
476
529
|
ref: mergeRefs([localRef, ref]),
|
|
477
|
-
xcss: [buttonStyles, appearance === 'default' && (fg('platform-component-visual-refresh') ? defaultRefreshedStyles : defaultStyles), appearance === 'default' && isInteractive && (fg('platform-component-visual-refresh') ? defaultInteractiveRefreshedStyles : defaultInteractiveStyles), appearance === 'primary' && primaryStyles, appearance === 'primary' && isInteractive && primaryInteractiveStyles, appearance === 'warning' && warningStyles, appearance === 'warning' && isInteractive && warningInteractiveStyles, appearance === 'danger' && dangerStyles, appearance === 'danger' && isInteractive && dangerInteractiveStyles, appearance === 'discovery' && discoveryStyles, appearance === 'discovery' && isInteractive && discoveryInteractiveStyles, appearance === 'subtle' && (fg('platform-component-visual-refresh') ? subtleRefreshedStyles : subtleStyles), appearance === 'subtle' && isInteractive && (fg('platform-component-visual-refresh') ? subtleInteractiveRefreshedStyles : subtleInteractiveStyles), linkDecorationUnsetStyles, isSelected && (fg('platform-component-visual-refresh') ? selectedRefreshedStyles : selectedStyles), isSelected && isSplitButton && selectedInsideSplitButtonStyles, isSelected && isInteractive && selectedInteractiveStyles,
|
|
530
|
+
xcss: [fg('platform_dst_button_replace_em_with_rem') ? buttonStylesWithRem : buttonStyles, appearance === 'default' && (fg('platform-component-visual-refresh') ? defaultRefreshedStyles : defaultStyles), appearance === 'default' && isInteractive && (fg('platform-component-visual-refresh') ? defaultInteractiveRefreshedStyles : defaultInteractiveStyles), appearance === 'primary' && primaryStyles, appearance === 'primary' && isInteractive && primaryInteractiveStyles, appearance === 'warning' && warningStyles, appearance === 'warning' && isInteractive && warningInteractiveStyles, appearance === 'danger' && dangerStyles, appearance === 'danger' && isInteractive && dangerInteractiveStyles, appearance === 'discovery' && discoveryStyles, appearance === 'discovery' && isInteractive && discoveryInteractiveStyles, appearance === 'subtle' && (fg('platform-component-visual-refresh') ? subtleRefreshedStyles : subtleStyles), appearance === 'subtle' && isInteractive && (fg('platform-component-visual-refresh') ? subtleInteractiveRefreshedStyles : subtleInteractiveStyles), linkDecorationUnsetStyles, isSelected && (fg('platform-component-visual-refresh') ? selectedRefreshedStyles : selectedStyles), isSelected && isSplitButton && selectedInsideSplitButtonStyles, isSelected && isInteractive && selectedInteractiveStyles,
|
|
478
531
|
// TODO: remove me once we kill color fallbacks
|
|
479
532
|
isSelected && appearance === 'danger' && selectedDangerStyles,
|
|
480
533
|
// TODO: remove me once we kill color fallbacks
|
|
481
534
|
isSelected && appearance === 'warning' && selectedWarningStyles,
|
|
482
535
|
// TODO: remove me once we kill color fallbacks
|
|
483
|
-
isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, hasIconBefore && buttonIconBeforeStyles, hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading && loadingStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
|
|
536
|
+
isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && (fg('platform_dst_button_replace_em_with_rem') ? spacingCompactStylesWithRem : spacingCompactStyles), hasIconBefore && buttonIconBeforeStyles, hasIconAfter && buttonIconAfterStyles, isIconButton && (fg('platform_dst_button_replace_em_with_rem') ? iconButtonStylesWithRem : iconButtonStyles), isIconButton && spacing === 'compact' && (fg('platform_dst_button_replace_em_with_rem') ? iconButtonCompactStylesWithRem : iconButtonCompactStyles), shouldFitContainer && fullWidthStyles, isLoading && loadingStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
|
|
484
537
|
isDisabled: isEffectivelyDisabled,
|
|
485
538
|
children: /*#__PURE__*/React.createElement(SplitButtonContext.Provider, {
|
|
486
539
|
value: undefined
|
|
@@ -125,7 +125,7 @@ var ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
125
125
|
action: 'clicked',
|
|
126
126
|
componentName: 'button',
|
|
127
127
|
packageName: "@atlaskit/button",
|
|
128
|
-
packageVersion: "20.
|
|
128
|
+
packageVersion: "20.5.0",
|
|
129
129
|
analyticsData: analyticsContext
|
|
130
130
|
});
|
|
131
131
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
export declare const getActions: (children: ReactNode) => {
|
|
3
|
-
PrimaryAction: string | number | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> |
|
|
4
|
-
SecondaryAction: string | number | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> |
|
|
3
|
+
PrimaryAction: string | number | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | import("react").ReactPortal;
|
|
4
|
+
SecondaryAction: string | number | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | import("react").ReactPortal;
|
|
5
5
|
};
|