@atlaskit/button 16.14.0 → 16.15.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/es2019/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- 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/types/new-button/variants/default/link.d.ts +1 -3
- package/dist/types/new-button/variants/icon/link.d.ts +1 -3
- package/dist/types/new-button/variants/types.d.ts +23 -11
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +1 -3
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -3
- package/dist/types-ts4.5/new-button/variants/types.d.ts +23 -11
- package/extract-react-types/legacy-button/custom-theme-button-props.tsx +7 -0
- package/extract-react-types/legacy-button/loading-button-props.tsx +5 -0
- package/extract-react-types/legacy-button/shared-props.tsx +5 -0
- package/extract-react-types/new-button/variants/default/button-props.tsx +5 -0
- package/extract-react-types/new-button/variants/default/common-props.tsx +11 -0
- package/extract-react-types/new-button/variants/default/link-button-props.tsx +5 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 16.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#42950](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42950) [`9691abc55ce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9691abc55ce) - Restructure new Button (in Alpha) types for documentation purposes
|
|
8
|
+
|
|
3
9
|
## 16.14.0
|
|
4
10
|
|
|
5
11
|
### Minor 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.15.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.15.0",
|
|
122
122
|
analyticsData: analyticsContext
|
|
123
123
|
});
|
|
124
124
|
|
|
@@ -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.15.0",
|
|
107
107
|
analyticsData: analyticsContext
|
|
108
108
|
});
|
|
109
109
|
|
|
@@ -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.15.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.15.0",
|
|
113
113
|
analyticsData: analyticsContext
|
|
114
114
|
});
|
|
115
115
|
|
|
@@ -14,9 +14,7 @@ declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = ne
|
|
|
14
14
|
* - [Code](https://atlassian.design/components/button/code)
|
|
15
15
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
16
16
|
*/
|
|
17
|
-
declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & {
|
|
18
|
-
href: string | RouterLinkConfig;
|
|
19
|
-
} & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
17
|
+
declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & import("../types").AdditionalLinkVariantProps<RouterLinkConfig> & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
20
18
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
21
19
|
}) => ReturnType<typeof LinkButtonBase>;
|
|
22
20
|
export default LinkButton;
|
|
@@ -14,9 +14,7 @@ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any>
|
|
|
14
14
|
* - [Code](https://atlassian.design/components/button/code)
|
|
15
15
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
16
16
|
*/
|
|
17
|
-
declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & {
|
|
18
|
-
href: string | RouterLinkConfig;
|
|
19
|
-
} & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
17
|
+
declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & import("../types").AdditionalLinkVariantProps<RouterLinkConfig> & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
20
18
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
21
19
|
}) => ReturnType<typeof LinkIconButtonBase>;
|
|
22
20
|
export default LinkIconButton;
|
|
@@ -5,7 +5,7 @@ export type Spacing = 'compact' | 'default' | 'none';
|
|
|
5
5
|
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
6
6
|
export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
7
7
|
/**
|
|
8
|
-
* The
|
|
8
|
+
* The button style variation
|
|
9
9
|
*/
|
|
10
10
|
appearance?: Appearance;
|
|
11
11
|
/**
|
|
@@ -17,11 +17,11 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
|
17
17
|
*/
|
|
18
18
|
overlay?: React.ReactNode;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Disable the button to prevent user interaction
|
|
21
21
|
*/
|
|
22
22
|
isDisabled?: boolean;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Indicates that the button is selected
|
|
25
25
|
*/
|
|
26
26
|
isSelected?: boolean;
|
|
27
27
|
/**
|
|
@@ -37,11 +37,11 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
|
37
37
|
*/
|
|
38
38
|
onFocus?: React.FocusEventHandler<TagName>;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Controls the amount of padding in the button
|
|
41
41
|
*/
|
|
42
42
|
spacing?: Spacing;
|
|
43
43
|
/**
|
|
44
|
-
* Text content to be rendered in the button
|
|
44
|
+
* Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
|
|
45
45
|
*/
|
|
46
46
|
children: React.ReactNode;
|
|
47
47
|
/**
|
|
@@ -49,8 +49,8 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
|
49
49
|
*/
|
|
50
50
|
testId?: string;
|
|
51
51
|
/**
|
|
52
|
-
* An optional name used to identify this component to press listeners.
|
|
53
|
-
*
|
|
52
|
+
* An optional name used to identify this component to press listeners. For example, interaction tracing. For more information,
|
|
53
|
+
* see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration)
|
|
54
54
|
*/
|
|
55
55
|
interactionName?: string;
|
|
56
56
|
/**
|
|
@@ -58,10 +58,15 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
|
58
58
|
*/
|
|
59
59
|
analyticsContext?: Record<string, any>;
|
|
60
60
|
};
|
|
61
|
+
export type SupportedElements = HTMLButtonElement | HTMLAnchorElement;
|
|
61
62
|
type SupportedElementAttributes = React.ButtonHTMLAttributes<HTMLButtonElement> | React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
62
63
|
export type AdditionalHTMLElementPropsExtender<Props extends SupportedElementAttributes> = Combine<Omit<Props, 'className' | 'style' | 'role' | 'disabled'>, {
|
|
63
64
|
'data-testid'?: never;
|
|
64
65
|
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Common additional props for button `<button>` variants
|
|
68
|
+
*/
|
|
69
|
+
export type AdditionalButtonVariantProps = {};
|
|
65
70
|
/**
|
|
66
71
|
* Combines common button props with additional HTML attributes.
|
|
67
72
|
*/
|
|
@@ -69,11 +74,18 @@ export type CombinedButtonProps<TagName extends HTMLElement, HTMLAttributes exte
|
|
|
69
74
|
/**
|
|
70
75
|
* Common props for Button `<button>` variants
|
|
71
76
|
*/
|
|
72
|
-
export type CommonButtonVariantProps = CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
|
|
77
|
+
export type CommonButtonVariantProps = AdditionalButtonVariantProps & CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
|
|
73
78
|
/**
|
|
74
|
-
* Common props for Link `<a>` Button variants
|
|
79
|
+
* Common additional props for Link `<a>` Button variants
|
|
75
80
|
*/
|
|
76
|
-
export type
|
|
81
|
+
export type AdditionalLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
|
|
82
|
+
/**
|
|
83
|
+
* 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
|
+
*/
|
|
77
85
|
href: string | RouterLinkConfig;
|
|
78
|
-
}
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Common props for Link `<a>` Button variants
|
|
89
|
+
*/
|
|
90
|
+
export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = AdditionalLinkVariantProps<RouterLinkConfig> & CombinedButtonProps<HTMLAnchorElement, AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>>>;
|
|
79
91
|
export {};
|
|
@@ -14,9 +14,7 @@ declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = ne
|
|
|
14
14
|
* - [Code](https://atlassian.design/components/button/code)
|
|
15
15
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
16
16
|
*/
|
|
17
|
-
declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & {
|
|
18
|
-
href: string | RouterLinkConfig;
|
|
19
|
-
} & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
17
|
+
declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & import("../types").AdditionalLinkVariantProps<RouterLinkConfig> & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
20
18
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
21
19
|
}) => ReturnType<typeof LinkButtonBase>;
|
|
22
20
|
export default LinkButton;
|
|
@@ -14,9 +14,7 @@ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any>
|
|
|
14
14
|
* - [Code](https://atlassian.design/components/button/code)
|
|
15
15
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
16
16
|
*/
|
|
17
|
-
declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & {
|
|
18
|
-
href: string | RouterLinkConfig;
|
|
19
|
-
} & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
17
|
+
declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & import("../types").AdditionalLinkVariantProps<RouterLinkConfig> & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
20
18
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
21
19
|
}) => ReturnType<typeof LinkIconButtonBase>;
|
|
22
20
|
export default LinkIconButton;
|
|
@@ -5,7 +5,7 @@ export type Spacing = 'compact' | 'default' | 'none';
|
|
|
5
5
|
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
6
6
|
export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
7
7
|
/**
|
|
8
|
-
* The
|
|
8
|
+
* The button style variation
|
|
9
9
|
*/
|
|
10
10
|
appearance?: Appearance;
|
|
11
11
|
/**
|
|
@@ -17,11 +17,11 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
|
17
17
|
*/
|
|
18
18
|
overlay?: React.ReactNode;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Disable the button to prevent user interaction
|
|
21
21
|
*/
|
|
22
22
|
isDisabled?: boolean;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Indicates that the button is selected
|
|
25
25
|
*/
|
|
26
26
|
isSelected?: boolean;
|
|
27
27
|
/**
|
|
@@ -37,11 +37,11 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
|
37
37
|
*/
|
|
38
38
|
onFocus?: React.FocusEventHandler<TagName>;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Controls the amount of padding in the button
|
|
41
41
|
*/
|
|
42
42
|
spacing?: Spacing;
|
|
43
43
|
/**
|
|
44
|
-
* Text content to be rendered in the button
|
|
44
|
+
* Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
|
|
45
45
|
*/
|
|
46
46
|
children: React.ReactNode;
|
|
47
47
|
/**
|
|
@@ -49,8 +49,8 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
|
49
49
|
*/
|
|
50
50
|
testId?: string;
|
|
51
51
|
/**
|
|
52
|
-
* An optional name used to identify this component to press listeners.
|
|
53
|
-
*
|
|
52
|
+
* An optional name used to identify this component to press listeners. For example, interaction tracing. For more information,
|
|
53
|
+
* see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration)
|
|
54
54
|
*/
|
|
55
55
|
interactionName?: string;
|
|
56
56
|
/**
|
|
@@ -58,10 +58,15 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
|
58
58
|
*/
|
|
59
59
|
analyticsContext?: Record<string, any>;
|
|
60
60
|
};
|
|
61
|
+
export type SupportedElements = HTMLButtonElement | HTMLAnchorElement;
|
|
61
62
|
type SupportedElementAttributes = React.ButtonHTMLAttributes<HTMLButtonElement> | React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
62
63
|
export type AdditionalHTMLElementPropsExtender<Props extends SupportedElementAttributes> = Combine<Omit<Props, 'className' | 'style' | 'role' | 'disabled'>, {
|
|
63
64
|
'data-testid'?: never;
|
|
64
65
|
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Common additional props for button `<button>` variants
|
|
68
|
+
*/
|
|
69
|
+
export type AdditionalButtonVariantProps = {};
|
|
65
70
|
/**
|
|
66
71
|
* Combines common button props with additional HTML attributes.
|
|
67
72
|
*/
|
|
@@ -69,11 +74,18 @@ export type CombinedButtonProps<TagName extends HTMLElement, HTMLAttributes exte
|
|
|
69
74
|
/**
|
|
70
75
|
* Common props for Button `<button>` variants
|
|
71
76
|
*/
|
|
72
|
-
export type CommonButtonVariantProps = CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
|
|
77
|
+
export type CommonButtonVariantProps = AdditionalButtonVariantProps & CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
|
|
73
78
|
/**
|
|
74
|
-
* Common props for Link `<a>` Button variants
|
|
79
|
+
* Common additional props for Link `<a>` Button variants
|
|
75
80
|
*/
|
|
76
|
-
export type
|
|
81
|
+
export type AdditionalLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
|
|
82
|
+
/**
|
|
83
|
+
* 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
|
+
*/
|
|
77
85
|
href: string | RouterLinkConfig;
|
|
78
|
-
}
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Common props for Link `<a>` Button variants
|
|
89
|
+
*/
|
|
90
|
+
export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = AdditionalLinkVariantProps<RouterLinkConfig> & CombinedButtonProps<HTMLAnchorElement, AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>>>;
|
|
79
91
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CommonDefaultButtonProps } from '../../../../src/new-button/variants/default/types';
|
|
2
|
+
import {
|
|
3
|
+
type CommonButtonProps,
|
|
4
|
+
type SupportedElements,
|
|
5
|
+
} from '../../../../src/new-button/variants/types';
|
|
6
|
+
|
|
7
|
+
export default function CommonProps(
|
|
8
|
+
props: CommonButtonProps<SupportedElements> & CommonDefaultButtonProps,
|
|
9
|
+
) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.15.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/"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"title": "Button (new)",
|
|
34
34
|
"id": "button-new",
|
|
35
35
|
"status": {
|
|
36
|
-
"type": "
|
|
36
|
+
"type": "alpha"
|
|
37
37
|
},
|
|
38
38
|
"sortKey": 1
|
|
39
39
|
},
|