@atlaskit/button 17.12.0 → 17.12.2

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.
Files changed (25) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/new-button/containers/split-button/split-button.js +9 -3
  3. package/dist/cjs/new-button/variants/shared/use-button-base.js +332 -46
  4. package/dist/cjs/old-button/shared/button-base.js +1 -1
  5. package/dist/es2019/new-button/containers/split-button/split-button.js +7 -1
  6. package/dist/es2019/new-button/variants/shared/use-button-base.js +333 -45
  7. package/dist/es2019/old-button/shared/button-base.js +1 -1
  8. package/dist/esm/new-button/containers/split-button/split-button.js +7 -1
  9. package/dist/esm/new-button/variants/shared/use-button-base.js +333 -47
  10. package/dist/esm/old-button/shared/button-base.js +1 -1
  11. package/dist/types/new-button/variants/shared/use-button-base.d.ts +3 -2
  12. package/dist/types/old-button/custom-theme-button/theme.d.ts +2 -6
  13. package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +3 -2
  14. package/dist/types-ts4.5/old-button/custom-theme-button/theme.d.ts +2 -6
  15. package/package.json +4 -2
  16. package/dist/cjs/new-button/variants/shared/colors.js +0 -145
  17. package/dist/cjs/new-button/variants/shared/xcss.js +0 -198
  18. package/dist/es2019/new-button/variants/shared/colors.js +0 -136
  19. package/dist/es2019/new-button/variants/shared/xcss.js +0 -196
  20. package/dist/esm/new-button/variants/shared/colors.js +0 -136
  21. package/dist/esm/new-button/variants/shared/xcss.js +0 -190
  22. package/dist/types/new-button/variants/shared/colors.d.ts +0 -20
  23. package/dist/types/new-button/variants/shared/xcss.d.ts +0 -33
  24. package/dist/types-ts4.5/new-button/variants/shared/colors.d.ts +0 -20
  25. package/dist/types-ts4.5/new-button/variants/shared/xcss.d.ts +0 -33
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/button
2
2
 
3
+ ## 17.12.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#91492](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91492) [`0af5682714ea`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0af5682714ea) - Refactors internal styling logic of the new button to align to our upcoming styling standards.
8
+
9
+ ## 17.12.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#90619](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90619) [`acbd9680ed68`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/acbd9680ed68) - Replaces internal ref merge with one from our util set
14
+
3
15
  ## 17.12.0
4
16
 
5
17
  ### Minor Changes
@@ -5,11 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SplitButtonWithSlots = exports.SplitButtonContainer = exports.SplitButton = exports.Divider = void 0;
7
7
  var _react = require("@emotion/react");
8
- var _xcss = require("../../variants/shared/xcss");
8
+ var _constants = require("@atlaskit/theme/constants");
9
9
  var _splitButtonContext = require("./split-button-context");
10
10
  var _utils = require("./utils");
11
11
  /** @jsx jsx */
12
12
 
13
+ var fontSize = (0, _constants.fontSize)();
14
+ var heights = {
15
+ default: "".concat(32 / fontSize, "em"),
16
+ compact: "".concat(24 / fontSize, "em"),
17
+ none: 'auto'
18
+ };
13
19
  var baseDividerStyles = (0, _react.css)({
14
20
  display: 'inline-flex',
15
21
  width: '1px',
@@ -17,10 +23,10 @@ var baseDividerStyles = (0, _react.css)({
17
23
  zIndex: 2
18
24
  });
19
25
  var defaultDividerStyles = (0, _react.css)({
20
- height: _xcss.heights.default
26
+ height: heights.default
21
27
  });
22
28
  var compactDividerStyles = (0, _react.css)({
23
- height: _xcss.heights.compact
29
+ height: heights.compact
24
30
  });
25
31
  var dividerDisabledStyles = (0, _react.css)({
26
32
  backgroundColor: "var(--ds-text-disabled, #091E4224)",
@@ -8,24 +8,340 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.default = void 0;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
+ var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
11
12
  var _useAutoFocus = _interopRequireDefault(require("@atlaskit/ds-lib/use-auto-focus"));
12
13
  var _primitives = require("@atlaskit/primitives");
14
+ var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
15
+ var _constants = require("@atlaskit/theme/constants");
13
16
  var _splitButtonContext = require("../../containers/split-button/split-button-context");
14
17
  var _blockEvents = _interopRequireDefault(require("./block-events"));
15
- var _xcss = require("./xcss");
16
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
17
19
  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 && Object.prototype.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; }
18
20
  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; }
19
21
  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; }
22
+ var fontSize = (0, _constants.fontSize)();
23
+ var buttonStyles = (0, _primitives.xcss)({
24
+ display: 'inline-flex',
25
+ boxSizing: 'border-box',
26
+ width: 'auto',
27
+ maxWidth: '100%',
28
+ position: 'relative',
29
+ alignItems: 'baseline',
30
+ justifyContent: 'center',
31
+ columnGap: 'space.050',
32
+ background: "var(--ds-background-neutral, ".concat(colors.N20A, ")"),
33
+ borderRadius: 'border.radius.100',
34
+ borderWidth: 'border.width.0',
35
+ // @ts-expect-error
36
+ color: "var(--ds-text, ".concat(colors.N500, ")"),
37
+ fontFamily: 'inherit',
38
+ fontSize: 'inherit',
39
+ fontStyle: 'normal',
40
+ fontWeight: 500,
41
+ height: "".concat(32 / fontSize, "em"),
42
+ lineHeight: "".concat(32 / fontSize, "em"),
43
+ paddingBlock: 'space.0',
44
+ paddingInlineEnd: 'space.150',
45
+ paddingInlineStart: 'space.150',
46
+ textAlign: 'center',
47
+ transition: 'background 0.1s ease-out, box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38)',
48
+ verticalAlign: 'middle',
49
+ whiteSpace: 'nowrap',
50
+ ':visited': {
51
+ // @ts-expect-error
52
+ color: "var(--ds-text, ".concat(colors.N500, ")")
53
+ }
54
+ });
55
+ var defaultInteractiveStyles = (0, _primitives.xcss)({
56
+ ':hover': {
57
+ background: "var(--ds-background-neutral-hovered, #091e4214)",
58
+ // @ts-expect-error
59
+ color: "var(--ds-text, ".concat(colors.N500, ")"),
60
+ transitionDuration: '0s, 0.15s'
61
+ },
62
+ ':active': {
63
+ background: "var(--ds-background-neutral-pressed, ".concat(colors.B75, ")"),
64
+ // @ts-expect-error
65
+ color: "var(--ds-text, ".concat(colors.B400, ")"),
66
+ transitionDuration: '0s, 0s'
67
+ }
68
+ });
69
+ var primaryStyles = (0, _primitives.xcss)({
70
+ background: "var(--ds-background-brand-bold, #0052CC)",
71
+ // @ts-expect-error
72
+ color: "var(--ds-text-inverse, #FFFFFF)",
73
+ ':visited': {
74
+ // @ts-expect-error
75
+ color: "var(--ds-text-inverse, #FFFFFF)"
76
+ }
77
+ });
78
+ var primaryInteractiveStyles = (0, _primitives.xcss)({
79
+ ':hover': {
80
+ // @ts-expect-error
81
+ color: "var(--ds-text-inverse, #FFFFFF)",
82
+ background: "var(--ds-background-brand-bold-hovered, #0065FF)"
83
+ },
84
+ ':active': {
85
+ // @ts-expect-error
86
+ color: "var(--ds-text-inverse, #FFFFFF)",
87
+ background: "var(--ds-background-brand-bold-pressed, #0747A6)"
88
+ }
89
+ });
90
+ var warningStyles = (0, _primitives.xcss)({
91
+ background: "var(--ds-background-warning-bold, #FFAB00)",
92
+ // @ts-expect-error
93
+ color: "var(--ds-text-warning-inverse, #172B4D)",
94
+ ':visited': {
95
+ // @ts-expect-error
96
+ color: "var(--ds-text-warning-inverse, #172B4D)"
97
+ }
98
+ });
99
+ var warningInteractiveStyles = (0, _primitives.xcss)({
100
+ ':hover': {
101
+ // @ts-expect-error
102
+ color: "var(--ds-text-warning-inverse, #172B4D)",
103
+ background: "var(--ds-background-warning-bold-hovered, #FFC400)"
104
+ },
105
+ ':active': {
106
+ // @ts-expect-error
107
+ color: "var(--ds-text-warning-inverse, #172B4D)",
108
+ background: "var(--ds-background-warning-bold-pressed, #FF991F)"
109
+ }
110
+ });
111
+ var dangerStyles = (0, _primitives.xcss)({
112
+ background: "var(--ds-background-danger-bold, #DE350B)",
113
+ color: 'color.text.inverse',
114
+ ':visited': {
115
+ color: 'color.text.inverse'
116
+ }
117
+ });
118
+ var dangerInteractiveStyles = (0, _primitives.xcss)({
119
+ ':hover': {
120
+ color: 'color.text.inverse',
121
+ background: "var(--ds-background-danger-bold-hovered, #FF5630)"
122
+ },
123
+ ':active': {
124
+ color: 'color.text.inverse',
125
+ background: "var(--ds-background-danger-bold-pressed, #BF2600)"
126
+ }
127
+ });
128
+ var subtleStyles = (0, _primitives.xcss)({
129
+ background: "var(--ds-background-neutral-subtle, transparent)",
130
+ // @ts-expect-error
131
+ color: "var(--ds-text, #42526E)",
132
+ ':visited': {
133
+ // @ts-expect-error
134
+ color: "var(--ds-text, #42526E)"
135
+ }
136
+ });
137
+ var subtleInteractiveStyles = (0, _primitives.xcss)({
138
+ ':hover': {
139
+ background: "var(--ds-background-neutral-subtle-hovered, #091e4214)",
140
+ // @ts-expect-error
141
+ color: "var(--ds-text, #42526E)"
142
+ },
143
+ ':active': {
144
+ background: "var(--ds-background-neutral-subtle-pressed, #B3D4FF)",
145
+ // @ts-expect-error
146
+ color: "var(--ds-text, #42526E)"
147
+ }
148
+ });
149
+ var linkStyles = (0, _primitives.xcss)({
150
+ // @ts-expect-error
151
+ color: "var(--ds-link, ".concat(colors.B400, ")"),
152
+ background: "var(--ds-background-neutral-subtle, transparent)",
153
+ textDecoration: 'none',
154
+ ':hover': {
155
+ // @ts-expect-error
156
+ color: "var(--ds-link, ".concat(colors.B300, ")"),
157
+ background: "var(--ds-background-neutral-subtle, transparent)"
158
+ },
159
+ ':active': {
160
+ // @ts-expect-error
161
+ color: "var(--ds-link-pressed, #0055CC)",
162
+ background: "var(--ds-background-neutral-subtle, transparent)"
163
+ },
164
+ ':visited': {
165
+ // @ts-expect-error
166
+ color: "var(--ds-link, ".concat(colors.B400, ")")
167
+ }
168
+ });
169
+ var subtleLinkStyles = (0, _primitives.xcss)({
170
+ // @ts-expect-error
171
+ color: "var(--ds-text-subtle, ".concat(colors.N200, ")"),
172
+ background: "var(--ds-background-neutral-subtle, transparent)",
173
+ textDecoration: 'none',
174
+ ':hover': {
175
+ // @ts-expect-error
176
+ color: "var(--ds-text-subtle, ".concat(colors.N90, ")"),
177
+ background: "var(--ds-background-neutral-subtle, transparent)"
178
+ },
179
+ ':active': {
180
+ // @ts-expect-error
181
+ color: "var(--ds-text, ".concat(colors.N400, ")"),
182
+ background: "var(--ds-background-neutral-subtle, transparent)"
183
+ },
184
+ ':visited': {
185
+ // @ts-expect-error
186
+ color: "var(--ds-text-subtle, ".concat(colors.N200, ")")
187
+ }
188
+ });
189
+
190
+ // Required due to Jira's AUI CSS reset: https://product-fabric.atlassian.net/browse/DSP-15687
191
+ var linkDecorationUnsetStyles = (0, _primitives.xcss)({
192
+ textDecoration: 'none',
193
+ ':hover': {
194
+ textDecoration: 'none'
195
+ },
196
+ ':active': {
197
+ textDecoration: 'none'
198
+ },
199
+ ':focus': {
200
+ textDecoration: 'none'
201
+ }
202
+ });
203
+ var linkDecorationStyles = (0, _primitives.xcss)({
204
+ ':hover': {
205
+ textDecoration: 'underline'
206
+ },
207
+ ':focus': {
208
+ textDecoration: 'underline'
209
+ }
210
+ });
211
+ var disabledStyles = (0, _primitives.xcss)({
212
+ background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
213
+ // @ts-expect-error
214
+ color: "var(--ds-text-disabled, #091E424F)",
215
+ ':hover': {
216
+ background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
217
+ // @ts-expect-error
218
+ color: "var(--ds-text-disabled, #091E424F)"
219
+ },
220
+ ':active': {
221
+ background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
222
+ // @ts-expect-error
223
+ color: "var(--ds-text-disabled, #091E424F)"
224
+ }
225
+ });
226
+ var selectedStyles = (0, _primitives.xcss)({
227
+ background: "var(--ds-background-selected, ".concat(colors.N700, ")"),
228
+ // @ts-expect-error
229
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
230
+ ':visited': {
231
+ // @ts-expect-error
232
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")")
233
+ }
234
+ });
235
+ var selectedInteractiveStyles = (0, _primitives.xcss)({
236
+ ':hover': {
237
+ // @ts-expect-error
238
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
239
+ background: "var(--ds-background-selected-hovered, ".concat(colors.N700, ")")
240
+ },
241
+ ':active': {
242
+ // @ts-expect-error
243
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
244
+ background: "var(--ds-background-selected-pressed, ".concat(colors.N700, ")")
245
+ }
246
+ });
247
+
248
+ // TODO: Remove me once we kill color fallbacks
249
+ var selectedWarningStyles = (0, _primitives.xcss)({
250
+ background: "var(--ds-background-selected, ".concat(colors.Y400, ")"),
251
+ // @ts-expect-error
252
+ color: "var(--ds-text-selected, ".concat(colors.N800, ")"),
253
+ ':hover': {
254
+ // @ts-expect-error
255
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
256
+ background: "var(--ds-background-selected, ".concat(colors.Y400, ")")
257
+ },
258
+ ':active': {
259
+ // @ts-expect-error
260
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
261
+ background: "var(--ds-background-selected, ".concat(colors.Y400, ")")
262
+ }
263
+ });
264
+
265
+ // TODO: Remove me once we kill color fallbacks
266
+ var selectedDangerStyles = (0, _primitives.xcss)({
267
+ background: "var(--ds-background-selected, ".concat(colors.R500, ")"),
268
+ // @ts-expect-error
269
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
270
+ ':hover': {
271
+ // @ts-expect-error
272
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
273
+ background: "var(--ds-background-selected, ".concat(colors.R500, ")")
274
+ },
275
+ ':active': {
276
+ // @ts-expect-error
277
+ color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
278
+ background: "var(--ds-background-selected, ".concat(colors.R500, ")")
279
+ }
280
+ });
281
+ var spacingCompactStyles = (0, _primitives.xcss)({
282
+ columnGap: 'space.050',
283
+ height: "".concat(24 / fontSize, "em"),
284
+ lineHeight: "".concat(24 / fontSize, "em"),
285
+ paddingInlineEnd: 'space.150',
286
+ paddingInlineStart: 'space.150',
287
+ verticalAlign: 'middle'
288
+ });
289
+ var spacingNoneStyles = (0, _primitives.xcss)({
290
+ columnGap: 'space.0',
291
+ height: 'auto',
292
+ lineHeight: 'inherit',
293
+ paddingInlineEnd: 'space.0',
294
+ paddingInlineStart: 'space.0',
295
+ verticalAlign: 'baseline'
296
+ });
297
+ var circleStyles = (0, _primitives.xcss)({
298
+ borderRadius: 'border.radius.circle'
299
+ });
300
+ var fullWidthStyles = (0, _primitives.xcss)({
301
+ width: '100%'
302
+ });
303
+ var loadingOverlayStyles = (0, _primitives.xcss)({
304
+ cursor: 'progress'
305
+ });
306
+ var nonInteractiveStyles = (0, _primitives.xcss)({
307
+ cursor: 'not-allowed'
308
+ });
309
+ var iconButtonStyles = (0, _primitives.xcss)({
310
+ height: "".concat(32 / fontSize, "em"),
311
+ width: "".concat(32 / fontSize, "em"),
312
+ paddingInlineEnd: 'space.0',
313
+ paddingInlineStart: 'space.0'
314
+ });
315
+ var iconButtonCompactStyles = (0, _primitives.xcss)({
316
+ width: "".concat(24 / fontSize, "em"),
317
+ height: "".concat(24 / fontSize, "em")
318
+ });
319
+ var buttonIconBeforeStyles = (0, _primitives.xcss)({
320
+ paddingInlineStart: 'space.100'
321
+ });
322
+ var buttonIconAfterStyles = (0, _primitives.xcss)({
323
+ paddingInlineEnd: 'space.100'
324
+ });
325
+ var splitButtonStyles = (0, _primitives.xcss)({
326
+ ':focus-visible': {
327
+ zIndex: 'card'
328
+ }
329
+ });
330
+ var navigationSplitButtonStyles = (0, _primitives.xcss)({
331
+ width: '24px',
332
+ backgroundColor: 'color.background.neutral.subtle',
333
+ paddingInlineEnd: 'space.075',
334
+ paddingInlineStart: 'space.075'
335
+ });
20
336
  var overlayStyles = (0, _primitives.xcss)({
337
+ display: 'flex',
21
338
  position: 'absolute',
22
- insetInlineStart: 'space.0',
339
+ alignItems: 'center',
340
+ justifyContent: 'center',
341
+ insetBlockEnd: 'space.0',
23
342
  insetBlockStart: 'space.0',
24
343
  insetInlineEnd: 'space.0',
25
- insetBlockEnd: 'space.0',
26
- display: 'flex',
27
- alignItems: 'center',
28
- justifyContent: 'center'
344
+ insetInlineStart: 'space.0'
29
345
  });
30
346
 
31
347
  /**
@@ -46,7 +362,6 @@ var useButtonBase = function useButtonBase(_ref) {
46
362
  propAppearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
47
363
  _ref$autoFocus = _ref.autoFocus,
48
364
  autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
49
- buttonType = _ref.buttonType,
50
365
  _ref$isDisabled = _ref.isDisabled,
51
366
  propIsDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
52
367
  _ref$isLoading = _ref.isLoading,
@@ -78,53 +393,24 @@ var useButtonBase = function useButtonBase(_ref) {
78
393
  shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
79
394
  _ref$spacing = _ref.spacing,
80
395
  propSpacing = _ref$spacing === void 0 ? 'default' : _ref$spacing;
81
- var ourRef = (0, _react.useRef)();
396
+ var localRef = (0, _react.useRef)(null);
82
397
  var splitButtonContext = (0, _splitButtonContext.useSplitButtonContext)();
83
398
  var isSplitButton = Boolean(splitButtonContext);
84
399
  var isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
85
400
  var appearance = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
86
401
  var spacing = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.spacing) || propSpacing;
87
402
  var isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
88
- var isHighlighted = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isHighlighted) || false;
89
- var isActiveOverSelected = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isActiveOverSelected) || false;
90
- var setRef = (0, _react.useCallback)(function (node) {
91
- ourRef.current = node;
92
- if (ref === null) {
93
- return;
94
- }
95
- if (typeof ref === 'function') {
96
- ref(node);
97
- return;
98
- }
99
-
100
- // @ts-ignore
101
- ref.current = node;
102
- }, [ourRef, ref]);
103
- (0, _useAutoFocus.default)(ourRef, autoFocus);
104
- var buttonXCSS = (0, _react.useMemo)(function () {
105
- return (0, _xcss.getXCSS)({
106
- appearance: appearance,
107
- spacing: spacing,
108
- isDisabled: isDisabled,
109
- isLoading: isLoading,
110
- isSelected: isSelected,
111
- isHighlighted: isHighlighted,
112
- isActiveOverSelected: isActiveOverSelected,
113
- shouldFitContainer: shouldFitContainer,
114
- isIconButton: isIconButton,
115
- isCircle: isCircle,
116
- hasOverlay: Boolean(overlay),
117
- isLink: buttonType === 'link',
118
- hasIconBefore: hasIconBefore,
119
- hasIconAfter: hasIconAfter,
120
- isSplit: isSplitButton,
121
- isNavigationSplit: isNavigationSplitButton
122
- });
123
- }, [appearance, buttonType, spacing, isDisabled, isLoading, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
403
+ var hasOverlay = Boolean(overlay);
404
+ var isInteractive = !isDisabled && !isLoading && !hasOverlay;
124
405
  var isEffectivelyDisabled = isDisabled || Boolean(overlay);
406
+ (0, _useAutoFocus.default)(localRef, autoFocus);
125
407
  return _objectSpread({
126
- ref: setRef,
127
- xcss: buttonXCSS,
408
+ ref: (0, _mergeRefs.default)([localRef, ref]),
409
+ xcss: [buttonStyles, appearance === 'default' && isInteractive && defaultInteractiveStyles, appearance === 'primary' && primaryStyles, appearance === 'primary' && isInteractive && primaryInteractiveStyles, appearance === 'warning' && warningStyles, appearance === 'warning' && isInteractive && warningInteractiveStyles, appearance === 'danger' && dangerStyles, appearance === 'danger' && isInteractive && dangerInteractiveStyles, appearance === 'subtle' && subtleStyles, appearance === 'subtle' && isInteractive && subtleInteractiveStyles, appearance === 'link' && linkStyles, appearance === 'subtle-link' && subtleLinkStyles, !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? linkDecorationStyles : linkDecorationUnsetStyles, isSelected && selectedStyles, isSelected && isInteractive && selectedInteractiveStyles,
410
+ // TODO: remove me once we kill color fallbacks
411
+ isSelected && appearance === 'danger' && selectedDangerStyles,
412
+ // TODO: remove me once we kill color fallbacks
413
+ isSelected && appearance === 'warning' && selectedWarningStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, spacing === 'none' && spacingNoneStyles, spacing !== 'none' && hasIconBefore && buttonIconBeforeStyles, spacing !== 'none' && hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading && loadingOverlayStyles, (isDisabled || hasOverlay && !isLoading) && nonInteractiveStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
128
414
  // Consider overlay buttons to be effectively disabled
129
415
  isDisabled: isEffectivelyDisabled,
130
416
  children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children, overlay ? /*#__PURE__*/_react.default.createElement(_primitives.Box, {
@@ -117,7 +117,7 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
117
117
  action: 'clicked',
118
118
  componentName: 'button',
119
119
  packageName: "@atlaskit/button",
120
- packageVersion: "17.12.0",
120
+ packageVersion: "17.12.2",
121
121
  analyticsData: analyticsContext
122
122
  });
123
123
 
@@ -1,7 +1,13 @@
1
1
  /** @jsx jsx */
2
2
 
3
3
  import { css, jsx } from '@emotion/react';
4
- import { heights } from '../../variants/shared/xcss';
4
+ import { fontSize as getFontSize } from '@atlaskit/theme/constants';
5
+ const fontSize = getFontSize();
6
+ const heights = {
7
+ default: `${32 / fontSize}em`,
8
+ compact: `${24 / fontSize}em`,
9
+ none: 'auto'
10
+ };
5
11
  import { SplitButtonContext } from './split-button-context';
6
12
  import { getActions } from './utils';
7
13
  const baseDividerStyles = css({