@atlaskit/button 16.18.0 → 16.18.1
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/button.d.ts +1 -1
- package/dist/types/new-button/variants/default/link.d.ts +3 -3
- package/dist/types/new-button/variants/default/types.d.ts +8 -3
- package/dist/types/new-button/variants/icon/button.d.ts +2 -2
- package/dist/types/new-button/variants/icon/link.d.ts +2 -2
- package/dist/types/new-button/variants/icon/types.d.ts +5 -5
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +2 -1
- package/dist/types/new-button/variants/types.d.ts +25 -24
- package/dist/types-ts4.5/new-button/variants/default/button.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +3 -3
- package/dist/types-ts4.5/new-button/variants/default/types.d.ts +8 -3
- package/dist/types-ts4.5/new-button/variants/icon/button.d.ts +2 -2
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +2 -2
- package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +5 -5
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +2 -1
- package/dist/types-ts4.5/new-button/variants/types.d.ts +25 -24
- package/extract-react-types/new-button/variants/default/link-button-props.tsx +7 -2
- package/extract-react-types/new-button/variants/icon-button/common-icon-button-props.tsx +11 -0
- package/extract-react-types/new-button/variants/icon-button/link-icon-button-props.tsx +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 16.18.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#58871](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58871) [`4c7dc39947e8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4c7dc39947e8) - Add code docs for icon button and update types
|
|
8
|
+
|
|
3
9
|
## 16.18.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -117,7 +117,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
117
117
|
action: 'clicked',
|
|
118
118
|
componentName: 'button',
|
|
119
119
|
packageName: "@atlaskit/button",
|
|
120
|
-
packageVersion: "16.18.
|
|
120
|
+
packageVersion: "16.18.1",
|
|
121
121
|
analyticsData: analyticsContext,
|
|
122
122
|
actionSubject: buttonType
|
|
123
123
|
});
|
|
@@ -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.18.
|
|
121
|
+
packageVersion: "16.18.1",
|
|
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.18.
|
|
106
|
+
packageVersion: "16.18.1",
|
|
107
107
|
analyticsData: analyticsContext
|
|
108
108
|
});
|
|
109
109
|
|
|
@@ -109,7 +109,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
109
109
|
action: 'clicked',
|
|
110
110
|
componentName: 'button',
|
|
111
111
|
packageName: "@atlaskit/button",
|
|
112
|
-
packageVersion: "16.18.
|
|
112
|
+
packageVersion: "16.18.1",
|
|
113
113
|
analyticsData: analyticsContext,
|
|
114
114
|
actionSubject: buttonType
|
|
115
115
|
});
|
|
@@ -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.18.
|
|
112
|
+
packageVersion: "16.18.1",
|
|
113
113
|
analyticsData: analyticsContext
|
|
114
114
|
});
|
|
115
115
|
|
|
@@ -11,5 +11,5 @@ export type ButtonProps = CommonDefaultButtonProps & CommonButtonVariantProps;
|
|
|
11
11
|
* - [Code](https://atlassian.design/components/button/code)
|
|
12
12
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
13
13
|
*/
|
|
14
|
-
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>>>;
|
|
14
|
+
declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & import("../types").AdditionalButtonVariantProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
15
15
|
export default Button;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { type Ref } from 'react';
|
|
2
|
-
import { type CommonLinkVariantProps } from '../types';
|
|
2
|
+
import { type AdditionalDefaultLinkVariantProps, type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonDefaultButtonProps } from './types';
|
|
4
|
-
export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig
|
|
4
|
+
export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig> & AdditionalDefaultLinkVariantProps;
|
|
5
5
|
declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, iconBefore, UNSAFE_iconBefore_size, iconAfter, UNSAFE_iconAfter_size, children, shouldFitContainer, interactionName, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, testId, href, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Button__
|
|
@@ -12,7 +12,7 @@ declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = ne
|
|
|
12
12
|
* - [Code](https://atlassian.design/components/button/code)
|
|
13
13
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
14
14
|
*/
|
|
15
|
-
declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & import("../types").
|
|
15
|
+
declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & import("../types").AdditionalCommonLinkVariantProps<RouterLinkConfig> & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "children">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & AdditionalDefaultLinkVariantProps & {
|
|
16
16
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
17
17
|
}) => ReturnType<typeof LinkButtonBase>;
|
|
18
18
|
export default LinkButton;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type IconProp, type IconSize } from '../types';
|
|
2
3
|
export type CommonDefaultButtonProps = {
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Places an icon within the button, after the button's text.
|
|
5
10
|
*/
|
|
6
11
|
iconAfter?: IconProp;
|
|
7
12
|
/**
|
|
@@ -10,7 +15,7 @@ export type CommonDefaultButtonProps = {
|
|
|
10
15
|
*/
|
|
11
16
|
UNSAFE_iconAfter_size?: IconSize;
|
|
12
17
|
/**
|
|
13
|
-
* Places an icon within the button, before the button's text
|
|
18
|
+
* Places an icon within the button, before the button's text.
|
|
14
19
|
*/
|
|
15
20
|
iconBefore?: IconProp;
|
|
16
21
|
/**
|
|
@@ -19,7 +24,7 @@ export type CommonDefaultButtonProps = {
|
|
|
19
24
|
*/
|
|
20
25
|
UNSAFE_iconBefore_size?: IconSize;
|
|
21
26
|
/**
|
|
22
|
-
* Option to fit button width to its parent width
|
|
27
|
+
* Option to fit button width to its parent width.
|
|
23
28
|
*/
|
|
24
29
|
shouldFitContainer?: boolean;
|
|
25
30
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type CommonButtonVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
|
-
export type IconButtonProps =
|
|
4
|
+
export type IconButtonProps = CommonButtonVariantProps & CommonIconButtonProps;
|
|
5
5
|
/**
|
|
6
6
|
* __Icon Button__
|
|
7
7
|
*
|
|
@@ -11,5 +11,5 @@ export type IconButtonProps = CommonIconButtonProps & Omit<CommonButtonVariantPr
|
|
|
11
11
|
* - [Code](https://atlassian.design/components/button/code)
|
|
12
12
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
13
13
|
*/
|
|
14
|
-
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<
|
|
14
|
+
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("../types").AdditionalButtonVariantProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & CommonIconButtonProps & React.RefAttributes<HTMLButtonElement>>>;
|
|
15
15
|
export default IconButton;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { type Ref } from 'react';
|
|
2
2
|
import { type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
|
-
export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps &
|
|
4
|
+
export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
|
|
5
5
|
declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, icon, interactionName, label, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, shape, testId, UNSAFE_size, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Icon Button__
|
|
@@ -12,7 +12,7 @@ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any>
|
|
|
12
12
|
* - [Code](https://atlassian.design/components/button/code)
|
|
13
13
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
14
14
|
*/
|
|
15
|
-
declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & Omit<
|
|
15
|
+
declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & import("../types").AdditionalCommonLinkVariantProps<RouterLinkConfig> & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "children">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
16
16
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
17
17
|
}) => ReturnType<typeof LinkIconButtonBase>;
|
|
18
18
|
export default LinkIconButton;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { type IconButtonAppearance, type IconProp, type IconSize } from '../types';
|
|
2
2
|
export type CommonIconButtonProps = {
|
|
3
3
|
/**
|
|
4
|
-
* The button style variation
|
|
4
|
+
* The button style variation.
|
|
5
5
|
*/
|
|
6
6
|
appearance?: IconButtonAppearance;
|
|
7
7
|
/**
|
|
8
|
-
* Places an icon within the button
|
|
8
|
+
* Places an icon within the button.
|
|
9
9
|
*/
|
|
10
10
|
icon: IconProp;
|
|
11
11
|
/**
|
|
12
|
-
* Provide an accessible label, often used by screen readers
|
|
12
|
+
* Provide an accessible label, often used by screen readers.
|
|
13
13
|
*/
|
|
14
14
|
label: string;
|
|
15
15
|
/**
|
|
16
|
-
* Set the shape of the icon, defaults to square with rounded corners
|
|
16
|
+
* Set the shape of the icon, defaults to square with rounded corners.
|
|
17
17
|
*/
|
|
18
18
|
shape?: 'default' | 'circle';
|
|
19
19
|
/**
|
|
20
20
|
* Set the size of the icon. `medium` is default, so it does not need to be specified.
|
|
21
|
-
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API
|
|
21
|
+
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API.
|
|
22
22
|
*/
|
|
23
23
|
UNSAFE_size?: IconSize;
|
|
24
24
|
};
|
|
@@ -15,7 +15,8 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
15
15
|
hasIconAfter?: boolean;
|
|
16
16
|
shouldFitContainer?: boolean;
|
|
17
17
|
appearance?: Appearance;
|
|
18
|
-
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay' | 'spacing'> & ControlledEventsPassed<TagName>;
|
|
19
20
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
20
21
|
xcss: ReturnType<typeof xcss>;
|
|
21
22
|
ref(node: TagName | null): void;
|
|
@@ -11,52 +11,48 @@ export type IconSize = 'small' | 'large' | 'xlarge';
|
|
|
11
11
|
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
12
12
|
export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
13
13
|
/**
|
|
14
|
-
* Set the button to autofocus on mount
|
|
14
|
+
* Set the button to autofocus on mount.
|
|
15
15
|
*/
|
|
16
16
|
autoFocus?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
* Used to 'overlay' something over a button. This is commonly used to display a loading spinner
|
|
18
|
+
* Used to 'overlay' something over a button. This is commonly used to display a loading spinner.
|
|
19
19
|
*/
|
|
20
20
|
overlay?: React.ReactNode;
|
|
21
21
|
/**
|
|
22
|
-
* Disable the button to prevent user interaction
|
|
22
|
+
* Disable the button to prevent user interaction.
|
|
23
23
|
*/
|
|
24
24
|
isDisabled?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
* Indicates that the button is selected
|
|
26
|
+
* Indicates that the button is selected.
|
|
27
27
|
*/
|
|
28
28
|
isSelected?: boolean;
|
|
29
29
|
/**
|
|
30
|
-
* Handler to be called on blur
|
|
30
|
+
* Handler to be called on blur.
|
|
31
31
|
*/
|
|
32
32
|
onBlur?: React.FocusEventHandler<TagName>;
|
|
33
33
|
/**
|
|
34
|
-
* 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
|
|
34
|
+
* 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.
|
|
35
35
|
*/
|
|
36
36
|
onClick?: (e: React.MouseEvent<TagName>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
37
37
|
/**
|
|
38
|
-
* Handler to be called on focus
|
|
38
|
+
* Handler to be called on focus.
|
|
39
39
|
*/
|
|
40
40
|
onFocus?: React.FocusEventHandler<TagName>;
|
|
41
41
|
/**
|
|
42
|
-
* Controls the amount of padding in the button
|
|
42
|
+
* Controls the amount of padding in the button.
|
|
43
43
|
*/
|
|
44
44
|
spacing?: Spacing;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
children: React.ReactNode;
|
|
49
|
-
/**
|
|
50
|
-
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
46
|
+
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
51
47
|
*/
|
|
52
48
|
testId?: string;
|
|
53
49
|
/**
|
|
54
50
|
* An optional name used to identify this component to press listeners. For example, interaction tracing. For more information,
|
|
55
|
-
* see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration)
|
|
51
|
+
* see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
|
|
56
52
|
*/
|
|
57
53
|
interactionName?: string;
|
|
58
54
|
/**
|
|
59
|
-
* Additional information to be included in the `context` of analytics events that come from button
|
|
55
|
+
* Additional information to be included in the `context` of analytics events that come from button.
|
|
60
56
|
*/
|
|
61
57
|
analyticsContext?: Record<string, any>;
|
|
62
58
|
};
|
|
@@ -70,7 +66,7 @@ export type AdditionalHTMLElementPropsExtender<Props extends SupportedElementAtt
|
|
|
70
66
|
*/
|
|
71
67
|
export type AdditionalButtonVariantProps = {
|
|
72
68
|
/**
|
|
73
|
-
* The button style variation
|
|
69
|
+
* The button style variation.
|
|
74
70
|
*/
|
|
75
71
|
appearance?: ButtonAppearance;
|
|
76
72
|
};
|
|
@@ -81,22 +77,27 @@ export type CombinedButtonProps<TagName extends HTMLElement, HTMLAttributes exte
|
|
|
81
77
|
/**
|
|
82
78
|
* Common props for Button `<button>` variants
|
|
83
79
|
*/
|
|
84
|
-
export type CommonButtonVariantProps = AdditionalButtonVariantProps & CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
|
|
80
|
+
export type CommonButtonVariantProps = AdditionalButtonVariantProps & CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>>>;
|
|
85
81
|
/**
|
|
86
|
-
* Common additional props for Link `<a>` Button variants
|
|
82
|
+
* Common additional props for Link `<a>` Button variants, including icon and default buttons
|
|
87
83
|
*/
|
|
88
|
-
export type
|
|
89
|
-
/**
|
|
90
|
-
* The button style variation
|
|
91
|
-
*/
|
|
92
|
-
appearance?: LinkButtonAppearance;
|
|
84
|
+
export type AdditionalCommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
|
|
93
85
|
/**
|
|
94
86
|
* 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.
|
|
95
87
|
*/
|
|
96
88
|
href: string | RouterLinkConfig;
|
|
97
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* Additional props for default Link `<a>` Button variants
|
|
92
|
+
*/
|
|
93
|
+
export type AdditionalDefaultLinkVariantProps = {
|
|
94
|
+
/**
|
|
95
|
+
* The button style variation.
|
|
96
|
+
*/
|
|
97
|
+
appearance?: LinkButtonAppearance;
|
|
98
|
+
};
|
|
98
99
|
/**
|
|
99
100
|
* Common props for Link `<a>` Button variants
|
|
100
101
|
*/
|
|
101
|
-
export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> =
|
|
102
|
+
export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = AdditionalCommonLinkVariantProps<RouterLinkConfig> & CombinedButtonProps<HTMLAnchorElement, AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'children'>>>;
|
|
102
103
|
export {};
|
|
@@ -11,5 +11,5 @@ export type ButtonProps = CommonDefaultButtonProps & CommonButtonVariantProps;
|
|
|
11
11
|
* - [Code](https://atlassian.design/components/button/code)
|
|
12
12
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
13
13
|
*/
|
|
14
|
-
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>>>;
|
|
14
|
+
declare const Button: React.MemoExoticComponent<React.ForwardRefExoticComponent<CommonDefaultButtonProps & import("../types").AdditionalButtonVariantProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
15
15
|
export default Button;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { type Ref } from 'react';
|
|
2
|
-
import { type CommonLinkVariantProps } from '../types';
|
|
2
|
+
import { type AdditionalDefaultLinkVariantProps, type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonDefaultButtonProps } from './types';
|
|
4
|
-
export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig
|
|
4
|
+
export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig> & AdditionalDefaultLinkVariantProps;
|
|
5
5
|
declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, iconBefore, UNSAFE_iconBefore_size, iconAfter, UNSAFE_iconAfter_size, children, shouldFitContainer, interactionName, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, testId, href, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Button__
|
|
@@ -12,7 +12,7 @@ declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = ne
|
|
|
12
12
|
* - [Code](https://atlassian.design/components/button/code)
|
|
13
13
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
14
14
|
*/
|
|
15
|
-
declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & import("../types").
|
|
15
|
+
declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & import("../types").AdditionalCommonLinkVariantProps<RouterLinkConfig> & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "children">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & AdditionalDefaultLinkVariantProps & {
|
|
16
16
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
17
17
|
}) => ReturnType<typeof LinkButtonBase>;
|
|
18
18
|
export default LinkButton;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type IconProp, type IconSize } from '../types';
|
|
2
3
|
export type CommonDefaultButtonProps = {
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Places an icon within the button, after the button's text.
|
|
5
10
|
*/
|
|
6
11
|
iconAfter?: IconProp;
|
|
7
12
|
/**
|
|
@@ -10,7 +15,7 @@ export type CommonDefaultButtonProps = {
|
|
|
10
15
|
*/
|
|
11
16
|
UNSAFE_iconAfter_size?: IconSize;
|
|
12
17
|
/**
|
|
13
|
-
* Places an icon within the button, before the button's text
|
|
18
|
+
* Places an icon within the button, before the button's text.
|
|
14
19
|
*/
|
|
15
20
|
iconBefore?: IconProp;
|
|
16
21
|
/**
|
|
@@ -19,7 +24,7 @@ export type CommonDefaultButtonProps = {
|
|
|
19
24
|
*/
|
|
20
25
|
UNSAFE_iconBefore_size?: IconSize;
|
|
21
26
|
/**
|
|
22
|
-
* Option to fit button width to its parent width
|
|
27
|
+
* Option to fit button width to its parent width.
|
|
23
28
|
*/
|
|
24
29
|
shouldFitContainer?: boolean;
|
|
25
30
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type CommonButtonVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
|
-
export type IconButtonProps =
|
|
4
|
+
export type IconButtonProps = CommonButtonVariantProps & CommonIconButtonProps;
|
|
5
5
|
/**
|
|
6
6
|
* __Icon Button__
|
|
7
7
|
*
|
|
@@ -11,5 +11,5 @@ export type IconButtonProps = CommonIconButtonProps & Omit<CommonButtonVariantPr
|
|
|
11
11
|
* - [Code](https://atlassian.design/components/button/code)
|
|
12
12
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
13
13
|
*/
|
|
14
|
-
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<
|
|
14
|
+
declare const IconButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("../types").AdditionalButtonVariantProps & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLButtonElement> & CommonIconButtonProps & React.RefAttributes<HTMLButtonElement>>>;
|
|
15
15
|
export default IconButton;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { type Ref } from 'react';
|
|
2
2
|
import { type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
|
-
export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps &
|
|
4
|
+
export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
|
|
5
5
|
declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, autoFocus, appearance, spacing, isDisabled, isSelected, icon, interactionName, label, overlay, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, shape, testId, UNSAFE_size, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Icon Button__
|
|
@@ -12,7 +12,7 @@ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any>
|
|
|
12
12
|
* - [Code](https://atlassian.design/components/button/code)
|
|
13
13
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
14
14
|
*/
|
|
15
|
-
declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & Omit<
|
|
15
|
+
declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & import("../types").AdditionalCommonLinkVariantProps<RouterLinkConfig> & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "children">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
|
|
16
16
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
17
17
|
}) => ReturnType<typeof LinkIconButtonBase>;
|
|
18
18
|
export default LinkIconButton;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { type IconButtonAppearance, type IconProp, type IconSize } from '../types';
|
|
2
2
|
export type CommonIconButtonProps = {
|
|
3
3
|
/**
|
|
4
|
-
* The button style variation
|
|
4
|
+
* The button style variation.
|
|
5
5
|
*/
|
|
6
6
|
appearance?: IconButtonAppearance;
|
|
7
7
|
/**
|
|
8
|
-
* Places an icon within the button
|
|
8
|
+
* Places an icon within the button.
|
|
9
9
|
*/
|
|
10
10
|
icon: IconProp;
|
|
11
11
|
/**
|
|
12
|
-
* Provide an accessible label, often used by screen readers
|
|
12
|
+
* Provide an accessible label, often used by screen readers.
|
|
13
13
|
*/
|
|
14
14
|
label: string;
|
|
15
15
|
/**
|
|
16
|
-
* Set the shape of the icon, defaults to square with rounded corners
|
|
16
|
+
* Set the shape of the icon, defaults to square with rounded corners.
|
|
17
17
|
*/
|
|
18
18
|
shape?: 'default' | 'circle';
|
|
19
19
|
/**
|
|
20
20
|
* Set the size of the icon. `medium` is default, so it does not need to be specified.
|
|
21
|
-
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API
|
|
21
|
+
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API.
|
|
22
22
|
*/
|
|
23
23
|
UNSAFE_size?: IconSize;
|
|
24
24
|
};
|
|
@@ -15,7 +15,8 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
15
15
|
hasIconAfter?: boolean;
|
|
16
16
|
shouldFitContainer?: boolean;
|
|
17
17
|
appearance?: Appearance;
|
|
18
|
-
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay' | 'spacing'> & ControlledEventsPassed<TagName>;
|
|
19
20
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
20
21
|
xcss: ReturnType<typeof xcss>;
|
|
21
22
|
ref(node: TagName | null): void;
|
|
@@ -11,52 +11,48 @@ export type IconSize = 'small' | 'large' | 'xlarge';
|
|
|
11
11
|
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
12
12
|
export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
13
13
|
/**
|
|
14
|
-
* Set the button to autofocus on mount
|
|
14
|
+
* Set the button to autofocus on mount.
|
|
15
15
|
*/
|
|
16
16
|
autoFocus?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
* Used to 'overlay' something over a button. This is commonly used to display a loading spinner
|
|
18
|
+
* Used to 'overlay' something over a button. This is commonly used to display a loading spinner.
|
|
19
19
|
*/
|
|
20
20
|
overlay?: React.ReactNode;
|
|
21
21
|
/**
|
|
22
|
-
* Disable the button to prevent user interaction
|
|
22
|
+
* Disable the button to prevent user interaction.
|
|
23
23
|
*/
|
|
24
24
|
isDisabled?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
* Indicates that the button is selected
|
|
26
|
+
* Indicates that the button is selected.
|
|
27
27
|
*/
|
|
28
28
|
isSelected?: boolean;
|
|
29
29
|
/**
|
|
30
|
-
* Handler to be called on blur
|
|
30
|
+
* Handler to be called on blur.
|
|
31
31
|
*/
|
|
32
32
|
onBlur?: React.FocusEventHandler<TagName>;
|
|
33
33
|
/**
|
|
34
|
-
* 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
|
|
34
|
+
* 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.
|
|
35
35
|
*/
|
|
36
36
|
onClick?: (e: React.MouseEvent<TagName>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
37
37
|
/**
|
|
38
|
-
* Handler to be called on focus
|
|
38
|
+
* Handler to be called on focus.
|
|
39
39
|
*/
|
|
40
40
|
onFocus?: React.FocusEventHandler<TagName>;
|
|
41
41
|
/**
|
|
42
|
-
* Controls the amount of padding in the button
|
|
42
|
+
* Controls the amount of padding in the button.
|
|
43
43
|
*/
|
|
44
44
|
spacing?: Spacing;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
children: React.ReactNode;
|
|
49
|
-
/**
|
|
50
|
-
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
46
|
+
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
51
47
|
*/
|
|
52
48
|
testId?: string;
|
|
53
49
|
/**
|
|
54
50
|
* An optional name used to identify this component to press listeners. For example, interaction tracing. For more information,
|
|
55
|
-
* see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration)
|
|
51
|
+
* see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
|
|
56
52
|
*/
|
|
57
53
|
interactionName?: string;
|
|
58
54
|
/**
|
|
59
|
-
* Additional information to be included in the `context` of analytics events that come from button
|
|
55
|
+
* Additional information to be included in the `context` of analytics events that come from button.
|
|
60
56
|
*/
|
|
61
57
|
analyticsContext?: Record<string, any>;
|
|
62
58
|
};
|
|
@@ -70,7 +66,7 @@ export type AdditionalHTMLElementPropsExtender<Props extends SupportedElementAtt
|
|
|
70
66
|
*/
|
|
71
67
|
export type AdditionalButtonVariantProps = {
|
|
72
68
|
/**
|
|
73
|
-
* The button style variation
|
|
69
|
+
* The button style variation.
|
|
74
70
|
*/
|
|
75
71
|
appearance?: ButtonAppearance;
|
|
76
72
|
};
|
|
@@ -81,22 +77,27 @@ export type CombinedButtonProps<TagName extends HTMLElement, HTMLAttributes exte
|
|
|
81
77
|
/**
|
|
82
78
|
* Common props for Button `<button>` variants
|
|
83
79
|
*/
|
|
84
|
-
export type CommonButtonVariantProps = AdditionalButtonVariantProps & CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
|
|
80
|
+
export type CommonButtonVariantProps = AdditionalButtonVariantProps & CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>>>;
|
|
85
81
|
/**
|
|
86
|
-
* Common additional props for Link `<a>` Button variants
|
|
82
|
+
* Common additional props for Link `<a>` Button variants, including icon and default buttons
|
|
87
83
|
*/
|
|
88
|
-
export type
|
|
89
|
-
/**
|
|
90
|
-
* The button style variation
|
|
91
|
-
*/
|
|
92
|
-
appearance?: LinkButtonAppearance;
|
|
84
|
+
export type AdditionalCommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
|
|
93
85
|
/**
|
|
94
86
|
* 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.
|
|
95
87
|
*/
|
|
96
88
|
href: string | RouterLinkConfig;
|
|
97
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* Additional props for default Link `<a>` Button variants
|
|
92
|
+
*/
|
|
93
|
+
export type AdditionalDefaultLinkVariantProps = {
|
|
94
|
+
/**
|
|
95
|
+
* The button style variation.
|
|
96
|
+
*/
|
|
97
|
+
appearance?: LinkButtonAppearance;
|
|
98
|
+
};
|
|
98
99
|
/**
|
|
99
100
|
* Common props for Link `<a>` Button variants
|
|
100
101
|
*/
|
|
101
|
-
export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> =
|
|
102
|
+
export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = AdditionalCommonLinkVariantProps<RouterLinkConfig> & CombinedButtonProps<HTMLAnchorElement, AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'children'>>>;
|
|
102
103
|
export {};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type AdditionalCommonLinkVariantProps,
|
|
3
|
+
type AdditionalDefaultLinkVariantProps,
|
|
4
|
+
} from '../../../../src/new-button/variants/types';
|
|
2
5
|
|
|
3
|
-
export default function LinkButtonProps(
|
|
6
|
+
export default function LinkButtonProps(
|
|
7
|
+
props: AdditionalCommonLinkVariantProps & AdditionalDefaultLinkVariantProps,
|
|
8
|
+
) {
|
|
4
9
|
return null;
|
|
5
10
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CommonIconButtonProps } from '../../../../src/new-button/variants/icon/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> & CommonIconButtonProps,
|
|
9
|
+
) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
package/package.json
CHANGED