@atlaskit/button 16.1.2 → 16.1.6
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 +28 -0
- package/dist/cjs/button.js +10 -15
- package/dist/cjs/custom-theme-button/custom-theme-button.js +5 -3
- package/dist/cjs/custom-theme-button/index.js +4 -4
- package/dist/cjs/custom-theme-button/theme.js +4 -4
- package/dist/cjs/entry-points/custom-theme-button.js +4 -4
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/loading-button.js +3 -1
- package/dist/cjs/shared/button-base.js +22 -4
- package/dist/cjs/shared/colors.js +160 -162
- package/dist/cjs/shared/css.js +4 -4
- package/dist/cjs/shared/loading-spinner.js +3 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/button.js +5 -13
- package/dist/es2019/shared/button-base.js +18 -2
- package/dist/es2019/shared/colors.js +160 -161
- package/dist/es2019/version.json +1 -1
- package/dist/esm/button.js +8 -14
- package/dist/esm/custom-theme-button/custom-theme-button.js +4 -3
- package/dist/esm/custom-theme-button/theme.js +2 -2
- package/dist/esm/loading-button.js +2 -1
- package/dist/esm/shared/button-base.js +20 -3
- package/dist/esm/shared/colors.js +160 -161
- package/dist/esm/shared/css.js +2 -2
- package/dist/esm/shared/loading-spinner.js +2 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/shared/loading-spinner.d.ts +1 -0
- package/package.json +8 -7
|
@@ -2,10 +2,11 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["appearance", "autoFocus", "isDisabled", "isSelected", "shouldFitContainer", "spacing", "isLoading", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "theme"];
|
|
5
6
|
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
8
|
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
9
|
+
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; }
|
|
9
10
|
|
|
10
11
|
import React, { useCallback, useState } from 'react';
|
|
11
12
|
import GlobalTheme from '@atlaskit/theme/components';
|
|
@@ -84,7 +85,7 @@ var CustomThemeButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(f
|
|
|
84
85
|
providedOnBlur = _ref2.onBlur,
|
|
85
86
|
_ref2$theme = _ref2.theme,
|
|
86
87
|
theme = _ref2$theme === void 0 ? defaultThemeFn : _ref2$theme,
|
|
87
|
-
rest = _objectWithoutProperties(_ref2,
|
|
88
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
88
89
|
|
|
89
90
|
// TODO is there a nicer way to do this?
|
|
90
91
|
// Add default props back into object for spreading
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
4
|
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
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
7
|
import { createTheme } from '@atlaskit/theme/components';
|
|
8
8
|
import { getCss } from '../shared/css';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["isLoading"];
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import Button from './button';
|
|
5
6
|
import LoadingSpinner from './shared/loading-spinner';
|
|
6
7
|
var LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton(_ref, ref) {
|
|
7
8
|
var _ref$isLoading = _ref.isLoading,
|
|
8
9
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
9
|
-
rest = _objectWithoutProperties(_ref,
|
|
10
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
10
11
|
|
|
11
12
|
// Button already has React.memo, so just leaning on that
|
|
12
13
|
return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["appearance", "buttonCss", "spacing", "autoFocus", "isDisabled", "shouldFitContainer", "isSelected", "iconBefore", "iconAfter", "children", "className", "href", "overlay", "tabIndex", "type", "onMouseDown", "onClick", "component", "testId", "analyticsContext"];
|
|
3
4
|
|
|
4
5
|
/** @jsx jsx */
|
|
5
6
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
6
7
|
import { jsx } from '@emotion/core';
|
|
7
8
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
8
9
|
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
10
|
+
import { N500 } from '@atlaskit/theme/colors';
|
|
9
11
|
import blockEvents from './block-events';
|
|
10
12
|
import { getContentStyle, getFadingCss, getIconStyle, overlayCss } from './css';
|
|
11
13
|
|
|
@@ -52,7 +54,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
52
54
|
Component = _props$component === void 0 ? href ? 'a' : 'button' : _props$component,
|
|
53
55
|
testId = props.testId,
|
|
54
56
|
analyticsContext = props.analyticsContext,
|
|
55
|
-
rest = _objectWithoutProperties(props,
|
|
57
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
56
58
|
|
|
57
59
|
var ourRef = useRef();
|
|
58
60
|
var setRef = useCallback(function (node) {
|
|
@@ -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.
|
|
82
|
+
packageVersion: "16.1.6",
|
|
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 ? "var(--ds-text-subtle, ".concat(N500, ")") : "var(--ds-text-warning-inverse, ".concat(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
|
});
|