@atlaskit/button 17.9.0 → 17.10.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/new-button/variants/default/use-default-button.js +1 -0
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +1 -0
- package/dist/cjs/new-button/variants/shared/loading-overlay.js +1 -4
- package/dist/cjs/new-button/variants/shared/use-button-base.js +4 -1
- package/dist/cjs/new-button/variants/shared/xcss.js +9 -3
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/variants/default/use-default-button.js +1 -0
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +1 -0
- package/dist/es2019/new-button/variants/shared/loading-overlay.js +1 -4
- package/dist/es2019/new-button/variants/shared/use-button-base.js +3 -1
- package/dist/es2019/new-button/variants/shared/xcss.js +8 -2
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/variants/default/use-default-button.js +1 -0
- package/dist/esm/new-button/variants/icon/use-icon-button.js +1 -0
- package/dist/esm/new-button/variants/shared/loading-overlay.js +1 -4
- package/dist/esm/new-button/variants/shared/use-button-base.js +4 -1
- package/dist/esm/new-button/variants/shared/xcss.js +9 -3
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/containers/button-group.d.ts +4 -4
- package/dist/types/new-button/variants/default/types.d.ts +0 -4
- package/dist/types/new-button/variants/icon/types.d.ts +0 -4
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +2 -1
- package/dist/types/new-button/variants/shared/xcss.d.ts +2 -1
- package/dist/types/new-button/variants/types.d.ts +4 -0
- package/dist/types/old-button/types.d.ts +20 -20
- package/dist/types-ts4.5/containers/button-group.d.ts +4 -4
- package/dist/types-ts4.5/new-button/variants/default/types.d.ts +0 -4
- package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +0 -4
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +2 -1
- package/dist/types-ts4.5/new-button/variants/shared/xcss.d.ts +2 -1
- package/dist/types-ts4.5/new-button/variants/types.d.ts +4 -0
- package/dist/types-ts4.5/old-button/types.d.ts +20 -20
- package/extract-react-types/new-button/variants/default/{common-props.tsx → common-default-button-props.tsx} +1 -1
- package/extract-react-types/new-button/variants/icon-button/icon-button-props.tsx +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 17.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#88036](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88036) [`c1d62ce0679e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c1d62ce0679e) - - Fixed a bug in new loading buttons where the spinner color was incorrect in selected state.
|
|
8
|
+
- Fixed a bug where the `isLoading` prop on new buttons was mistakenly added to unsupported link buttons.
|
|
9
|
+
- New loading buttons now display a loading cursor (`cursor: progress`), rather than a disabled cursor (`cursor: not-allowed`).
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#87335](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87335) [`4bb74bb023d4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4bb74bb023d4) - Added explicit `text-decoration` styles to new button focus states. This ensures button styles are not interfered with by global styles.
|
|
14
|
+
|
|
3
15
|
## 17.9.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -62,6 +62,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
62
62
|
}), /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, null, label)),
|
|
63
63
|
interactionName: interactionName,
|
|
64
64
|
isDisabled: isDisabled,
|
|
65
|
+
isLoading: isLoading,
|
|
65
66
|
isSelected: isSelected,
|
|
66
67
|
isIconButton: true,
|
|
67
68
|
isCircle: isCircle,
|
|
@@ -21,12 +21,9 @@ function getSpinnerAppearance(_ref) {
|
|
|
21
21
|
var appearance = _ref.appearance,
|
|
22
22
|
isDisabled = _ref.isDisabled,
|
|
23
23
|
isSelected = _ref.isSelected;
|
|
24
|
-
if (isDisabled) {
|
|
24
|
+
if (isDisabled || isSelected) {
|
|
25
25
|
return 'inherit';
|
|
26
26
|
}
|
|
27
|
-
if (isSelected) {
|
|
28
|
-
return 'invert';
|
|
29
|
-
}
|
|
30
27
|
if (appearance === 'primary' || appearance === 'danger') {
|
|
31
28
|
return 'invert';
|
|
32
29
|
}
|
|
@@ -49,6 +49,8 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
49
49
|
buttonType = _ref.buttonType,
|
|
50
50
|
_ref$isDisabled = _ref.isDisabled,
|
|
51
51
|
propIsDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
52
|
+
_ref$isLoading = _ref.isLoading,
|
|
53
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
52
54
|
_ref$isSelected = _ref.isSelected,
|
|
53
55
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
54
56
|
_ref$isIconButton = _ref.isIconButton,
|
|
@@ -104,6 +106,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
104
106
|
appearance: appearance,
|
|
105
107
|
spacing: spacing,
|
|
106
108
|
isDisabled: isDisabled,
|
|
109
|
+
isLoading: isLoading,
|
|
107
110
|
isSelected: isSelected,
|
|
108
111
|
isHighlighted: isHighlighted,
|
|
109
112
|
isActiveOverSelected: isActiveOverSelected,
|
|
@@ -117,7 +120,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
117
120
|
isSplit: isSplitButton,
|
|
118
121
|
isNavigationSplit: isNavigationSplitButton
|
|
119
122
|
});
|
|
120
|
-
}, [appearance, buttonType, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
123
|
+
}, [appearance, buttonType, spacing, isDisabled, isLoading, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
121
124
|
var isEffectivelyDisabled = isDisabled || Boolean(overlay);
|
|
122
125
|
return _objectSpread({
|
|
123
126
|
ref: setRef,
|
|
@@ -90,6 +90,7 @@ function getXCSS(_ref3) {
|
|
|
90
90
|
spacing = _ref3.spacing,
|
|
91
91
|
isDisabled = _ref3.isDisabled,
|
|
92
92
|
isSelected = _ref3.isSelected,
|
|
93
|
+
isLoading = _ref3.isLoading,
|
|
93
94
|
isHighlighted = _ref3.isHighlighted,
|
|
94
95
|
isActiveOverSelected = _ref3.isActiveOverSelected,
|
|
95
96
|
isIconButton = _ref3.isIconButton,
|
|
@@ -162,8 +163,8 @@ function getXCSS(_ref3) {
|
|
|
162
163
|
width: width,
|
|
163
164
|
// justifyContent required for shouldFitContainer buttons with an icon inside
|
|
164
165
|
justifyContent: 'center'
|
|
165
|
-
}, combinedBaseColorStyles), isDisabled || hasOverlay ? {
|
|
166
|
-
cursor: 'not-allowed'
|
|
166
|
+
}, combinedBaseColorStyles), isDisabled || hasOverlay || isLoading ? {
|
|
167
|
+
cursor: isLoading ? 'progress' : 'not-allowed'
|
|
167
168
|
} : {}), {}, {
|
|
168
169
|
':hover': _objectSpread(_objectSpread({}, getColors({
|
|
169
170
|
appearance: appearance,
|
|
@@ -187,6 +188,11 @@ function getXCSS(_ref3) {
|
|
|
187
188
|
})), {}, {
|
|
188
189
|
// background, box-shadow
|
|
189
190
|
transitionDuration: '0s, 0s'
|
|
190
|
-
})
|
|
191
|
+
}),
|
|
192
|
+
':focus': {
|
|
193
|
+
// Required due to Jira's AUI CSS reset
|
|
194
|
+
// See https://product-fabric.atlassian.net/browse/DSP-15687
|
|
195
|
+
textDecoration: !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? 'underline' : 'none'
|
|
196
|
+
}
|
|
191
197
|
}, splitButtonStyles));
|
|
192
198
|
}
|
|
@@ -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.10.0",
|
|
121
121
|
analyticsData: analyticsContext
|
|
122
122
|
});
|
|
123
123
|
|
|
@@ -15,12 +15,9 @@ function getSpinnerAppearance({
|
|
|
15
15
|
isDisabled,
|
|
16
16
|
isSelected
|
|
17
17
|
}) {
|
|
18
|
-
if (isDisabled) {
|
|
18
|
+
if (isDisabled || isSelected) {
|
|
19
19
|
return 'inherit';
|
|
20
20
|
}
|
|
21
|
-
if (isSelected) {
|
|
22
|
-
return 'invert';
|
|
23
|
-
}
|
|
24
21
|
if (appearance === 'primary' || appearance === 'danger') {
|
|
25
22
|
return 'invert';
|
|
26
23
|
}
|
|
@@ -33,6 +33,7 @@ const useButtonBase = ({
|
|
|
33
33
|
autoFocus = false,
|
|
34
34
|
buttonType,
|
|
35
35
|
isDisabled: propIsDisabled = false,
|
|
36
|
+
isLoading = false,
|
|
36
37
|
isSelected = false,
|
|
37
38
|
// TODO: Separate Icon Button styling from button base
|
|
38
39
|
isIconButton = false,
|
|
@@ -83,6 +84,7 @@ const useButtonBase = ({
|
|
|
83
84
|
appearance,
|
|
84
85
|
spacing,
|
|
85
86
|
isDisabled,
|
|
87
|
+
isLoading,
|
|
86
88
|
isSelected,
|
|
87
89
|
isHighlighted,
|
|
88
90
|
isActiveOverSelected,
|
|
@@ -95,7 +97,7 @@ const useButtonBase = ({
|
|
|
95
97
|
hasIconAfter,
|
|
96
98
|
isSplit: isSplitButton,
|
|
97
99
|
isNavigationSplit: isNavigationSplitButton
|
|
98
|
-
}), [appearance, buttonType, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
100
|
+
}), [appearance, buttonType, spacing, isDisabled, isLoading, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
99
101
|
const isEffectivelyDisabled = isDisabled || Boolean(overlay);
|
|
100
102
|
return {
|
|
101
103
|
ref: setRef,
|
|
@@ -80,6 +80,7 @@ export function getXCSS({
|
|
|
80
80
|
spacing,
|
|
81
81
|
isDisabled,
|
|
82
82
|
isSelected,
|
|
83
|
+
isLoading,
|
|
83
84
|
isHighlighted,
|
|
84
85
|
isActiveOverSelected,
|
|
85
86
|
isIconButton,
|
|
@@ -157,8 +158,8 @@ export function getXCSS({
|
|
|
157
158
|
// justifyContent required for shouldFitContainer buttons with an icon inside
|
|
158
159
|
justifyContent: 'center',
|
|
159
160
|
...combinedBaseColorStyles,
|
|
160
|
-
...(isDisabled || hasOverlay ? {
|
|
161
|
-
cursor: 'not-allowed'
|
|
161
|
+
...(isDisabled || hasOverlay || isLoading ? {
|
|
162
|
+
cursor: isLoading ? 'progress' : 'not-allowed'
|
|
162
163
|
} : {}),
|
|
163
164
|
':hover': {
|
|
164
165
|
...getColors({
|
|
@@ -185,6 +186,11 @@ export function getXCSS({
|
|
|
185
186
|
// background, box-shadow
|
|
186
187
|
transitionDuration: '0s, 0s'
|
|
187
188
|
},
|
|
189
|
+
':focus': {
|
|
190
|
+
// Required due to Jira's AUI CSS reset
|
|
191
|
+
// See https://product-fabric.atlassian.net/browse/DSP-15687
|
|
192
|
+
textDecoration: !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? 'underline' : 'none'
|
|
193
|
+
},
|
|
188
194
|
...splitButtonStyles
|
|
189
195
|
});
|
|
190
196
|
}
|
|
@@ -102,7 +102,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
102
102
|
action: 'clicked',
|
|
103
103
|
componentName: 'button',
|
|
104
104
|
packageName: "@atlaskit/button",
|
|
105
|
-
packageVersion: "17.
|
|
105
|
+
packageVersion: "17.10.0",
|
|
106
106
|
analyticsData: analyticsContext
|
|
107
107
|
});
|
|
108
108
|
|
|
@@ -55,6 +55,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
55
55
|
}), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)),
|
|
56
56
|
interactionName: interactionName,
|
|
57
57
|
isDisabled: isDisabled,
|
|
58
|
+
isLoading: isLoading,
|
|
58
59
|
isSelected: isSelected,
|
|
59
60
|
isIconButton: true,
|
|
60
61
|
isCircle: isCircle,
|
|
@@ -14,12 +14,9 @@ function getSpinnerAppearance(_ref) {
|
|
|
14
14
|
var appearance = _ref.appearance,
|
|
15
15
|
isDisabled = _ref.isDisabled,
|
|
16
16
|
isSelected = _ref.isSelected;
|
|
17
|
-
if (isDisabled) {
|
|
17
|
+
if (isDisabled || isSelected) {
|
|
18
18
|
return 'inherit';
|
|
19
19
|
}
|
|
20
|
-
if (isSelected) {
|
|
21
|
-
return 'invert';
|
|
22
|
-
}
|
|
23
20
|
if (appearance === 'primary' || appearance === 'danger') {
|
|
24
21
|
return 'invert';
|
|
25
22
|
}
|
|
@@ -39,6 +39,8 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
39
39
|
buttonType = _ref.buttonType,
|
|
40
40
|
_ref$isDisabled = _ref.isDisabled,
|
|
41
41
|
propIsDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
42
|
+
_ref$isLoading = _ref.isLoading,
|
|
43
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
42
44
|
_ref$isSelected = _ref.isSelected,
|
|
43
45
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
44
46
|
_ref$isIconButton = _ref.isIconButton,
|
|
@@ -94,6 +96,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
94
96
|
appearance: appearance,
|
|
95
97
|
spacing: spacing,
|
|
96
98
|
isDisabled: isDisabled,
|
|
99
|
+
isLoading: isLoading,
|
|
97
100
|
isSelected: isSelected,
|
|
98
101
|
isHighlighted: isHighlighted,
|
|
99
102
|
isActiveOverSelected: isActiveOverSelected,
|
|
@@ -107,7 +110,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
107
110
|
isSplit: isSplitButton,
|
|
108
111
|
isNavigationSplit: isNavigationSplitButton
|
|
109
112
|
});
|
|
110
|
-
}, [appearance, buttonType, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
113
|
+
}, [appearance, buttonType, spacing, isDisabled, isLoading, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
111
114
|
var isEffectivelyDisabled = isDisabled || Boolean(overlay);
|
|
112
115
|
return _objectSpread({
|
|
113
116
|
ref: setRef,
|
|
@@ -82,6 +82,7 @@ export function getXCSS(_ref3) {
|
|
|
82
82
|
spacing = _ref3.spacing,
|
|
83
83
|
isDisabled = _ref3.isDisabled,
|
|
84
84
|
isSelected = _ref3.isSelected,
|
|
85
|
+
isLoading = _ref3.isLoading,
|
|
85
86
|
isHighlighted = _ref3.isHighlighted,
|
|
86
87
|
isActiveOverSelected = _ref3.isActiveOverSelected,
|
|
87
88
|
isIconButton = _ref3.isIconButton,
|
|
@@ -154,8 +155,8 @@ export function getXCSS(_ref3) {
|
|
|
154
155
|
width: width,
|
|
155
156
|
// justifyContent required for shouldFitContainer buttons with an icon inside
|
|
156
157
|
justifyContent: 'center'
|
|
157
|
-
}, combinedBaseColorStyles), isDisabled || hasOverlay ? {
|
|
158
|
-
cursor: 'not-allowed'
|
|
158
|
+
}, combinedBaseColorStyles), isDisabled || hasOverlay || isLoading ? {
|
|
159
|
+
cursor: isLoading ? 'progress' : 'not-allowed'
|
|
159
160
|
} : {}), {}, {
|
|
160
161
|
':hover': _objectSpread(_objectSpread({}, getColors({
|
|
161
162
|
appearance: appearance,
|
|
@@ -179,6 +180,11 @@ export function getXCSS(_ref3) {
|
|
|
179
180
|
})), {}, {
|
|
180
181
|
// background, box-shadow
|
|
181
182
|
transitionDuration: '0s, 0s'
|
|
182
|
-
})
|
|
183
|
+
}),
|
|
184
|
+
':focus': {
|
|
185
|
+
// Required due to Jira's AUI CSS reset
|
|
186
|
+
// See https://product-fabric.atlassian.net/browse/DSP-15687
|
|
187
|
+
textDecoration: !isSelected && (appearance === 'link' || appearance === 'subtle-link') ? 'underline' : 'none'
|
|
188
|
+
}
|
|
183
189
|
}, splitButtonStyles));
|
|
184
190
|
}
|
|
@@ -108,7 +108,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
108
108
|
action: 'clicked',
|
|
109
109
|
componentName: 'button',
|
|
110
110
|
packageName: "@atlaskit/button",
|
|
111
|
-
packageVersion: "17.
|
|
111
|
+
packageVersion: "17.10.0",
|
|
112
112
|
analyticsData: analyticsContext
|
|
113
113
|
});
|
|
114
114
|
|
|
@@ -4,11 +4,11 @@ import { jsx } from '@emotion/react';
|
|
|
4
4
|
import { Appearance } from '../old-button/types';
|
|
5
5
|
export type ButtonGroupProps = {
|
|
6
6
|
/**
|
|
7
|
-
* The appearance to apply to all buttons
|
|
7
|
+
* The appearance to apply to all buttons.
|
|
8
8
|
*/
|
|
9
9
|
appearance?: Appearance;
|
|
10
10
|
/**
|
|
11
|
-
* The buttons to render inside the
|
|
11
|
+
* The buttons to render inside the button group.
|
|
12
12
|
*/
|
|
13
13
|
children?: React.ReactNode;
|
|
14
14
|
/**
|
|
@@ -16,12 +16,12 @@ export type ButtonGroupProps = {
|
|
|
16
16
|
*/
|
|
17
17
|
testId?: string;
|
|
18
18
|
/**
|
|
19
|
-
* Refers to an aria-label attribute. Sets an accessible name for
|
|
19
|
+
* Refers to an `aria-label` attribute. Sets an accessible name for the button group wrapper to announce it to users of assistive technology.
|
|
20
20
|
* Usage of either this, or the `titleId` attribute is strongly recommended.
|
|
21
21
|
*/
|
|
22
22
|
label?: string;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* ID referenced by the button group wrapper's `aria-labelledby` attribute. This ID should be assigned to the group-button title element.
|
|
25
25
|
* Usage of either this, or the `label` attribute is strongly recommended.
|
|
26
26
|
*/
|
|
27
27
|
titleId?: string;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type ButtonSpacing, type IconProp, type IconSize } from '../types';
|
|
3
3
|
export type CommonDefaultButtonProps = {
|
|
4
|
-
/**
|
|
5
|
-
* Conditionally show a spinner over the top of a button
|
|
6
|
-
*/
|
|
7
|
-
isLoading?: boolean;
|
|
8
4
|
/**
|
|
9
5
|
* Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
|
|
10
6
|
*/
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { type IconButtonAppearance, type IconButtonSpacing, type IconProp, type IconSize } from '../types';
|
|
2
2
|
export type CommonIconButtonProps = {
|
|
3
|
-
/**
|
|
4
|
-
* Conditionally show a spinner over the top of a button
|
|
5
|
-
*/
|
|
6
|
-
isLoading?: boolean;
|
|
7
3
|
/**
|
|
8
4
|
* The button style variation.
|
|
9
5
|
*/
|
|
@@ -16,6 +16,7 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
16
16
|
appearance?: Appearance;
|
|
17
17
|
children: React.ReactNode;
|
|
18
18
|
spacing?: Spacing;
|
|
19
|
+
isLoading?: boolean;
|
|
19
20
|
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay'> & ControlledEvents<TagName>;
|
|
20
21
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
21
22
|
xcss: ReturnType<typeof xcss>;
|
|
@@ -36,5 +37,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
|
36
37
|
*
|
|
37
38
|
* @private
|
|
38
39
|
*/
|
|
39
|
-
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, buttonType, isDisabled: propIsDisabled, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
40
|
+
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, buttonType, isDisabled: propIsDisabled, isLoading, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
40
41
|
export default useButtonBase;
|
|
@@ -7,6 +7,7 @@ export type GetXCSSArgs = {
|
|
|
7
7
|
appearance: Appearance;
|
|
8
8
|
spacing: Spacing;
|
|
9
9
|
isDisabled: boolean;
|
|
10
|
+
isLoading: boolean;
|
|
10
11
|
isSelected: boolean;
|
|
11
12
|
isHighlighted: boolean;
|
|
12
13
|
isActiveOverSelected: boolean;
|
|
@@ -29,4 +30,4 @@ export type GetXCSSArgs = {
|
|
|
29
30
|
*/
|
|
30
31
|
isNavigationSplit: boolean;
|
|
31
32
|
};
|
|
32
|
-
export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
|
|
33
|
+
export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isLoading, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
|
|
@@ -67,6 +67,10 @@ export type AdditionalButtonVariantProps = {
|
|
|
67
67
|
* The button style variation.
|
|
68
68
|
*/
|
|
69
69
|
appearance?: ButtonAppearance;
|
|
70
|
+
/**
|
|
71
|
+
* Conditionally show a spinner over the top of a button
|
|
72
|
+
*/
|
|
73
|
+
isLoading?: boolean;
|
|
70
74
|
};
|
|
71
75
|
/**
|
|
72
76
|
* Combines common button props with additional HTML attributes
|
|
@@ -5,85 +5,85 @@ export type Spacing = 'compact' | 'default' | 'none';
|
|
|
5
5
|
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
6
6
|
export type BaseOwnProps = {
|
|
7
7
|
/**
|
|
8
|
-
* The base styling to apply to the button
|
|
8
|
+
* The base styling to apply to the button.
|
|
9
9
|
*/
|
|
10
10
|
appearance?: Appearance;
|
|
11
11
|
/**
|
|
12
|
-
* Set the button to autofocus on mount
|
|
12
|
+
* Set the button to autofocus on mount.
|
|
13
13
|
*/
|
|
14
14
|
autoFocus?: boolean;
|
|
15
15
|
/**
|
|
16
|
-
* Add a classname to the button
|
|
16
|
+
* Add a classname to the button.
|
|
17
17
|
*/
|
|
18
18
|
className?: string;
|
|
19
19
|
/**
|
|
20
|
-
* Used to 'overlay' something over a button. This is commonly used to display a loading spinner
|
|
20
|
+
* Used to 'overlay' something over a button. This is commonly used to display a loading spinner.
|
|
21
21
|
*/
|
|
22
22
|
overlay?: React.ReactNode;
|
|
23
23
|
/**
|
|
24
|
-
* Provides a
|
|
24
|
+
* Provides a URL that's used when the button is a link styled as a button.
|
|
25
25
|
*/
|
|
26
26
|
href?: string;
|
|
27
27
|
/**
|
|
28
|
-
* Places an icon within the button, after the button's text
|
|
28
|
+
* Places an icon within the button, after the button's text.
|
|
29
29
|
*/
|
|
30
30
|
iconAfter?: React.ReactChild;
|
|
31
31
|
/**
|
|
32
|
-
* Places an icon within the button, before the button's text
|
|
32
|
+
* Places an icon within the button, before the button's text.
|
|
33
33
|
*/
|
|
34
34
|
iconBefore?: React.ReactChild;
|
|
35
35
|
/**
|
|
36
|
-
* Set if the button is disabled
|
|
36
|
+
* Set if the button is disabled.
|
|
37
37
|
*/
|
|
38
38
|
isDisabled?: boolean;
|
|
39
39
|
/**
|
|
40
|
-
* Change the style to indicate the button is selected
|
|
40
|
+
* Change the style to indicate the button is selected.
|
|
41
41
|
*/
|
|
42
42
|
isSelected?: boolean;
|
|
43
43
|
/**
|
|
44
|
-
* Handler to be called on blur
|
|
44
|
+
* Handler to be called on blur.
|
|
45
45
|
*/
|
|
46
46
|
onBlur?: React.FocusEventHandler<HTMLElement>;
|
|
47
47
|
/**
|
|
48
|
-
* Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details
|
|
48
|
+
* Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details.
|
|
49
49
|
*/
|
|
50
50
|
onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
51
51
|
/**
|
|
52
|
-
* Handler to be called on focus
|
|
52
|
+
* Handler to be called on focus.
|
|
53
53
|
*/
|
|
54
54
|
onFocus?: React.FocusEventHandler<HTMLElement>;
|
|
55
55
|
/**
|
|
56
|
-
* Set the amount of padding in the button
|
|
56
|
+
* Set the amount of padding in the button.
|
|
57
57
|
*/
|
|
58
58
|
spacing?: Spacing;
|
|
59
59
|
/**
|
|
60
|
-
* Pass target down to
|
|
60
|
+
* Pass target down to the button. If a href is provided, this will be a semantic link styled as a button.
|
|
61
61
|
*/
|
|
62
62
|
target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
63
63
|
/**
|
|
64
|
-
* Pass type down to
|
|
64
|
+
* Pass type down to the button.
|
|
65
65
|
*/
|
|
66
66
|
type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
67
67
|
/**
|
|
68
|
-
* Option to fit button width to its parent width
|
|
68
|
+
* Option to fit button width to its parent width.
|
|
69
69
|
*/
|
|
70
70
|
shouldFitContainer?: boolean;
|
|
71
71
|
/**
|
|
72
|
-
* Text content to be rendered in the button
|
|
72
|
+
* Text content to be rendered in the button.
|
|
73
73
|
*/
|
|
74
74
|
children?: React.ReactNode;
|
|
75
75
|
/**
|
|
76
|
-
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
76
|
+
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
77
77
|
*/
|
|
78
78
|
testId?: string;
|
|
79
79
|
component?: React.ComponentType<React.AllHTMLAttributes<HTMLElement>> | React.ElementType;
|
|
80
80
|
/**
|
|
81
81
|
* An optional name used to identify this component to press listeners. For example, interaction tracing. For more information,
|
|
82
|
-
* see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration)
|
|
82
|
+
* see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
|
|
83
83
|
*/
|
|
84
84
|
interactionName?: string;
|
|
85
85
|
/**
|
|
86
|
-
* Additional information to be included in the `context` of analytics events that come from button
|
|
86
|
+
* Additional information to be included in the `context` of analytics events that come from button.
|
|
87
87
|
*/
|
|
88
88
|
analyticsContext?: Record<string, any>;
|
|
89
89
|
};
|
|
@@ -4,11 +4,11 @@ import { jsx } from '@emotion/react';
|
|
|
4
4
|
import { Appearance } from '../old-button/types';
|
|
5
5
|
export type ButtonGroupProps = {
|
|
6
6
|
/**
|
|
7
|
-
* The appearance to apply to all buttons
|
|
7
|
+
* The appearance to apply to all buttons.
|
|
8
8
|
*/
|
|
9
9
|
appearance?: Appearance;
|
|
10
10
|
/**
|
|
11
|
-
* The buttons to render inside the
|
|
11
|
+
* The buttons to render inside the button group.
|
|
12
12
|
*/
|
|
13
13
|
children?: React.ReactNode;
|
|
14
14
|
/**
|
|
@@ -16,12 +16,12 @@ export type ButtonGroupProps = {
|
|
|
16
16
|
*/
|
|
17
17
|
testId?: string;
|
|
18
18
|
/**
|
|
19
|
-
* Refers to an aria-label attribute. Sets an accessible name for
|
|
19
|
+
* Refers to an `aria-label` attribute. Sets an accessible name for the button group wrapper to announce it to users of assistive technology.
|
|
20
20
|
* Usage of either this, or the `titleId` attribute is strongly recommended.
|
|
21
21
|
*/
|
|
22
22
|
label?: string;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* ID referenced by the button group wrapper's `aria-labelledby` attribute. This ID should be assigned to the group-button title element.
|
|
25
25
|
* Usage of either this, or the `label` attribute is strongly recommended.
|
|
26
26
|
*/
|
|
27
27
|
titleId?: string;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type ButtonSpacing, type IconProp, type IconSize } from '../types';
|
|
3
3
|
export type CommonDefaultButtonProps = {
|
|
4
|
-
/**
|
|
5
|
-
* Conditionally show a spinner over the top of a button
|
|
6
|
-
*/
|
|
7
|
-
isLoading?: boolean;
|
|
8
4
|
/**
|
|
9
5
|
* Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
|
|
10
6
|
*/
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { type IconButtonAppearance, type IconButtonSpacing, type IconProp, type IconSize } from '../types';
|
|
2
2
|
export type CommonIconButtonProps = {
|
|
3
|
-
/**
|
|
4
|
-
* Conditionally show a spinner over the top of a button
|
|
5
|
-
*/
|
|
6
|
-
isLoading?: boolean;
|
|
7
3
|
/**
|
|
8
4
|
* The button style variation.
|
|
9
5
|
*/
|
|
@@ -16,6 +16,7 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
16
16
|
appearance?: Appearance;
|
|
17
17
|
children: React.ReactNode;
|
|
18
18
|
spacing?: Spacing;
|
|
19
|
+
isLoading?: boolean;
|
|
19
20
|
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay'> & ControlledEvents<TagName>;
|
|
20
21
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
21
22
|
xcss: ReturnType<typeof xcss>;
|
|
@@ -36,5 +37,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
|
36
37
|
*
|
|
37
38
|
* @private
|
|
38
39
|
*/
|
|
39
|
-
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, buttonType, isDisabled: propIsDisabled, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
40
|
+
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, buttonType, isDisabled: propIsDisabled, isLoading, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
40
41
|
export default useButtonBase;
|
|
@@ -7,6 +7,7 @@ export type GetXCSSArgs = {
|
|
|
7
7
|
appearance: Appearance;
|
|
8
8
|
spacing: Spacing;
|
|
9
9
|
isDisabled: boolean;
|
|
10
|
+
isLoading: boolean;
|
|
10
11
|
isSelected: boolean;
|
|
11
12
|
isHighlighted: boolean;
|
|
12
13
|
isActiveOverSelected: boolean;
|
|
@@ -29,4 +30,4 @@ export type GetXCSSArgs = {
|
|
|
29
30
|
*/
|
|
30
31
|
isNavigationSplit: boolean;
|
|
31
32
|
};
|
|
32
|
-
export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
|
|
33
|
+
export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isLoading, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
|
|
@@ -67,6 +67,10 @@ export type AdditionalButtonVariantProps = {
|
|
|
67
67
|
* The button style variation.
|
|
68
68
|
*/
|
|
69
69
|
appearance?: ButtonAppearance;
|
|
70
|
+
/**
|
|
71
|
+
* Conditionally show a spinner over the top of a button
|
|
72
|
+
*/
|
|
73
|
+
isLoading?: boolean;
|
|
70
74
|
};
|
|
71
75
|
/**
|
|
72
76
|
* Combines common button props with additional HTML attributes
|
|
@@ -5,85 +5,85 @@ export type Spacing = 'compact' | 'default' | 'none';
|
|
|
5
5
|
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
6
6
|
export type BaseOwnProps = {
|
|
7
7
|
/**
|
|
8
|
-
* The base styling to apply to the button
|
|
8
|
+
* The base styling to apply to the button.
|
|
9
9
|
*/
|
|
10
10
|
appearance?: Appearance;
|
|
11
11
|
/**
|
|
12
|
-
* Set the button to autofocus on mount
|
|
12
|
+
* Set the button to autofocus on mount.
|
|
13
13
|
*/
|
|
14
14
|
autoFocus?: boolean;
|
|
15
15
|
/**
|
|
16
|
-
* Add a classname to the button
|
|
16
|
+
* Add a classname to the button.
|
|
17
17
|
*/
|
|
18
18
|
className?: string;
|
|
19
19
|
/**
|
|
20
|
-
* Used to 'overlay' something over a button. This is commonly used to display a loading spinner
|
|
20
|
+
* Used to 'overlay' something over a button. This is commonly used to display a loading spinner.
|
|
21
21
|
*/
|
|
22
22
|
overlay?: React.ReactNode;
|
|
23
23
|
/**
|
|
24
|
-
* Provides a
|
|
24
|
+
* Provides a URL that's used when the button is a link styled as a button.
|
|
25
25
|
*/
|
|
26
26
|
href?: string;
|
|
27
27
|
/**
|
|
28
|
-
* Places an icon within the button, after the button's text
|
|
28
|
+
* Places an icon within the button, after the button's text.
|
|
29
29
|
*/
|
|
30
30
|
iconAfter?: React.ReactChild;
|
|
31
31
|
/**
|
|
32
|
-
* Places an icon within the button, before the button's text
|
|
32
|
+
* Places an icon within the button, before the button's text.
|
|
33
33
|
*/
|
|
34
34
|
iconBefore?: React.ReactChild;
|
|
35
35
|
/**
|
|
36
|
-
* Set if the button is disabled
|
|
36
|
+
* Set if the button is disabled.
|
|
37
37
|
*/
|
|
38
38
|
isDisabled?: boolean;
|
|
39
39
|
/**
|
|
40
|
-
* Change the style to indicate the button is selected
|
|
40
|
+
* Change the style to indicate the button is selected.
|
|
41
41
|
*/
|
|
42
42
|
isSelected?: boolean;
|
|
43
43
|
/**
|
|
44
|
-
* Handler to be called on blur
|
|
44
|
+
* Handler to be called on blur.
|
|
45
45
|
*/
|
|
46
46
|
onBlur?: React.FocusEventHandler<HTMLElement>;
|
|
47
47
|
/**
|
|
48
|
-
* Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details
|
|
48
|
+
* Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details.
|
|
49
49
|
*/
|
|
50
50
|
onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
51
51
|
/**
|
|
52
|
-
* Handler to be called on focus
|
|
52
|
+
* Handler to be called on focus.
|
|
53
53
|
*/
|
|
54
54
|
onFocus?: React.FocusEventHandler<HTMLElement>;
|
|
55
55
|
/**
|
|
56
|
-
* Set the amount of padding in the button
|
|
56
|
+
* Set the amount of padding in the button.
|
|
57
57
|
*/
|
|
58
58
|
spacing?: Spacing;
|
|
59
59
|
/**
|
|
60
|
-
* Pass target down to
|
|
60
|
+
* Pass target down to the button. If a href is provided, this will be a semantic link styled as a button.
|
|
61
61
|
*/
|
|
62
62
|
target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
63
63
|
/**
|
|
64
|
-
* Pass type down to
|
|
64
|
+
* Pass type down to the button.
|
|
65
65
|
*/
|
|
66
66
|
type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
67
67
|
/**
|
|
68
|
-
* Option to fit button width to its parent width
|
|
68
|
+
* Option to fit button width to its parent width.
|
|
69
69
|
*/
|
|
70
70
|
shouldFitContainer?: boolean;
|
|
71
71
|
/**
|
|
72
|
-
* Text content to be rendered in the button
|
|
72
|
+
* Text content to be rendered in the button.
|
|
73
73
|
*/
|
|
74
74
|
children?: React.ReactNode;
|
|
75
75
|
/**
|
|
76
|
-
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
76
|
+
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
77
77
|
*/
|
|
78
78
|
testId?: string;
|
|
79
79
|
component?: React.ComponentType<React.AllHTMLAttributes<HTMLElement>> | React.ElementType;
|
|
80
80
|
/**
|
|
81
81
|
* An optional name used to identify this component to press listeners. For example, interaction tracing. For more information,
|
|
82
|
-
* see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration)
|
|
82
|
+
* see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
|
|
83
83
|
*/
|
|
84
84
|
interactionName?: string;
|
|
85
85
|
/**
|
|
86
|
-
* Additional information to be included in the `context` of analytics events that come from button
|
|
86
|
+
* Additional information to be included in the `context` of analytics events that come from button.
|
|
87
87
|
*/
|
|
88
88
|
analyticsContext?: Record<string, any>;
|
|
89
89
|
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type SupportedElements,
|
|
5
5
|
} from '../../../../src/new-button/variants/types';
|
|
6
6
|
|
|
7
|
-
export default function
|
|
7
|
+
export default function CommonDefaultButtonProps(
|
|
8
8
|
props: CommonButtonProps<SupportedElements> & CommonDefaultButtonProps,
|
|
9
9
|
) {
|
|
10
10
|
return null;
|
package/package.json
CHANGED