@atlaskit/button 17.7.2 → 17.9.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 +12 -0
- package/dist/cjs/entry-points/standard-button.js +0 -1
- package/dist/cjs/new-button/variants/default/button.js +3 -1
- package/dist/cjs/new-button/variants/default/use-default-button.js +10 -2
- package/dist/cjs/new-button/variants/icon/button.js +3 -1
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +9 -2
- package/dist/cjs/new-button/variants/shared/colors.js +44 -36
- package/dist/cjs/new-button/variants/shared/loading-overlay.js +49 -0
- package/dist/cjs/new-button/variants/shared/xcss.js +7 -5
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/entry-points/standard-button.js +0 -5
- package/dist/es2019/new-button/variants/default/button.js +2 -0
- package/dist/es2019/new-button/variants/default/use-default-button.js +9 -2
- package/dist/es2019/new-button/variants/icon/button.js +2 -0
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +9 -2
- package/dist/es2019/new-button/variants/shared/colors.js +44 -36
- package/dist/es2019/new-button/variants/shared/loading-overlay.js +44 -0
- package/dist/es2019/new-button/variants/shared/xcss.js +7 -5
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/entry-points/standard-button.js +0 -5
- package/dist/esm/new-button/variants/default/button.js +3 -1
- package/dist/esm/new-button/variants/default/use-default-button.js +10 -2
- package/dist/esm/new-button/variants/icon/button.js +3 -1
- package/dist/esm/new-button/variants/icon/use-icon-button.js +9 -2
- package/dist/esm/new-button/variants/shared/colors.js +44 -36
- package/dist/esm/new-button/variants/shared/loading-overlay.js +42 -0
- package/dist/esm/new-button/variants/shared/xcss.js +7 -5
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/entry-points/standard-button.d.ts +0 -5
- package/dist/types/new-button/variants/default/types.d.ts +4 -0
- package/dist/types/new-button/variants/default/use-default-button.d.ts +1 -1
- package/dist/types/new-button/variants/icon/types.d.ts +4 -0
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +1 -1
- package/dist/types/new-button/variants/shared/colors.d.ts +5 -3
- package/dist/types/new-button/variants/shared/loading-overlay.d.ts +8 -0
- package/dist/types-ts4.5/entry-points/standard-button.d.ts +0 -5
- package/dist/types-ts4.5/new-button/variants/default/types.d.ts +4 -0
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +4 -0
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/shared/colors.d.ts +5 -3
- package/dist/types-ts4.5/new-button/variants/shared/loading-overlay.d.ts +8 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 17.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#87334](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87334) [`b779928f2d49`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b779928f2d49) - [ux] New buttons now have hovered and pressed interaction states when they are selected (`isSelected`)
|
|
8
|
+
|
|
9
|
+
## 17.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#85228](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/85228) [`9564de632638`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9564de632638) - Introduces isLoading prop to the new Button and IconButton components. When set to true a traditional loading spinner will be shown.
|
|
14
|
+
|
|
3
15
|
## 17.7.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
|
|
12
12
|
var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
|
|
13
|
-
var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "iconBefore", "UNSAFE_iconAfter_size", "iconAfter", "UNSAFE_iconBefore_size", "children", "shouldFitContainer", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "type", "testId"];
|
|
13
|
+
var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "iconBefore", "isLoading", "UNSAFE_iconAfter_size", "iconAfter", "UNSAFE_iconBefore_size", "children", "shouldFitContainer", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "type", "testId"];
|
|
14
14
|
/**
|
|
15
15
|
* __Button__
|
|
16
16
|
*
|
|
@@ -29,6 +29,7 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
29
29
|
isDisabled = _ref.isDisabled,
|
|
30
30
|
isSelected = _ref.isSelected,
|
|
31
31
|
iconBefore = _ref.iconBefore,
|
|
32
|
+
isLoading = _ref.isLoading,
|
|
32
33
|
UNSAFE_iconAfter_size = _ref.UNSAFE_iconAfter_size,
|
|
33
34
|
iconAfter = _ref.iconAfter,
|
|
34
35
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
|
|
@@ -62,6 +63,7 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
62
63
|
interactionName: interactionName,
|
|
63
64
|
isDisabled: isDisabled,
|
|
64
65
|
isSelected: isSelected,
|
|
66
|
+
isLoading: isLoading,
|
|
65
67
|
onClick: onClick,
|
|
66
68
|
onMouseDownCapture: onMouseDownCapture,
|
|
67
69
|
onMouseUpCapture: onMouseUpCapture,
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _content = _interopRequireDefault(require("../shared/content"));
|
|
11
|
+
var _loadingOverlay = _interopRequireDefault(require("../shared/loading-overlay"));
|
|
11
12
|
var _useButtonBase = _interopRequireDefault(require("../shared/use-button-base"));
|
|
12
13
|
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); }
|
|
13
14
|
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; }
|
|
@@ -32,6 +33,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
32
33
|
interactionName = _ref.interactionName,
|
|
33
34
|
isDisabled = _ref.isDisabled,
|
|
34
35
|
isSelected = _ref.isSelected,
|
|
36
|
+
_ref$isLoading = _ref.isLoading,
|
|
37
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
35
38
|
children = _ref.children,
|
|
36
39
|
onClick = _ref.onClick,
|
|
37
40
|
onMouseDownCapture = _ref.onMouseDownCapture,
|
|
@@ -47,7 +50,7 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
47
50
|
ref = _ref.ref,
|
|
48
51
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
49
52
|
spacing = _ref.spacing;
|
|
50
|
-
var hasOverlay = Boolean(overlay);
|
|
53
|
+
var hasOverlay = Boolean(overlay || isLoading);
|
|
51
54
|
var baseProps = (0, _useButtonBase.default)({
|
|
52
55
|
analyticsContext: analyticsContext,
|
|
53
56
|
appearance: appearance,
|
|
@@ -81,7 +84,12 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
81
84
|
onPointerDownCapture: onPointerDownCapture,
|
|
82
85
|
onPointerUpCapture: onPointerUpCapture,
|
|
83
86
|
onClickCapture: onClickCapture,
|
|
84
|
-
overlay:
|
|
87
|
+
overlay: isLoading ? (0, _loadingOverlay.default)({
|
|
88
|
+
spacing: spacing,
|
|
89
|
+
appearance: appearance,
|
|
90
|
+
isDisabled: isDisabled,
|
|
91
|
+
isSelected: isSelected
|
|
92
|
+
}) : overlay,
|
|
85
93
|
ref: ref,
|
|
86
94
|
shouldFitContainer: shouldFitContainer,
|
|
87
95
|
spacing: spacing,
|
|
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
|
|
12
12
|
var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
|
|
13
|
-
var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "type", "testId", "UNSAFE_size", "aria-label"];
|
|
13
|
+
var _excluded = ["analyticsContext", "interactionName", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "isLoading", "icon", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "type", "testId", "UNSAFE_size", "aria-label"];
|
|
14
14
|
/**
|
|
15
15
|
* __Icon Button__
|
|
16
16
|
*
|
|
@@ -28,6 +28,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
28
28
|
spacing = _ref.spacing,
|
|
29
29
|
isDisabled = _ref.isDisabled,
|
|
30
30
|
isSelected = _ref.isSelected,
|
|
31
|
+
isLoading = _ref.isLoading,
|
|
31
32
|
icon = _ref.icon,
|
|
32
33
|
label = _ref.label,
|
|
33
34
|
overlay = _ref.overlay,
|
|
@@ -61,6 +62,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
61
62
|
interactionName: interactionName,
|
|
62
63
|
isDisabled: isDisabled,
|
|
63
64
|
isSelected: isSelected,
|
|
65
|
+
isLoading: isLoading,
|
|
64
66
|
label: label,
|
|
65
67
|
onClick: onClick,
|
|
66
68
|
onMouseDownCapture: onMouseDownCapture,
|
|
@@ -8,6 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
10
10
|
var _content = _interopRequireDefault(require("../shared/content"));
|
|
11
|
+
var _loadingOverlay = _interopRequireDefault(require("../shared/loading-overlay"));
|
|
11
12
|
var _useButtonBase = _interopRequireDefault(require("../shared/use-button-base"));
|
|
12
13
|
/**
|
|
13
14
|
* __Use icon button__
|
|
@@ -27,6 +28,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
27
28
|
interactionName = _ref.interactionName,
|
|
28
29
|
isDisabled = _ref.isDisabled,
|
|
29
30
|
isSelected = _ref.isSelected,
|
|
31
|
+
isLoading = _ref.isLoading,
|
|
30
32
|
label = _ref.label,
|
|
31
33
|
onClick = _ref.onClick,
|
|
32
34
|
onMouseDownCapture = _ref.onMouseDownCapture,
|
|
@@ -44,7 +46,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
44
46
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
45
47
|
spacing = _ref.spacing,
|
|
46
48
|
UNSAFE_size = _ref.UNSAFE_size;
|
|
47
|
-
var hasOverlay = Boolean(overlay);
|
|
49
|
+
var hasOverlay = Boolean(overlay || isLoading);
|
|
48
50
|
var isCircle = shape === 'circle';
|
|
49
51
|
var baseProps = (0, _useButtonBase.default)({
|
|
50
52
|
analyticsContext: analyticsContext,
|
|
@@ -73,7 +75,12 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
73
75
|
onPointerDownCapture: onPointerDownCapture,
|
|
74
76
|
onPointerUpCapture: onPointerUpCapture,
|
|
75
77
|
onClickCapture: onClickCapture,
|
|
76
|
-
overlay:
|
|
78
|
+
overlay: isLoading ? (0, _loadingOverlay.default)({
|
|
79
|
+
spacing: spacing,
|
|
80
|
+
appearance: appearance,
|
|
81
|
+
isDisabled: isDisabled,
|
|
82
|
+
isSelected: isSelected
|
|
83
|
+
}) : overlay,
|
|
77
84
|
ref: ref,
|
|
78
85
|
shouldFitContainer: shouldFitContainer,
|
|
79
86
|
spacing: spacing
|
|
@@ -24,18 +24,14 @@ var values = {
|
|
|
24
24
|
hover: 'color.background.neutral.hovered',
|
|
25
25
|
active: 'color.background.neutral.pressed',
|
|
26
26
|
// @ts-expect-error
|
|
27
|
-
disabled: "var(--ds-background-disabled, ".concat(colors.N20A, ")")
|
|
28
|
-
// @ts-expect-error
|
|
29
|
-
selected: "var(--ds-background-selected, ".concat(colors.N700, ")")
|
|
27
|
+
disabled: "var(--ds-background-disabled, ".concat(colors.N20A, ")")
|
|
30
28
|
},
|
|
31
29
|
primary: {
|
|
32
30
|
default: 'color.background.brand.bold',
|
|
33
31
|
hover: 'color.background.brand.bold.hovered',
|
|
34
32
|
active: 'color.background.brand.bold.pressed',
|
|
35
33
|
// @ts-expect-error
|
|
36
|
-
disabled: "var(--ds-background-disabled, ".concat(colors.N20A, ")")
|
|
37
|
-
// @ts-expect-error
|
|
38
|
-
selected: "var(--ds-background-selected, ".concat(colors.N700, ")")
|
|
34
|
+
disabled: "var(--ds-background-disabled, ".concat(colors.N20A, ")")
|
|
39
35
|
},
|
|
40
36
|
warning: {
|
|
41
37
|
default: 'color.background.warning.bold',
|
|
@@ -43,8 +39,14 @@ var values = {
|
|
|
43
39
|
active: 'color.background.warning.bold.pressed',
|
|
44
40
|
// @ts-expect-error
|
|
45
41
|
disabled: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
selected: {
|
|
43
|
+
// @ts-expect-error
|
|
44
|
+
default: "var(--ds-background-selected, ".concat(colors.Y400, ")"),
|
|
45
|
+
// @ts-expect-error
|
|
46
|
+
hover: "var(--ds-background-selected-hovered, ".concat(colors.Y400, ")"),
|
|
47
|
+
// @ts-expect-error
|
|
48
|
+
active: "var(--ds-background-selected-pressed, ".concat(colors.Y400, ")")
|
|
49
|
+
}
|
|
48
50
|
},
|
|
49
51
|
danger: {
|
|
50
52
|
default: 'color.background.danger.bold',
|
|
@@ -52,27 +54,35 @@ var values = {
|
|
|
52
54
|
active: 'color.background.danger.bold.pressed',
|
|
53
55
|
// @ts-expect-error
|
|
54
56
|
disabled: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
selected: {
|
|
58
|
+
// @ts-expect-error
|
|
59
|
+
default: "var(--ds-background-selected, ".concat(colors.R500, ")"),
|
|
60
|
+
// @ts-expect-error
|
|
61
|
+
hover: "var(--ds-background-selected-hovered, ".concat(colors.R500, ")"),
|
|
62
|
+
// @ts-expect-error
|
|
63
|
+
active: "var(--ds-background-selected-pressed, ".concat(colors.R500, ")")
|
|
64
|
+
}
|
|
57
65
|
},
|
|
58
66
|
link: {
|
|
59
|
-
default: 'color.background.neutral.subtle'
|
|
60
|
-
// @ts-expect-error
|
|
61
|
-
selected: "var(--ds-background-selected, ".concat(colors.N700, ")")
|
|
67
|
+
default: 'color.background.neutral.subtle'
|
|
62
68
|
},
|
|
63
69
|
subtle: {
|
|
64
70
|
default: 'color.background.neutral.subtle',
|
|
65
71
|
hover: 'color.background.neutral.subtle.hovered',
|
|
66
72
|
active: 'color.background.neutral.subtle.pressed',
|
|
67
73
|
// @ts-expect-error
|
|
68
|
-
disabled: "var(--ds-background-neutral-subtle, none)"
|
|
69
|
-
// @ts-expect-error
|
|
70
|
-
selected: "var(--ds-background-selected, ".concat(colors.N700, ")")
|
|
74
|
+
disabled: "var(--ds-background-neutral-subtle, none)"
|
|
71
75
|
},
|
|
72
76
|
'subtle-link': {
|
|
73
|
-
default: 'color.background.neutral.subtle'
|
|
77
|
+
default: 'color.background.neutral.subtle'
|
|
78
|
+
},
|
|
79
|
+
selected: {
|
|
80
|
+
// @ts-expect-error
|
|
81
|
+
default: "var(--ds-background-selected, ".concat(colors.N700, ")"),
|
|
82
|
+
// @ts-expect-error
|
|
83
|
+
hover: "var(--ds-background-selected-hovered, ".concat(colors.N700, ")"),
|
|
74
84
|
// @ts-expect-error
|
|
75
|
-
|
|
85
|
+
active: "var(--ds-background-selected-pressed, ".concat(colors.N700, ")")
|
|
76
86
|
}
|
|
77
87
|
},
|
|
78
88
|
color: {
|
|
@@ -81,45 +91,41 @@ var values = {
|
|
|
81
91
|
default: "var(--ds-text, ".concat(colors.N500, ")"),
|
|
82
92
|
// @ts-expect-error
|
|
83
93
|
active: "var(--ds-text, ".concat(colors.B400, ")"),
|
|
84
|
-
disabled: 'color.text.disabled'
|
|
85
|
-
// @ts-expect-error
|
|
86
|
-
selected: "var(--ds-text-selected, ".concat(colors.N20, ")")
|
|
94
|
+
disabled: 'color.text.disabled'
|
|
87
95
|
},
|
|
88
96
|
primary: {
|
|
89
97
|
default: 'color.text.inverse',
|
|
90
|
-
disabled: 'color.text.disabled'
|
|
91
|
-
// @ts-expect-error
|
|
92
|
-
selected: "var(--ds-text-selected, ".concat(colors.N20, ")")
|
|
98
|
+
disabled: 'color.text.disabled'
|
|
93
99
|
},
|
|
94
100
|
warning: {
|
|
95
101
|
default: 'color.text.warning.inverse',
|
|
96
102
|
disabled: 'color.text.disabled',
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
selected: {
|
|
104
|
+
// @ts-expect-error
|
|
105
|
+
default: "var(--ds-text-selected, ".concat(colors.N800, ")")
|
|
106
|
+
}
|
|
99
107
|
},
|
|
100
108
|
danger: {
|
|
101
109
|
default: 'color.text.inverse',
|
|
102
110
|
disabled: 'color.text.disabled',
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
selected: {
|
|
112
|
+
// @ts-expect-error
|
|
113
|
+
default: "var(--ds-text-selected, ".concat(colors.N0, ")")
|
|
114
|
+
}
|
|
105
115
|
},
|
|
106
116
|
link: {
|
|
107
117
|
default: 'color.link',
|
|
108
118
|
// @ts-expect-error
|
|
109
119
|
hover: "var(--ds-link, ".concat(colors.B300, ")"),
|
|
110
120
|
active: 'color.link.pressed',
|
|
111
|
-
disabled: 'color.text.disabled'
|
|
112
|
-
// @ts-expect-error
|
|
113
|
-
selected: "var(--ds-text-selected, ".concat(colors.N20, ")")
|
|
121
|
+
disabled: 'color.text.disabled'
|
|
114
122
|
},
|
|
115
123
|
subtle: {
|
|
116
124
|
// @ts-expect-error
|
|
117
125
|
default: "var(--ds-text, ".concat(colors.N500, ")"),
|
|
118
126
|
// @ts-expect-error
|
|
119
127
|
active: "var(--ds-text, ".concat(colors.B400, ")"),
|
|
120
|
-
disabled: 'color.text.disabled'
|
|
121
|
-
// @ts-expect-error
|
|
122
|
-
selected: "var(--ds-text-selected, ".concat(colors.N20, ")")
|
|
128
|
+
disabled: 'color.text.disabled'
|
|
123
129
|
},
|
|
124
130
|
'subtle-link': {
|
|
125
131
|
// @ts-expect-error
|
|
@@ -128,9 +134,11 @@ var values = {
|
|
|
128
134
|
hover: "var(--ds-text-subtle, ".concat(colors.N90, ")"),
|
|
129
135
|
// @ts-expect-error
|
|
130
136
|
active: "var(--ds-text, ".concat(colors.N400, ")"),
|
|
131
|
-
disabled: 'color.text.disabled'
|
|
137
|
+
disabled: 'color.text.disabled'
|
|
138
|
+
},
|
|
139
|
+
selected: {
|
|
132
140
|
// @ts-expect-error
|
|
133
|
-
|
|
141
|
+
default: "var(--ds-text-selected, ".concat(colors.N20, ")")
|
|
134
142
|
}
|
|
135
143
|
}
|
|
136
144
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = renderLoadingOverlay;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
10
|
+
function getIconSpacing(spacing) {
|
|
11
|
+
switch (spacing) {
|
|
12
|
+
case 'compact':
|
|
13
|
+
return 'small';
|
|
14
|
+
case 'none':
|
|
15
|
+
return 'xsmall';
|
|
16
|
+
default:
|
|
17
|
+
return 'medium';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function getSpinnerAppearance(_ref) {
|
|
21
|
+
var appearance = _ref.appearance,
|
|
22
|
+
isDisabled = _ref.isDisabled,
|
|
23
|
+
isSelected = _ref.isSelected;
|
|
24
|
+
if (isDisabled) {
|
|
25
|
+
return 'inherit';
|
|
26
|
+
}
|
|
27
|
+
if (isSelected) {
|
|
28
|
+
return 'invert';
|
|
29
|
+
}
|
|
30
|
+
if (appearance === 'primary' || appearance === 'danger') {
|
|
31
|
+
return 'invert';
|
|
32
|
+
}
|
|
33
|
+
return 'inherit';
|
|
34
|
+
}
|
|
35
|
+
function renderLoadingOverlay(_ref2) {
|
|
36
|
+
var appearance = _ref2.appearance,
|
|
37
|
+
spacing = _ref2.spacing,
|
|
38
|
+
isDisabled = _ref2.isDisabled,
|
|
39
|
+
isSelected = _ref2.isSelected;
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_spinner.default, {
|
|
41
|
+
label: ", Loading",
|
|
42
|
+
size: getIconSpacing(spacing),
|
|
43
|
+
appearance: getSpinnerAppearance({
|
|
44
|
+
appearance: appearance,
|
|
45
|
+
isDisabled: isDisabled,
|
|
46
|
+
isSelected: isSelected
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -66,21 +66,23 @@ function getColors(_ref2) {
|
|
|
66
66
|
isHighlighted = _ref2.isHighlighted,
|
|
67
67
|
isActiveOverSelected = _ref2.isActiveOverSelected,
|
|
68
68
|
hasOverlay = _ref2.hasOverlay;
|
|
69
|
+
var showSelectedState = (isSelected || isHighlighted) && !isDisabled && !isActiveOverSelected;
|
|
69
70
|
var key = interactionState;
|
|
70
71
|
// Overlay does not change color on interaction, revert to 'default' or resting state
|
|
71
72
|
key = hasOverlay ? 'default' : key;
|
|
72
|
-
key =
|
|
73
|
+
key = showSelectedState && isActiveOverSelected ? 'active' : key;
|
|
74
|
+
|
|
73
75
|
// Disabled colors overrule everything else
|
|
74
76
|
key = isDisabled ? 'disabled' : key;
|
|
75
77
|
return {
|
|
76
78
|
backgroundColor: getColor({
|
|
77
|
-
group: _colors.default.background[appearance],
|
|
79
|
+
group: showSelectedState && _colors.default.background[appearance]['selected'] || _colors.default.background[showSelectedState ? 'selected' : appearance],
|
|
78
80
|
key: key
|
|
79
81
|
}),
|
|
80
|
-
color:
|
|
81
|
-
group: _colors.default.color[appearance],
|
|
82
|
+
color: getColor({
|
|
83
|
+
group: showSelectedState && _colors.default.color[appearance]['selected'] || _colors.default.color[showSelectedState ? 'selected' : appearance],
|
|
82
84
|
key: key
|
|
83
|
-
})
|
|
85
|
+
})
|
|
84
86
|
};
|
|
85
87
|
}
|
|
86
88
|
function getXCSS(_ref3) {
|
|
@@ -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.
|
|
120
|
+
packageVersion: "17.9.0",
|
|
121
121
|
analyticsData: analyticsContext
|
|
122
122
|
});
|
|
123
123
|
|
|
@@ -20,6 +20,7 @@ const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function B
|
|
|
20
20
|
isDisabled,
|
|
21
21
|
isSelected,
|
|
22
22
|
iconBefore,
|
|
23
|
+
isLoading,
|
|
23
24
|
UNSAFE_iconAfter_size,
|
|
24
25
|
iconAfter,
|
|
25
26
|
UNSAFE_iconBefore_size,
|
|
@@ -53,6 +54,7 @@ const Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function B
|
|
|
53
54
|
interactionName,
|
|
54
55
|
isDisabled,
|
|
55
56
|
isSelected,
|
|
57
|
+
isLoading,
|
|
56
58
|
onClick,
|
|
57
59
|
onMouseDownCapture,
|
|
58
60
|
onMouseUpCapture,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
2
|
import Content from '../shared/content';
|
|
3
|
+
import renderLoadingOverlay from '../shared/loading-overlay';
|
|
3
4
|
import useButtonBase from '../shared/use-button-base';
|
|
4
5
|
/**
|
|
5
6
|
* __Use default button base__
|
|
@@ -22,6 +23,7 @@ const useDefaultButton = ({
|
|
|
22
23
|
interactionName,
|
|
23
24
|
isDisabled,
|
|
24
25
|
isSelected,
|
|
26
|
+
isLoading = false,
|
|
25
27
|
children,
|
|
26
28
|
onClick,
|
|
27
29
|
onMouseDownCapture,
|
|
@@ -38,7 +40,7 @@ const useDefaultButton = ({
|
|
|
38
40
|
shouldFitContainer,
|
|
39
41
|
spacing
|
|
40
42
|
}) => {
|
|
41
|
-
const hasOverlay = Boolean(overlay);
|
|
43
|
+
const hasOverlay = Boolean(overlay || isLoading);
|
|
42
44
|
const baseProps = useButtonBase({
|
|
43
45
|
analyticsContext,
|
|
44
46
|
appearance,
|
|
@@ -72,7 +74,12 @@ const useDefaultButton = ({
|
|
|
72
74
|
onPointerDownCapture,
|
|
73
75
|
onPointerUpCapture,
|
|
74
76
|
onClickCapture,
|
|
75
|
-
overlay
|
|
77
|
+
overlay: isLoading ? renderLoadingOverlay({
|
|
78
|
+
spacing,
|
|
79
|
+
appearance,
|
|
80
|
+
isDisabled,
|
|
81
|
+
isSelected
|
|
82
|
+
}) : overlay,
|
|
76
83
|
ref,
|
|
77
84
|
shouldFitContainer,
|
|
78
85
|
spacing,
|
|
@@ -19,6 +19,7 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
|
|
|
19
19
|
spacing,
|
|
20
20
|
isDisabled,
|
|
21
21
|
isSelected,
|
|
22
|
+
isLoading,
|
|
22
23
|
icon,
|
|
23
24
|
label,
|
|
24
25
|
overlay,
|
|
@@ -53,6 +54,7 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
|
|
|
53
54
|
interactionName,
|
|
54
55
|
isDisabled,
|
|
55
56
|
isSelected,
|
|
57
|
+
isLoading,
|
|
56
58
|
label,
|
|
57
59
|
onClick,
|
|
58
60
|
onMouseDownCapture,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
3
3
|
import Content from '../shared/content';
|
|
4
|
+
import renderLoadingOverlay from '../shared/loading-overlay';
|
|
4
5
|
import useButtonBase from '../shared/use-button-base';
|
|
5
6
|
/**
|
|
6
7
|
* __Use icon button__
|
|
@@ -20,6 +21,7 @@ const useIconButton = ({
|
|
|
20
21
|
interactionName,
|
|
21
22
|
isDisabled,
|
|
22
23
|
isSelected,
|
|
24
|
+
isLoading,
|
|
23
25
|
label,
|
|
24
26
|
onClick,
|
|
25
27
|
onMouseDownCapture,
|
|
@@ -38,7 +40,7 @@ const useIconButton = ({
|
|
|
38
40
|
spacing,
|
|
39
41
|
UNSAFE_size
|
|
40
42
|
}) => {
|
|
41
|
-
const hasOverlay = Boolean(overlay);
|
|
43
|
+
const hasOverlay = Boolean(overlay || isLoading);
|
|
42
44
|
const isCircle = shape === 'circle';
|
|
43
45
|
const baseProps = useButtonBase({
|
|
44
46
|
analyticsContext,
|
|
@@ -67,7 +69,12 @@ const useIconButton = ({
|
|
|
67
69
|
onPointerDownCapture,
|
|
68
70
|
onPointerUpCapture,
|
|
69
71
|
onClickCapture,
|
|
70
|
-
overlay
|
|
72
|
+
overlay: isLoading ? renderLoadingOverlay({
|
|
73
|
+
spacing,
|
|
74
|
+
appearance,
|
|
75
|
+
isDisabled,
|
|
76
|
+
isSelected
|
|
77
|
+
}) : overlay,
|
|
71
78
|
ref,
|
|
72
79
|
shouldFitContainer,
|
|
73
80
|
spacing
|