@atlaskit/button 17.6.1 → 17.7.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 +14 -0
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/cjs/utils/spacing.js +3 -3
- package/dist/cjs/utils/variants.js +9 -4
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/es2019/utils/spacing.js +3 -2
- package/dist/es2019/utils/variants.js +9 -4
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/esm/utils/spacing.js +3 -2
- package/dist/esm/utils/variants.js +9 -4
- package/dist/types/new-button/variants/default/types.d.ts +5 -1
- package/dist/types/new-button/variants/icon/types.d.ts +5 -1
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +3 -2
- package/dist/types/new-button/variants/types.d.ts +3 -5
- package/dist/types/utils/spacing.d.ts +3 -2
- package/dist/types/utils/variants.d.ts +5 -0
- package/dist/types-ts4.5/new-button/variants/default/types.d.ts +5 -1
- package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +5 -1
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +3 -2
- package/dist/types-ts4.5/new-button/variants/types.d.ts +3 -5
- package/dist/types-ts4.5/utils/spacing.d.ts +3 -2
- package/dist/types-ts4.5/utils/variants.d.ts +5 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 17.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#73843](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/73843) [`9a090e6e7733`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9a090e6e7733) - The new icon button incorrectly supported `spacing="none"`. This release removes support for this, leaving `"default"` and `"compact"` as the only two options.
|
|
8
|
+
|
|
9
|
+
The icon button docs have also been updated to better reflect the intended use of the `label` prop instead of `aria-label`. The `label` prop is designed to abstract the technical implementation for accessibility requirements. The new icon button does not use the `aria-label` attribute under the hood, rather it relys on visually hidden text instead. This is done for accessibility reasons as `aria-label` is not always translated whereas visually hidden text will be.
|
|
10
|
+
|
|
11
|
+
## 17.6.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#77547](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77547) [`cce378569da1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cce378569da1) - Migration documentation for changing from old to new button components. Documentation-only change.
|
|
16
|
+
|
|
3
17
|
## 17.6.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -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: "
|
|
120
|
+
packageVersion: "17.7.0",
|
|
121
121
|
analyticsData: analyticsContext
|
|
122
122
|
});
|
|
123
123
|
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var
|
|
8
|
-
var
|
|
6
|
+
exports.iconButtonSpacing = exports.buttonSpacing = void 0;
|
|
7
|
+
var buttonSpacing = exports.buttonSpacing = ['default', 'compact', 'none'];
|
|
8
|
+
var iconButtonSpacing = exports.iconButtonSpacing = ['default', 'compact'];
|
|
@@ -15,6 +15,7 @@ var _link = _interopRequireDefault(require("../new-button/variants/default/link"
|
|
|
15
15
|
var _button2 = _interopRequireDefault(require("../new-button/variants/icon/button"));
|
|
16
16
|
var _link2 = _interopRequireDefault(require("../new-button/variants/icon/link"));
|
|
17
17
|
var _appearances = require("./appearances");
|
|
18
|
+
var _spacing = require("./spacing");
|
|
18
19
|
var _excluded = ["href", "children"],
|
|
19
20
|
_excluded2 = ["icon", "label"],
|
|
20
21
|
_excluded3 = ["href", "icon", "label"];
|
|
@@ -62,22 +63,26 @@ var variants = [{
|
|
|
62
63
|
name: 'Button',
|
|
63
64
|
Component: _button.default,
|
|
64
65
|
elementType: HTMLButtonElement,
|
|
65
|
-
appearances: _appearances.buttonAppearances
|
|
66
|
+
appearances: _appearances.buttonAppearances,
|
|
67
|
+
spacing: _spacing.buttonSpacing
|
|
66
68
|
}, {
|
|
67
69
|
name: 'LinkButton',
|
|
68
70
|
Component: LinkButtonRender,
|
|
69
71
|
elementType: HTMLAnchorElement,
|
|
70
|
-
appearances: _appearances.linkButtonAppearances
|
|
72
|
+
appearances: _appearances.linkButtonAppearances,
|
|
73
|
+
spacing: _spacing.buttonSpacing
|
|
71
74
|
}, {
|
|
72
75
|
name: 'IconButton',
|
|
73
76
|
Component: IconButtonRender,
|
|
74
77
|
elementType: HTMLButtonElement,
|
|
75
|
-
appearances: _appearances.iconButtonAppearances
|
|
78
|
+
appearances: _appearances.iconButtonAppearances,
|
|
79
|
+
spacing: _spacing.iconButtonSpacing
|
|
76
80
|
}, {
|
|
77
81
|
name: 'LinkIconButton',
|
|
78
82
|
Component: LinkIconButtonRender,
|
|
79
83
|
elementType: HTMLAnchorElement,
|
|
80
|
-
appearances: _appearances.iconButtonAppearances
|
|
84
|
+
appearances: _appearances.iconButtonAppearances,
|
|
85
|
+
spacing: _spacing.iconButtonSpacing
|
|
81
86
|
}];
|
|
82
87
|
var defaultButtonVariants = exports.defaultButtonVariants = variants.filter(function (_ref4) {
|
|
83
88
|
var name = _ref4.name;
|
|
@@ -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: "
|
|
105
|
+
packageVersion: "17.7.0",
|
|
106
106
|
analyticsData: analyticsContext
|
|
107
107
|
});
|
|
108
108
|
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const buttonSpacing = ['default', 'compact', 'none'];
|
|
2
|
+
const iconButtonSpacing = ['default', 'compact'];
|
|
3
|
+
export { buttonSpacing, iconButtonSpacing };
|
|
@@ -6,6 +6,7 @@ import LinkButton from '../new-button/variants/default/link';
|
|
|
6
6
|
import IconButton from '../new-button/variants/icon/button';
|
|
7
7
|
import LinkIconButton from '../new-button/variants/icon/link';
|
|
8
8
|
import { buttonAppearances, iconButtonAppearances, linkButtonAppearances } from './appearances';
|
|
9
|
+
import { buttonSpacing, iconButtonSpacing } from './spacing';
|
|
9
10
|
// Add required default props to variants
|
|
10
11
|
const LinkButtonRender = /*#__PURE__*/forwardRef(({
|
|
11
12
|
href = 'home',
|
|
@@ -39,22 +40,26 @@ const variants = [{
|
|
|
39
40
|
name: 'Button',
|
|
40
41
|
Component: Button,
|
|
41
42
|
elementType: HTMLButtonElement,
|
|
42
|
-
appearances: buttonAppearances
|
|
43
|
+
appearances: buttonAppearances,
|
|
44
|
+
spacing: buttonSpacing
|
|
43
45
|
}, {
|
|
44
46
|
name: 'LinkButton',
|
|
45
47
|
Component: LinkButtonRender,
|
|
46
48
|
elementType: HTMLAnchorElement,
|
|
47
|
-
appearances: linkButtonAppearances
|
|
49
|
+
appearances: linkButtonAppearances,
|
|
50
|
+
spacing: buttonSpacing
|
|
48
51
|
}, {
|
|
49
52
|
name: 'IconButton',
|
|
50
53
|
Component: IconButtonRender,
|
|
51
54
|
elementType: HTMLButtonElement,
|
|
52
|
-
appearances: iconButtonAppearances
|
|
55
|
+
appearances: iconButtonAppearances,
|
|
56
|
+
spacing: iconButtonSpacing
|
|
53
57
|
}, {
|
|
54
58
|
name: 'LinkIconButton',
|
|
55
59
|
Component: LinkIconButtonRender,
|
|
56
60
|
elementType: HTMLAnchorElement,
|
|
57
|
-
appearances: iconButtonAppearances
|
|
61
|
+
appearances: iconButtonAppearances,
|
|
62
|
+
spacing: iconButtonSpacing
|
|
58
63
|
}];
|
|
59
64
|
export const defaultButtonVariants = variants.filter(({
|
|
60
65
|
name
|
|
@@ -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: "
|
|
111
|
+
packageVersion: "17.7.0",
|
|
112
112
|
analyticsData: analyticsContext
|
|
113
113
|
});
|
|
114
114
|
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var buttonSpacing = ['default', 'compact', 'none'];
|
|
2
|
+
var iconButtonSpacing = ['default', 'compact'];
|
|
3
|
+
export { buttonSpacing, iconButtonSpacing };
|
|
@@ -10,6 +10,7 @@ import LinkButton from '../new-button/variants/default/link';
|
|
|
10
10
|
import IconButton from '../new-button/variants/icon/button';
|
|
11
11
|
import LinkIconButton from '../new-button/variants/icon/link';
|
|
12
12
|
import { buttonAppearances, iconButtonAppearances, linkButtonAppearances } from './appearances';
|
|
13
|
+
import { buttonSpacing, iconButtonSpacing } from './spacing';
|
|
13
14
|
// Add required default props to variants
|
|
14
15
|
var LinkButtonRender = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
15
16
|
var _ref$href = _ref.href,
|
|
@@ -52,22 +53,26 @@ var variants = [{
|
|
|
52
53
|
name: 'Button',
|
|
53
54
|
Component: Button,
|
|
54
55
|
elementType: HTMLButtonElement,
|
|
55
|
-
appearances: buttonAppearances
|
|
56
|
+
appearances: buttonAppearances,
|
|
57
|
+
spacing: buttonSpacing
|
|
56
58
|
}, {
|
|
57
59
|
name: 'LinkButton',
|
|
58
60
|
Component: LinkButtonRender,
|
|
59
61
|
elementType: HTMLAnchorElement,
|
|
60
|
-
appearances: linkButtonAppearances
|
|
62
|
+
appearances: linkButtonAppearances,
|
|
63
|
+
spacing: buttonSpacing
|
|
61
64
|
}, {
|
|
62
65
|
name: 'IconButton',
|
|
63
66
|
Component: IconButtonRender,
|
|
64
67
|
elementType: HTMLButtonElement,
|
|
65
|
-
appearances: iconButtonAppearances
|
|
68
|
+
appearances: iconButtonAppearances,
|
|
69
|
+
spacing: iconButtonSpacing
|
|
66
70
|
}, {
|
|
67
71
|
name: 'LinkIconButton',
|
|
68
72
|
Component: LinkIconButtonRender,
|
|
69
73
|
elementType: HTMLAnchorElement,
|
|
70
|
-
appearances: iconButtonAppearances
|
|
74
|
+
appearances: iconButtonAppearances,
|
|
75
|
+
spacing: iconButtonSpacing
|
|
71
76
|
}];
|
|
72
77
|
export var defaultButtonVariants = variants.filter(function (_ref4) {
|
|
73
78
|
var name = _ref4.name;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type IconProp, type IconSize } from '../types';
|
|
2
|
+
import { type ButtonSpacing, type IconProp, type IconSize } from '../types';
|
|
3
3
|
export type CommonDefaultButtonProps = {
|
|
4
4
|
/**
|
|
5
5
|
* Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
|
|
@@ -27,4 +27,8 @@ export type CommonDefaultButtonProps = {
|
|
|
27
27
|
* Option to fit button width to its parent width.
|
|
28
28
|
*/
|
|
29
29
|
shouldFitContainer?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Controls the amount of padding in the button.
|
|
32
|
+
*/
|
|
33
|
+
spacing?: ButtonSpacing;
|
|
30
34
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IconButtonAppearance, type IconProp, type IconSize } from '../types';
|
|
1
|
+
import { type IconButtonAppearance, type IconButtonSpacing, type IconProp, type IconSize } from '../types';
|
|
2
2
|
export type CommonIconButtonProps = {
|
|
3
3
|
/**
|
|
4
4
|
* The button style variation.
|
|
@@ -17,6 +17,10 @@ export type CommonIconButtonProps = {
|
|
|
17
17
|
* Set the shape of the icon, defaults to square with rounded corners.
|
|
18
18
|
*/
|
|
19
19
|
shape?: 'default' | 'circle';
|
|
20
|
+
/**
|
|
21
|
+
* Controls the amount of padding in the button.
|
|
22
|
+
*/
|
|
23
|
+
spacing?: IconButtonSpacing;
|
|
20
24
|
/**
|
|
21
25
|
* Set the size of the icon. `medium` is default, so it does not need to be specified.
|
|
22
26
|
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { xcss } from '@atlaskit/primitives';
|
|
3
|
-
import { type Appearance, type CommonButtonProps } from '../types';
|
|
3
|
+
import { type Appearance, type CommonButtonProps, type Spacing } from '../types';
|
|
4
4
|
export type ControlledEvents<TagName extends HTMLElement> = Pick<React.DOMAttributes<TagName>, 'onMouseDownCapture' | 'onMouseUpCapture' | 'onKeyDownCapture' | 'onKeyUpCapture' | 'onTouchStartCapture' | 'onTouchEndCapture' | 'onPointerDownCapture' | 'onPointerUpCapture' | 'onClickCapture'> & Pick<CommonButtonProps<TagName>, 'onClick'>;
|
|
5
5
|
export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
6
6
|
ref: React.Ref<TagName>;
|
|
@@ -15,7 +15,8 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
15
15
|
shouldFitContainer?: boolean;
|
|
16
16
|
appearance?: Appearance;
|
|
17
17
|
children: React.ReactNode;
|
|
18
|
-
|
|
18
|
+
spacing?: Spacing;
|
|
19
|
+
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay'> & ControlledEvents<TagName>;
|
|
19
20
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
20
21
|
xcss: ReturnType<typeof xcss>;
|
|
21
22
|
ref(node: TagName | null): void;
|
|
@@ -5,7 +5,9 @@ export type ButtonAppearance = 'default' | 'danger' | 'primary' | 'subtle' | 'wa
|
|
|
5
5
|
export type LinkButtonAppearance = 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
|
|
6
6
|
export type IconButtonAppearance = 'default' | 'primary' | 'subtle';
|
|
7
7
|
export type Appearance = ButtonAppearance | LinkButtonAppearance | IconButtonAppearance;
|
|
8
|
-
export type
|
|
8
|
+
export type ButtonSpacing = 'compact' | 'default' | 'none';
|
|
9
|
+
export type IconButtonSpacing = 'compact' | 'default';
|
|
10
|
+
export type Spacing = ButtonSpacing | IconButtonSpacing;
|
|
9
11
|
export type IconProp = React.ComponentType<IconProps>;
|
|
10
12
|
export type IconSize = 'small' | 'large' | 'xlarge';
|
|
11
13
|
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
@@ -38,10 +40,6 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
|
38
40
|
* Handler to be called on focus.
|
|
39
41
|
*/
|
|
40
42
|
onFocus?: React.FocusEventHandler<TagName>;
|
|
41
|
-
/**
|
|
42
|
-
* Controls the amount of padding in the button.
|
|
43
|
-
*/
|
|
44
|
-
spacing?: Spacing;
|
|
45
43
|
/**
|
|
46
44
|
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
47
45
|
*/
|
|
@@ -4,29 +4,34 @@ import { LinkButtonProps } from '../new-button/variants/default/link';
|
|
|
4
4
|
import { type IconButtonProps } from '../new-button/variants/icon/button';
|
|
5
5
|
import { type LinkIconButtonProps } from '../new-button/variants/icon/link';
|
|
6
6
|
import { buttonAppearances, iconButtonAppearances, linkButtonAppearances } from './appearances';
|
|
7
|
+
import { buttonSpacing, iconButtonSpacing } from './spacing';
|
|
7
8
|
type DefaultButtonVariant = {
|
|
8
9
|
name: 'Button';
|
|
9
10
|
Component: typeof Button;
|
|
10
11
|
elementType: typeof HTMLButtonElement;
|
|
11
12
|
appearances: typeof buttonAppearances;
|
|
13
|
+
spacing: typeof buttonSpacing;
|
|
12
14
|
};
|
|
13
15
|
type LinkButtonVariant = {
|
|
14
16
|
name: 'LinkButton';
|
|
15
17
|
Component: typeof LinkButtonRender;
|
|
16
18
|
elementType: typeof HTMLAnchorElement;
|
|
17
19
|
appearances: typeof linkButtonAppearances;
|
|
20
|
+
spacing: typeof buttonSpacing;
|
|
18
21
|
};
|
|
19
22
|
type IconButtonVariant = {
|
|
20
23
|
name: 'IconButton';
|
|
21
24
|
Component: typeof IconButtonRender;
|
|
22
25
|
elementType: typeof HTMLButtonElement;
|
|
23
26
|
appearances: typeof iconButtonAppearances;
|
|
27
|
+
spacing: typeof iconButtonSpacing;
|
|
24
28
|
};
|
|
25
29
|
type LinkIconButtonVariant = {
|
|
26
30
|
name: 'LinkIconButton';
|
|
27
31
|
Component: typeof LinkIconButtonRender;
|
|
28
32
|
elementType: typeof HTMLAnchorElement;
|
|
29
33
|
appearances: typeof iconButtonAppearances;
|
|
34
|
+
spacing: typeof iconButtonSpacing;
|
|
30
35
|
};
|
|
31
36
|
type DefaultButtonVariants = DefaultButtonVariant | LinkButtonVariant;
|
|
32
37
|
type LinkButtonVariants = LinkButtonVariant | LinkIconButtonVariant;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type IconProp, type IconSize } from '../types';
|
|
2
|
+
import { type ButtonSpacing, type IconProp, type IconSize } from '../types';
|
|
3
3
|
export type CommonDefaultButtonProps = {
|
|
4
4
|
/**
|
|
5
5
|
* Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
|
|
@@ -27,4 +27,8 @@ export type CommonDefaultButtonProps = {
|
|
|
27
27
|
* Option to fit button width to its parent width.
|
|
28
28
|
*/
|
|
29
29
|
shouldFitContainer?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Controls the amount of padding in the button.
|
|
32
|
+
*/
|
|
33
|
+
spacing?: ButtonSpacing;
|
|
30
34
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IconButtonAppearance, type IconProp, type IconSize } from '../types';
|
|
1
|
+
import { type IconButtonAppearance, type IconButtonSpacing, type IconProp, type IconSize } from '../types';
|
|
2
2
|
export type CommonIconButtonProps = {
|
|
3
3
|
/**
|
|
4
4
|
* The button style variation.
|
|
@@ -17,6 +17,10 @@ export type CommonIconButtonProps = {
|
|
|
17
17
|
* Set the shape of the icon, defaults to square with rounded corners.
|
|
18
18
|
*/
|
|
19
19
|
shape?: 'default' | 'circle';
|
|
20
|
+
/**
|
|
21
|
+
* Controls the amount of padding in the button.
|
|
22
|
+
*/
|
|
23
|
+
spacing?: IconButtonSpacing;
|
|
20
24
|
/**
|
|
21
25
|
* Set the size of the icon. `medium` is default, so it does not need to be specified.
|
|
22
26
|
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { xcss } from '@atlaskit/primitives';
|
|
3
|
-
import { type Appearance, type CommonButtonProps } from '../types';
|
|
3
|
+
import { type Appearance, type CommonButtonProps, type Spacing } from '../types';
|
|
4
4
|
export type ControlledEvents<TagName extends HTMLElement> = Pick<React.DOMAttributes<TagName>, 'onMouseDownCapture' | 'onMouseUpCapture' | 'onKeyDownCapture' | 'onKeyUpCapture' | 'onTouchStartCapture' | 'onTouchEndCapture' | 'onPointerDownCapture' | 'onPointerUpCapture' | 'onClickCapture'> & Pick<CommonButtonProps<TagName>, 'onClick'>;
|
|
5
5
|
export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
6
6
|
ref: React.Ref<TagName>;
|
|
@@ -15,7 +15,8 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
15
15
|
shouldFitContainer?: boolean;
|
|
16
16
|
appearance?: Appearance;
|
|
17
17
|
children: React.ReactNode;
|
|
18
|
-
|
|
18
|
+
spacing?: Spacing;
|
|
19
|
+
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay'> & ControlledEvents<TagName>;
|
|
19
20
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
20
21
|
xcss: ReturnType<typeof xcss>;
|
|
21
22
|
ref(node: TagName | null): void;
|
|
@@ -5,7 +5,9 @@ export type ButtonAppearance = 'default' | 'danger' | 'primary' | 'subtle' | 'wa
|
|
|
5
5
|
export type LinkButtonAppearance = 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
|
|
6
6
|
export type IconButtonAppearance = 'default' | 'primary' | 'subtle';
|
|
7
7
|
export type Appearance = ButtonAppearance | LinkButtonAppearance | IconButtonAppearance;
|
|
8
|
-
export type
|
|
8
|
+
export type ButtonSpacing = 'compact' | 'default' | 'none';
|
|
9
|
+
export type IconButtonSpacing = 'compact' | 'default';
|
|
10
|
+
export type Spacing = ButtonSpacing | IconButtonSpacing;
|
|
9
11
|
export type IconProp = React.ComponentType<IconProps>;
|
|
10
12
|
export type IconSize = 'small' | 'large' | 'xlarge';
|
|
11
13
|
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
@@ -38,10 +40,6 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
|
38
40
|
* Handler to be called on focus.
|
|
39
41
|
*/
|
|
40
42
|
onFocus?: React.FocusEventHandler<TagName>;
|
|
41
|
-
/**
|
|
42
|
-
* Controls the amount of padding in the button.
|
|
43
|
-
*/
|
|
44
|
-
spacing?: Spacing;
|
|
45
43
|
/**
|
|
46
44
|
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
47
45
|
*/
|
|
@@ -4,29 +4,34 @@ import { LinkButtonProps } from '../new-button/variants/default/link';
|
|
|
4
4
|
import { type IconButtonProps } from '../new-button/variants/icon/button';
|
|
5
5
|
import { type LinkIconButtonProps } from '../new-button/variants/icon/link';
|
|
6
6
|
import { buttonAppearances, iconButtonAppearances, linkButtonAppearances } from './appearances';
|
|
7
|
+
import { buttonSpacing, iconButtonSpacing } from './spacing';
|
|
7
8
|
type DefaultButtonVariant = {
|
|
8
9
|
name: 'Button';
|
|
9
10
|
Component: typeof Button;
|
|
10
11
|
elementType: typeof HTMLButtonElement;
|
|
11
12
|
appearances: typeof buttonAppearances;
|
|
13
|
+
spacing: typeof buttonSpacing;
|
|
12
14
|
};
|
|
13
15
|
type LinkButtonVariant = {
|
|
14
16
|
name: 'LinkButton';
|
|
15
17
|
Component: typeof LinkButtonRender;
|
|
16
18
|
elementType: typeof HTMLAnchorElement;
|
|
17
19
|
appearances: typeof linkButtonAppearances;
|
|
20
|
+
spacing: typeof buttonSpacing;
|
|
18
21
|
};
|
|
19
22
|
type IconButtonVariant = {
|
|
20
23
|
name: 'IconButton';
|
|
21
24
|
Component: typeof IconButtonRender;
|
|
22
25
|
elementType: typeof HTMLButtonElement;
|
|
23
26
|
appearances: typeof iconButtonAppearances;
|
|
27
|
+
spacing: typeof iconButtonSpacing;
|
|
24
28
|
};
|
|
25
29
|
type LinkIconButtonVariant = {
|
|
26
30
|
name: 'LinkIconButton';
|
|
27
31
|
Component: typeof LinkIconButtonRender;
|
|
28
32
|
elementType: typeof HTMLAnchorElement;
|
|
29
33
|
appearances: typeof iconButtonAppearances;
|
|
34
|
+
spacing: typeof iconButtonSpacing;
|
|
30
35
|
};
|
|
31
36
|
type DefaultButtonVariants = DefaultButtonVariant | LinkButtonVariant;
|
|
32
37
|
type LinkButtonVariants = LinkButtonVariant | LinkIconButtonVariant;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.7.0",
|
|
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/"
|
|
@@ -144,4 +144,4 @@
|
|
|
144
144
|
},
|
|
145
145
|
"homepage": "https://atlassian.design/components/button/",
|
|
146
146
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
147
|
-
}
|
|
147
|
+
}
|