@atlaskit/button 16.16.1 → 16.17.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 +6 -0
- package/dist/cjs/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/cjs/utils/appearances.js +3 -3
- package/dist/cjs/utils/variants.js +20 -14
- package/dist/es2019/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/es2019/utils/appearances.js +3 -2
- package/dist/es2019/utils/variants.js +19 -13
- package/dist/esm/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/esm/utils/appearances.js +3 -2
- package/dist/esm/utils/variants.js +19 -13
- package/dist/types/new-button/variants/default/button.d.ts +1 -1
- package/dist/types/new-button/variants/icon/button.d.ts +1 -1
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +3 -2
- package/dist/types/new-button/variants/types.d.ts +13 -6
- package/dist/types/utils/appearances.d.ts +4 -3
- package/dist/types/utils/variants.d.ts +14 -8
- package/dist/types-ts4.5/new-button/variants/default/button.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/icon/button.d.ts +1 -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 +13 -6
- package/dist/types-ts4.5/utils/appearances.d.ts +4 -3
- package/dist/types-ts4.5/utils/variants.d.ts +14 -8
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 16.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#43311](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43311) [`8764ee956ae`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8764ee956ae) - [ux] Remove `appearance` prop options `link` and `subtle-link` from the new Button (in Alpha). They are now reserved for the new LinkButton component
|
|
8
|
+
|
|
3
9
|
## 16.16.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -115,7 +115,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
115
115
|
action: 'clicked',
|
|
116
116
|
componentName: 'button',
|
|
117
117
|
packageName: "@atlaskit/button",
|
|
118
|
-
packageVersion: "16.
|
|
118
|
+
packageVersion: "16.17.0",
|
|
119
119
|
analyticsData: analyticsContext,
|
|
120
120
|
actionSubject: buttonType
|
|
121
121
|
});
|
|
@@ -118,7 +118,7 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
|
|
|
118
118
|
action: 'clicked',
|
|
119
119
|
componentName: 'button',
|
|
120
120
|
packageName: "@atlaskit/button",
|
|
121
|
-
packageVersion: "16.
|
|
121
|
+
packageVersion: "16.17.0",
|
|
122
122
|
analyticsData: analyticsContext
|
|
123
123
|
});
|
|
124
124
|
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var
|
|
8
|
-
var
|
|
6
|
+
exports.linkButtonAppearances = exports.buttonAppearances = void 0;
|
|
7
|
+
var buttonAppearances = exports.buttonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger'];
|
|
8
|
+
var linkButtonAppearances = exports.linkButtonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger', 'link', 'subtle-link'];
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.linkButtonVariants = exports.default = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -13,6 +13,7 @@ var _add = _interopRequireDefault(require("@atlaskit/icon/glyph/add"));
|
|
|
13
13
|
var _button = _interopRequireDefault(require("../new-button/variants/default/button"));
|
|
14
14
|
var _link = _interopRequireDefault(require("../new-button/variants/default/link"));
|
|
15
15
|
var _link2 = _interopRequireDefault(require("../new-button/variants/icon/link"));
|
|
16
|
+
var _appearances = require("../utils/appearances");
|
|
16
17
|
var _excluded = ["href", "children"],
|
|
17
18
|
_excluded2 = ["href", "children", "icon"]; // eslint-disable-next-line import/no-extraneous-dependencies
|
|
18
19
|
// import IconButton, {
|
|
@@ -65,14 +66,28 @@ var LinkIconButtonRender = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2,
|
|
|
65
66
|
href: href
|
|
66
67
|
}, rest), children);
|
|
67
68
|
});
|
|
68
|
-
var
|
|
69
|
+
var linkButtonVariants = exports.linkButtonVariants = [{
|
|
70
|
+
name: 'LinkButton',
|
|
71
|
+
Component: LinkButtonRender,
|
|
72
|
+
elementType: HTMLAnchorElement,
|
|
73
|
+
appearances: _appearances.linkButtonAppearances
|
|
74
|
+
}, {
|
|
75
|
+
name: 'LinkIconButton',
|
|
76
|
+
Component: LinkIconButtonRender,
|
|
77
|
+
elementType: HTMLAnchorElement,
|
|
78
|
+
// TODO: Make specific to icon button
|
|
79
|
+
appearances: _appearances.linkButtonAppearances
|
|
80
|
+
}];
|
|
81
|
+
var variants = [{
|
|
69
82
|
name: 'Button',
|
|
70
83
|
Component: _button.default,
|
|
71
|
-
elementType: HTMLButtonElement
|
|
84
|
+
elementType: HTMLButtonElement,
|
|
85
|
+
appearances: _appearances.buttonAppearances
|
|
72
86
|
}, {
|
|
73
87
|
name: 'LinkButton',
|
|
74
88
|
Component: LinkButtonRender,
|
|
75
|
-
elementType: HTMLAnchorElement
|
|
89
|
+
elementType: HTMLAnchorElement,
|
|
90
|
+
appearances: _appearances.linkButtonAppearances
|
|
76
91
|
}
|
|
77
92
|
// TODO: Enable icon buttons in tests once it's ready
|
|
78
93
|
// {
|
|
@@ -86,13 +101,4 @@ var variants = exports.variants = [{
|
|
|
86
101
|
// elementType: HTMLAnchorElement,
|
|
87
102
|
// },
|
|
88
103
|
];
|
|
89
|
-
var _default = exports.default = variants;
|
|
90
|
-
var linkButtonVariants = exports.linkButtonVariants = [{
|
|
91
|
-
name: 'LinkButton',
|
|
92
|
-
Component: LinkButtonRender,
|
|
93
|
-
elementType: HTMLAnchorElement
|
|
94
|
-
}, {
|
|
95
|
-
name: 'LinkIconButton',
|
|
96
|
-
Component: LinkIconButtonRender,
|
|
97
|
-
elementType: HTMLAnchorElement
|
|
98
|
-
}];
|
|
104
|
+
var _default = exports.default = variants;
|
|
@@ -103,7 +103,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
103
103
|
action: 'clicked',
|
|
104
104
|
componentName: 'button',
|
|
105
105
|
packageName: "@atlaskit/button",
|
|
106
|
-
packageVersion: "16.
|
|
106
|
+
packageVersion: "16.17.0",
|
|
107
107
|
analyticsData: analyticsContext
|
|
108
108
|
});
|
|
109
109
|
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const buttonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger'];
|
|
2
|
+
const linkButtonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger', 'link', 'subtle-link'];
|
|
3
|
+
export { buttonAppearances, linkButtonAppearances };
|
|
@@ -9,6 +9,7 @@ import LinkButton from '../new-button/variants/default/link';
|
|
|
9
9
|
// IconButtonProps,
|
|
10
10
|
// } from '../new-button/variants/icon/button';
|
|
11
11
|
import LinkIconButton from '../new-button/variants/icon/link';
|
|
12
|
+
import { buttonAppearances, linkButtonAppearances } from '../utils/appearances';
|
|
12
13
|
// Add required default props to variants
|
|
13
14
|
const LinkButtonRender = /*#__PURE__*/forwardRef(({
|
|
14
15
|
href = 'home',
|
|
@@ -49,14 +50,28 @@ const LinkIconButtonRender = /*#__PURE__*/forwardRef(({
|
|
|
49
50
|
icon: icon,
|
|
50
51
|
href: href
|
|
51
52
|
}, rest), children));
|
|
52
|
-
export const
|
|
53
|
+
export const linkButtonVariants = [{
|
|
54
|
+
name: 'LinkButton',
|
|
55
|
+
Component: LinkButtonRender,
|
|
56
|
+
elementType: HTMLAnchorElement,
|
|
57
|
+
appearances: linkButtonAppearances
|
|
58
|
+
}, {
|
|
59
|
+
name: 'LinkIconButton',
|
|
60
|
+
Component: LinkIconButtonRender,
|
|
61
|
+
elementType: HTMLAnchorElement,
|
|
62
|
+
// TODO: Make specific to icon button
|
|
63
|
+
appearances: linkButtonAppearances
|
|
64
|
+
}];
|
|
65
|
+
const variants = [{
|
|
53
66
|
name: 'Button',
|
|
54
67
|
Component: Button,
|
|
55
|
-
elementType: HTMLButtonElement
|
|
68
|
+
elementType: HTMLButtonElement,
|
|
69
|
+
appearances: buttonAppearances
|
|
56
70
|
}, {
|
|
57
71
|
name: 'LinkButton',
|
|
58
72
|
Component: LinkButtonRender,
|
|
59
|
-
elementType: HTMLAnchorElement
|
|
73
|
+
elementType: HTMLAnchorElement,
|
|
74
|
+
appearances: linkButtonAppearances
|
|
60
75
|
}
|
|
61
76
|
// TODO: Enable icon buttons in tests once it's ready
|
|
62
77
|
// {
|
|
@@ -71,13 +86,4 @@ export const variants = [{
|
|
|
71
86
|
// },
|
|
72
87
|
];
|
|
73
88
|
|
|
74
|
-
export default variants;
|
|
75
|
-
export const linkButtonVariants = [{
|
|
76
|
-
name: 'LinkButton',
|
|
77
|
-
Component: LinkButtonRender,
|
|
78
|
-
elementType: HTMLAnchorElement
|
|
79
|
-
}, {
|
|
80
|
-
name: 'LinkIconButton',
|
|
81
|
-
Component: LinkIconButtonRender,
|
|
82
|
-
elementType: HTMLAnchorElement
|
|
83
|
-
}];
|
|
89
|
+
export default variants;
|
|
@@ -107,7 +107,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
107
107
|
action: 'clicked',
|
|
108
108
|
componentName: 'button',
|
|
109
109
|
packageName: "@atlaskit/button",
|
|
110
|
-
packageVersion: "16.
|
|
110
|
+
packageVersion: "16.17.0",
|
|
111
111
|
analyticsData: analyticsContext,
|
|
112
112
|
actionSubject: buttonType
|
|
113
113
|
});
|
|
@@ -109,7 +109,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
109
109
|
action: 'clicked',
|
|
110
110
|
componentName: 'button',
|
|
111
111
|
packageName: "@atlaskit/button",
|
|
112
|
-
packageVersion: "16.
|
|
112
|
+
packageVersion: "16.17.0",
|
|
113
113
|
analyticsData: analyticsContext
|
|
114
114
|
});
|
|
115
115
|
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var buttonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger'];
|
|
2
|
+
var linkButtonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger', 'link', 'subtle-link'];
|
|
3
|
+
export { buttonAppearances, linkButtonAppearances };
|
|
@@ -12,6 +12,7 @@ import LinkButton from '../new-button/variants/default/link';
|
|
|
12
12
|
// IconButtonProps,
|
|
13
13
|
// } from '../new-button/variants/icon/button';
|
|
14
14
|
import LinkIconButton from '../new-button/variants/icon/link';
|
|
15
|
+
import { buttonAppearances, linkButtonAppearances } from '../utils/appearances';
|
|
15
16
|
// Add required default props to variants
|
|
16
17
|
var LinkButtonRender = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
17
18
|
var _ref$href = _ref.href,
|
|
@@ -57,14 +58,28 @@ var LinkIconButtonRender = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
57
58
|
href: href
|
|
58
59
|
}, rest), children);
|
|
59
60
|
});
|
|
60
|
-
export var
|
|
61
|
+
export var linkButtonVariants = [{
|
|
62
|
+
name: 'LinkButton',
|
|
63
|
+
Component: LinkButtonRender,
|
|
64
|
+
elementType: HTMLAnchorElement,
|
|
65
|
+
appearances: linkButtonAppearances
|
|
66
|
+
}, {
|
|
67
|
+
name: 'LinkIconButton',
|
|
68
|
+
Component: LinkIconButtonRender,
|
|
69
|
+
elementType: HTMLAnchorElement,
|
|
70
|
+
// TODO: Make specific to icon button
|
|
71
|
+
appearances: linkButtonAppearances
|
|
72
|
+
}];
|
|
73
|
+
var variants = [{
|
|
61
74
|
name: 'Button',
|
|
62
75
|
Component: Button,
|
|
63
|
-
elementType: HTMLButtonElement
|
|
76
|
+
elementType: HTMLButtonElement,
|
|
77
|
+
appearances: buttonAppearances
|
|
64
78
|
}, {
|
|
65
79
|
name: 'LinkButton',
|
|
66
80
|
Component: LinkButtonRender,
|
|
67
|
-
elementType: HTMLAnchorElement
|
|
81
|
+
elementType: HTMLAnchorElement,
|
|
82
|
+
appearances: linkButtonAppearances
|
|
68
83
|
}
|
|
69
84
|
// TODO: Enable icon buttons in tests once it's ready
|
|
70
85
|
// {
|
|
@@ -79,13 +94,4 @@ export var variants = [{
|
|
|
79
94
|
// },
|
|
80
95
|
];
|
|
81
96
|
|
|
82
|
-
export default variants;
|
|
83
|
-
export var linkButtonVariants = [{
|
|
84
|
-
name: 'LinkButton',
|
|
85
|
-
Component: LinkButtonRender,
|
|
86
|
-
elementType: HTMLAnchorElement
|
|
87
|
-
}, {
|
|
88
|
-
name: 'LinkIconButton',
|
|
89
|
-
Component: LinkIconButtonRender,
|
|
90
|
-
elementType: HTMLAnchorElement
|
|
91
|
-
}];
|
|
97
|
+
export default variants;
|
|
@@ -13,5 +13,5 @@ export type ButtonProps = CommonDefaultButtonProps & CommonButtonVariantProps;
|
|
|
13
13
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
14
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
15
|
*/
|
|
16
|
-
declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
16
|
+
declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & import("../types").AdditionalButtonVariantProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
17
17
|
export default Button;
|
|
@@ -13,5 +13,5 @@ export type IconButtonProps = CommonIconButtonProps & CommonButtonVariantProps;
|
|
|
13
13
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
14
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
15
|
*/
|
|
16
|
-
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
16
|
+
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & import("../types").AdditionalButtonVariantProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
17
17
|
export default IconButton;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { xcss } from '@atlaskit/primitives';
|
|
3
|
-
import { type CommonButtonProps } from '../types';
|
|
3
|
+
import { type Appearance, type CommonButtonProps } from '../types';
|
|
4
4
|
export type ControlledEvents<TagName extends HTMLElement> = Pick<React.DOMAttributes<TagName>, 'onMouseDownCapture' | 'onMouseUpCapture' | 'onKeyDownCapture' | 'onKeyUpCapture' | 'onTouchStartCapture' | 'onTouchEndCapture' | 'onPointerDownCapture' | 'onPointerUpCapture' | 'onClickCapture' | 'onClick'>;
|
|
5
5
|
export type ControlledEventsPassed<TagName extends HTMLElement> = Omit<ControlledEvents<TagName>, 'onClick'> & Pick<CommonButtonProps<TagName>, 'onClick'>;
|
|
6
6
|
export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
@@ -13,7 +13,8 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
13
13
|
hasIconBefore?: boolean;
|
|
14
14
|
hasIconAfter?: boolean;
|
|
15
15
|
shouldFitContainer?: boolean;
|
|
16
|
-
|
|
16
|
+
appearance?: Appearance;
|
|
17
|
+
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'children' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay' | 'spacing'> & ControlledEventsPassed<TagName>;
|
|
17
18
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
18
19
|
xcss: ReturnType<typeof xcss>;
|
|
19
20
|
ref(node: TagName | null): void;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
|
-
export type
|
|
3
|
+
export type ButtonAppearance = 'default' | 'danger' | 'primary' | 'subtle' | 'warning';
|
|
4
|
+
export type LinkButtonAppearance = 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
|
|
5
|
+
export type Appearance = ButtonAppearance | LinkButtonAppearance;
|
|
4
6
|
export type Spacing = 'compact' | 'default' | 'none';
|
|
5
7
|
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
6
8
|
export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
7
|
-
/**
|
|
8
|
-
* The button style variation
|
|
9
|
-
*/
|
|
10
|
-
appearance?: Appearance;
|
|
11
9
|
/**
|
|
12
10
|
* Set the button to autofocus on mount
|
|
13
11
|
*/
|
|
@@ -66,7 +64,12 @@ export type AdditionalHTMLElementPropsExtender<Props extends SupportedElementAtt
|
|
|
66
64
|
/**
|
|
67
65
|
* Common additional props for button `<button>` variants
|
|
68
66
|
*/
|
|
69
|
-
export type AdditionalButtonVariantProps = {
|
|
67
|
+
export type AdditionalButtonVariantProps = {
|
|
68
|
+
/**
|
|
69
|
+
* The button style variation
|
|
70
|
+
*/
|
|
71
|
+
appearance?: ButtonAppearance;
|
|
72
|
+
};
|
|
70
73
|
/**
|
|
71
74
|
* Combines common button props with additional HTML attributes.
|
|
72
75
|
*/
|
|
@@ -79,6 +82,10 @@ export type CommonButtonVariantProps = AdditionalButtonVariantProps & CombinedBu
|
|
|
79
82
|
* Common additional props for Link `<a>` Button variants
|
|
80
83
|
*/
|
|
81
84
|
export type AdditionalLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
|
|
85
|
+
/**
|
|
86
|
+
* The button style variation
|
|
87
|
+
*/
|
|
88
|
+
appearance?: LinkButtonAppearance;
|
|
82
89
|
/**
|
|
83
90
|
* Provides a URL for link buttons. When using an AppProvider with a configured router link component, a `RouterLinkConfig` object type can be provided for advanced usage. See the [Link Button routing example](https://atlassian.design/components/button/button-new/examples#routing) for more details.
|
|
84
91
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
declare const
|
|
3
|
-
|
|
1
|
+
import { type ButtonAppearance, type LinkButtonAppearance } from '../new-button/variants/types';
|
|
2
|
+
declare const buttonAppearances: ButtonAppearance[];
|
|
3
|
+
declare const linkButtonAppearances: LinkButtonAppearance[];
|
|
4
|
+
export { buttonAppearances, linkButtonAppearances };
|
|
@@ -2,19 +2,21 @@ import React from 'react';
|
|
|
2
2
|
import Button from '../new-button/variants/default/button';
|
|
3
3
|
import { LinkButtonProps } from '../new-button/variants/default/link';
|
|
4
4
|
import { LinkIconButtonProps } from '../new-button/variants/icon/link';
|
|
5
|
+
import { buttonAppearances, linkButtonAppearances } from '../utils/appearances';
|
|
5
6
|
export type Variant = {
|
|
6
|
-
name:
|
|
7
|
-
Component: typeof Button
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
name: 'Button';
|
|
8
|
+
Component: typeof Button;
|
|
9
|
+
elementType: typeof HTMLButtonElement;
|
|
10
|
+
appearances: typeof buttonAppearances;
|
|
11
|
+
} | {
|
|
12
|
+
name: 'LinkButton';
|
|
13
|
+
Component: typeof LinkButtonRender;
|
|
14
|
+
elementType: typeof HTMLAnchorElement;
|
|
15
|
+
appearances: typeof linkButtonAppearances;
|
|
12
16
|
};
|
|
13
17
|
declare const LinkButtonRender: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
|
|
14
18
|
href?: string | undefined;
|
|
15
19
|
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
16
|
-
export declare const variants: Variant[];
|
|
17
|
-
export default variants;
|
|
18
20
|
export declare const linkButtonVariants: ({
|
|
19
21
|
name: string;
|
|
20
22
|
Component: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
|
|
@@ -24,6 +26,7 @@ export declare const linkButtonVariants: ({
|
|
|
24
26
|
new (): HTMLAnchorElement;
|
|
25
27
|
prototype: HTMLAnchorElement;
|
|
26
28
|
};
|
|
29
|
+
appearances: import("../new-button/variants/types").LinkButtonAppearance[];
|
|
27
30
|
} | {
|
|
28
31
|
name: string;
|
|
29
32
|
Component: React.ForwardRefExoticComponent<Omit<LinkIconButtonProps<never>, "href" | "icon"> & {
|
|
@@ -34,4 +37,7 @@ export declare const linkButtonVariants: ({
|
|
|
34
37
|
new (): HTMLAnchorElement;
|
|
35
38
|
prototype: HTMLAnchorElement;
|
|
36
39
|
};
|
|
40
|
+
appearances: import("../new-button/variants/types").LinkButtonAppearance[];
|
|
37
41
|
})[];
|
|
42
|
+
declare const variants: Variant[];
|
|
43
|
+
export default variants;
|
|
@@ -13,5 +13,5 @@ export type ButtonProps = CommonDefaultButtonProps & CommonButtonVariantProps;
|
|
|
13
13
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
14
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
15
|
*/
|
|
16
|
-
declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
16
|
+
declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & import("../types").AdditionalButtonVariantProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
17
17
|
export default Button;
|
|
@@ -13,5 +13,5 @@ export type IconButtonProps = CommonIconButtonProps & CommonButtonVariantProps;
|
|
|
13
13
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
14
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
15
|
*/
|
|
16
|
-
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
16
|
+
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonIconButtonProps & import("../types").AdditionalButtonVariantProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
17
17
|
export default IconButton;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { xcss } from '@atlaskit/primitives';
|
|
3
|
-
import { type CommonButtonProps } from '../types';
|
|
3
|
+
import { type Appearance, type CommonButtonProps } from '../types';
|
|
4
4
|
export type ControlledEvents<TagName extends HTMLElement> = Pick<React.DOMAttributes<TagName>, 'onMouseDownCapture' | 'onMouseUpCapture' | 'onKeyDownCapture' | 'onKeyUpCapture' | 'onTouchStartCapture' | 'onTouchEndCapture' | 'onPointerDownCapture' | 'onPointerUpCapture' | 'onClickCapture' | 'onClick'>;
|
|
5
5
|
export type ControlledEventsPassed<TagName extends HTMLElement> = Omit<ControlledEvents<TagName>, 'onClick'> & Pick<CommonButtonProps<TagName>, 'onClick'>;
|
|
6
6
|
export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
@@ -13,7 +13,8 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
13
13
|
hasIconBefore?: boolean;
|
|
14
14
|
hasIconAfter?: boolean;
|
|
15
15
|
shouldFitContainer?: boolean;
|
|
16
|
-
|
|
16
|
+
appearance?: Appearance;
|
|
17
|
+
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'children' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay' | 'spacing'> & ControlledEventsPassed<TagName>;
|
|
17
18
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
18
19
|
xcss: ReturnType<typeof xcss>;
|
|
19
20
|
ref(node: TagName | null): void;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
|
-
export type
|
|
3
|
+
export type ButtonAppearance = 'default' | 'danger' | 'primary' | 'subtle' | 'warning';
|
|
4
|
+
export type LinkButtonAppearance = 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
|
|
5
|
+
export type Appearance = ButtonAppearance | LinkButtonAppearance;
|
|
4
6
|
export type Spacing = 'compact' | 'default' | 'none';
|
|
5
7
|
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
6
8
|
export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
7
|
-
/**
|
|
8
|
-
* The button style variation
|
|
9
|
-
*/
|
|
10
|
-
appearance?: Appearance;
|
|
11
9
|
/**
|
|
12
10
|
* Set the button to autofocus on mount
|
|
13
11
|
*/
|
|
@@ -66,7 +64,12 @@ export type AdditionalHTMLElementPropsExtender<Props extends SupportedElementAtt
|
|
|
66
64
|
/**
|
|
67
65
|
* Common additional props for button `<button>` variants
|
|
68
66
|
*/
|
|
69
|
-
export type AdditionalButtonVariantProps = {
|
|
67
|
+
export type AdditionalButtonVariantProps = {
|
|
68
|
+
/**
|
|
69
|
+
* The button style variation
|
|
70
|
+
*/
|
|
71
|
+
appearance?: ButtonAppearance;
|
|
72
|
+
};
|
|
70
73
|
/**
|
|
71
74
|
* Combines common button props with additional HTML attributes.
|
|
72
75
|
*/
|
|
@@ -79,6 +82,10 @@ export type CommonButtonVariantProps = AdditionalButtonVariantProps & CombinedBu
|
|
|
79
82
|
* Common additional props for Link `<a>` Button variants
|
|
80
83
|
*/
|
|
81
84
|
export type AdditionalLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
|
|
85
|
+
/**
|
|
86
|
+
* The button style variation
|
|
87
|
+
*/
|
|
88
|
+
appearance?: LinkButtonAppearance;
|
|
82
89
|
/**
|
|
83
90
|
* Provides a URL for link buttons. When using an AppProvider with a configured router link component, a `RouterLinkConfig` object type can be provided for advanced usage. See the [Link Button routing example](https://atlassian.design/components/button/button-new/examples#routing) for more details.
|
|
84
91
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
declare const
|
|
3
|
-
|
|
1
|
+
import { type ButtonAppearance, type LinkButtonAppearance } from '../new-button/variants/types';
|
|
2
|
+
declare const buttonAppearances: ButtonAppearance[];
|
|
3
|
+
declare const linkButtonAppearances: LinkButtonAppearance[];
|
|
4
|
+
export { buttonAppearances, linkButtonAppearances };
|
|
@@ -2,19 +2,21 @@ import React from 'react';
|
|
|
2
2
|
import Button from '../new-button/variants/default/button';
|
|
3
3
|
import { LinkButtonProps } from '../new-button/variants/default/link';
|
|
4
4
|
import { LinkIconButtonProps } from '../new-button/variants/icon/link';
|
|
5
|
+
import { buttonAppearances, linkButtonAppearances } from '../utils/appearances';
|
|
5
6
|
export type Variant = {
|
|
6
|
-
name:
|
|
7
|
-
Component: typeof Button
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
name: 'Button';
|
|
8
|
+
Component: typeof Button;
|
|
9
|
+
elementType: typeof HTMLButtonElement;
|
|
10
|
+
appearances: typeof buttonAppearances;
|
|
11
|
+
} | {
|
|
12
|
+
name: 'LinkButton';
|
|
13
|
+
Component: typeof LinkButtonRender;
|
|
14
|
+
elementType: typeof HTMLAnchorElement;
|
|
15
|
+
appearances: typeof linkButtonAppearances;
|
|
12
16
|
};
|
|
13
17
|
declare const LinkButtonRender: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
|
|
14
18
|
href?: string | undefined;
|
|
15
19
|
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
16
|
-
export declare const variants: Variant[];
|
|
17
|
-
export default variants;
|
|
18
20
|
export declare const linkButtonVariants: ({
|
|
19
21
|
name: string;
|
|
20
22
|
Component: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
|
|
@@ -24,6 +26,7 @@ export declare const linkButtonVariants: ({
|
|
|
24
26
|
new (): HTMLAnchorElement;
|
|
25
27
|
prototype: HTMLAnchorElement;
|
|
26
28
|
};
|
|
29
|
+
appearances: import("../new-button/variants/types").LinkButtonAppearance[];
|
|
27
30
|
} | {
|
|
28
31
|
name: string;
|
|
29
32
|
Component: React.ForwardRefExoticComponent<Omit<LinkIconButtonProps<never>, "href" | "icon"> & {
|
|
@@ -34,4 +37,7 @@ export declare const linkButtonVariants: ({
|
|
|
34
37
|
new (): HTMLAnchorElement;
|
|
35
38
|
prototype: HTMLAnchorElement;
|
|
36
39
|
};
|
|
40
|
+
appearances: import("../new-button/variants/types").LinkButtonAppearance[];
|
|
37
41
|
})[];
|
|
42
|
+
declare const variants: Variant[];
|
|
43
|
+
export default variants;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.17.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/"
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@atlaskit/focus-ring": "^1.3.0",
|
|
82
82
|
"@atlaskit/interaction-context": "^2.1.0",
|
|
83
83
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
84
|
-
"@atlaskit/primitives": "^1.
|
|
84
|
+
"@atlaskit/primitives": "^1.11.0",
|
|
85
85
|
"@atlaskit/spinner": "^16.0.0",
|
|
86
86
|
"@atlaskit/theme": "^12.6.0",
|
|
87
87
|
"@atlaskit/tokens": "^1.28.0",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"@af/integration-testing": "*",
|
|
98
98
|
"@af/visual-regression": "*",
|
|
99
99
|
"@atlaskit/app-provider": "^0.4.0",
|
|
100
|
-
"@atlaskit/icon": "^
|
|
100
|
+
"@atlaskit/icon": "^22.0.0",
|
|
101
101
|
"@atlaskit/ssr": "*",
|
|
102
102
|
"@atlaskit/visual-regression": "*",
|
|
103
103
|
"@atlaskit/webdriver-runner": "*",
|