@atlaskit/button 16.1.2 → 16.1.3

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/button
2
2
 
3
+ ## 16.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c3b0a17a96c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c3b0a17a96c) - Fix spinner colours for disabled, warning and selected states when using tokens
8
+ - Updated dependencies
9
+
3
10
  ## 16.1.2
4
11
 
5
12
  ### Patch Changes
@@ -21,6 +21,10 @@ var _analyticsNext = require("@atlaskit/analytics-next");
21
21
 
22
22
  var _useAutoFocus = _interopRequireDefault(require("@atlaskit/ds-lib/use-auto-focus"));
23
23
 
24
+ var _colors = require("@atlaskit/theme/colors");
25
+
26
+ var _tokens = require("@atlaskit/tokens");
27
+
24
28
  var _blockEvents = _interopRequireDefault(require("./block-events"));
25
29
 
26
30
  var _css = require("./css");
@@ -98,7 +102,7 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
98
102
  action: 'clicked',
99
103
  componentName: 'button',
100
104
  packageName: "@atlaskit/button",
101
- packageVersion: "16.1.2",
105
+ packageVersion: "16.1.3",
102
106
  analyticsData: analyticsContext
103
107
  }); // Button currently calls preventDefault, which is not standard button behaviour
104
108
 
@@ -120,6 +124,21 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
120
124
  hasOverlay: hasOverlay
121
125
  });
122
126
  var isInteractive = !isDisabled && !hasOverlay;
127
+ /** HACK: Spinner needs to have different colours in the "new" tokens design compared to the old design.
128
+ * For now, while we support both, these styles reach into Spinner when a theme is set, applies the right color.
129
+ * Ticket to remove: https://product-fabric.atlassian.net/browse/DSP-2067
130
+ */
131
+
132
+ var spinnerHackCss = {};
133
+
134
+ if (isSelected || isDisabled || appearance === 'warning') {
135
+ spinnerHackCss = {
136
+ '[data-theme] & svg': {
137
+ stroke: isSelected || isDisabled ? (0, _tokens.token)('color.text.mediumEmphasis', _colors.N500) : (0, _tokens.token)('color.text.onBoldWarning', _colors.N500)
138
+ }
139
+ };
140
+ }
141
+
123
142
  return (0, _core.jsx)(Component, (0, _extends2.default)({}, rest, {
124
143
  css: [buttonCss, isInteractive ? null : noPointerEventsOnChildrenCss],
125
144
  className: className,
@@ -151,7 +170,7 @@ var _default = /*#__PURE__*/_react.default.forwardRef(function ButtonBase(props,
151
170
  spacing: spacing
152
171
  })]
153
172
  }, iconAfter) : null, overlay ? (0, _core.jsx)("span", {
154
- css: _css.overlayCss
173
+ css: [_css.overlayCss, spinnerHackCss]
155
174
  }, overlay) : null);
156
175
  });
157
176
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.1.2",
3
+ "version": "16.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -5,6 +5,8 @@ import React, { useCallback, useEffect, useRef } from 'react';
5
5
  import { jsx } from '@emotion/core';
6
6
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
7
7
  import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
8
+ import { N500 } from '@atlaskit/theme/colors';
9
+ import { token } from '@atlaskit/tokens';
8
10
  import blockEvents from './block-events';
9
11
  import { getContentStyle, getFadingCss, getIconStyle, overlayCss } from './css';
10
12
 
@@ -69,7 +71,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
69
71
  action: 'clicked',
70
72
  componentName: 'button',
71
73
  packageName: "@atlaskit/button",
72
- packageVersion: "16.1.2",
74
+ packageVersion: "16.1.3",
73
75
  analyticsData: analyticsContext
74
76
  }); // Button currently calls preventDefault, which is not standard button behaviour
75
77
 
@@ -91,6 +93,21 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
91
93
  hasOverlay
92
94
  });
93
95
  const isInteractive = !isDisabled && !hasOverlay;
96
+ /** HACK: Spinner needs to have different colours in the "new" tokens design compared to the old design.
97
+ * For now, while we support both, these styles reach into Spinner when a theme is set, applies the right color.
98
+ * Ticket to remove: https://product-fabric.atlassian.net/browse/DSP-2067
99
+ */
100
+
101
+ var spinnerHackCss = {};
102
+
103
+ if (isSelected || isDisabled || appearance === 'warning') {
104
+ spinnerHackCss = {
105
+ '[data-theme] & svg': {
106
+ stroke: isSelected || isDisabled ? token('color.text.mediumEmphasis', N500) : token('color.text.onBoldWarning', N500)
107
+ }
108
+ };
109
+ }
110
+
94
111
  return jsx(Component, _extends({}, rest, {
95
112
  css: [buttonCss, isInteractive ? null : noPointerEventsOnChildrenCss],
96
113
  className: className,
@@ -122,6 +139,6 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
122
139
  spacing
123
140
  })]
124
141
  }, iconAfter) : null, overlay ? jsx("span", {
125
- css: overlayCss
142
+ css: [overlayCss, spinnerHackCss]
126
143
  }, overlay) : null);
127
144
  });
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.1.2",
3
+ "version": "16.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -6,6 +6,8 @@ import React, { useCallback, useEffect, useRef } from 'react';
6
6
  import { jsx } from '@emotion/core';
7
7
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
8
8
  import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
9
+ import { N500 } from '@atlaskit/theme/colors';
10
+ import { token } from '@atlaskit/tokens';
9
11
  import blockEvents from './block-events';
10
12
  import { getContentStyle, getFadingCss, getIconStyle, overlayCss } from './css';
11
13
 
@@ -77,7 +79,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
77
79
  action: 'clicked',
78
80
  componentName: 'button',
79
81
  packageName: "@atlaskit/button",
80
- packageVersion: "16.1.2",
82
+ packageVersion: "16.1.3",
81
83
  analyticsData: analyticsContext
82
84
  }); // Button currently calls preventDefault, which is not standard button behaviour
83
85
 
@@ -99,6 +101,21 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
99
101
  hasOverlay: hasOverlay
100
102
  });
101
103
  var isInteractive = !isDisabled && !hasOverlay;
104
+ /** HACK: Spinner needs to have different colours in the "new" tokens design compared to the old design.
105
+ * For now, while we support both, these styles reach into Spinner when a theme is set, applies the right color.
106
+ * Ticket to remove: https://product-fabric.atlassian.net/browse/DSP-2067
107
+ */
108
+
109
+ var spinnerHackCss = {};
110
+
111
+ if (isSelected || isDisabled || appearance === 'warning') {
112
+ spinnerHackCss = {
113
+ '[data-theme] & svg': {
114
+ stroke: isSelected || isDisabled ? token('color.text.mediumEmphasis', N500) : token('color.text.onBoldWarning', N500)
115
+ }
116
+ };
117
+ }
118
+
102
119
  return jsx(Component, _extends({}, rest, {
103
120
  css: [buttonCss, isInteractive ? null : noPointerEventsOnChildrenCss],
104
121
  className: className,
@@ -130,6 +147,6 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
130
147
  spacing: spacing
131
148
  })]
132
149
  }, iconAfter) : null, overlay ? jsx("span", {
133
- css: overlayCss
150
+ css: [overlayCss, spinnerHackCss]
134
151
  }, overlay) : null);
135
152
  });
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.1.2",
3
+ "version": "16.1.3",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.1.2",
3
+ "version": "16.1.3",
4
4
  "description": "A button triggers an event or action. They let users know what will happen next.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/ds-lib": "^1.3.0",
36
36
  "@atlaskit/spinner": "^15.1.0",
37
37
  "@atlaskit/theme": "^12.0.0",
38
- "@atlaskit/tokens": "^0.2.0",
38
+ "@atlaskit/tokens": "^0.3.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "@emotion/core": "^10.0.9"
41
41
  },