@atlaskit/button 16.17.12 → 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 +12 -0
- package/dist/cjs/new-button/containers/split-button/split-button.js +0 -2
- package/dist/cjs/new-button/variants/default/button.js +0 -2
- package/dist/cjs/new-button/variants/default/link.js +0 -2
- package/dist/cjs/new-button/variants/icon/button.js +0 -2
- package/dist/cjs/new-button/variants/icon/link.js +0 -2
- package/dist/cjs/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/cjs/new.js +41 -0
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/containers/split-button/split-button.js +0 -2
- package/dist/es2019/new-button/variants/default/button.js +0 -2
- package/dist/es2019/new-button/variants/default/link.js +0 -2
- package/dist/es2019/new-button/variants/icon/button.js +0 -2
- package/dist/es2019/new-button/variants/icon/link.js +0 -2
- package/dist/es2019/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/es2019/new.js +6 -0
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/containers/split-button/split-button.js +0 -2
- package/dist/esm/new-button/variants/default/button.js +0 -2
- package/dist/esm/new-button/variants/default/link.js +0 -2
- package/dist/esm/new-button/variants/icon/button.js +0 -2
- package/dist/esm/new-button/variants/icon/link.js +0 -2
- package/dist/esm/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/esm/new.js +6 -0
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/new-button/containers/split-button/split-button.d.ts +0 -2
- package/dist/types/new-button/variants/default/button.d.ts +1 -3
- package/dist/types/new-button/variants/default/link.d.ts +3 -5
- package/dist/types/new-button/variants/default/types.d.ts +8 -3
- package/dist/types/new-button/variants/icon/button.d.ts +2 -4
- package/dist/types/new-button/variants/icon/link.d.ts +2 -4
- 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/new.d.ts +6 -0
- package/dist/types-ts4.5/new-button/containers/split-button/split-button.d.ts +0 -2
- package/dist/types-ts4.5/new-button/variants/default/button.d.ts +1 -3
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +3 -5
- 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 -4
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +2 -4
- 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/dist/types-ts4.5/new.d.ts +6 -0
- 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/new/package.json +15 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
9
|
+
## 16.18.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#59441](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/59441) [`23a1d31d3c09`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/23a1d31d3c09) - Add entrypoint for new button work heading to open beta at `@atlaskit/button/new`
|
|
14
|
+
|
|
3
15
|
## 16.17.12
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -95,8 +95,6 @@ var SplitButtonContainer = exports.SplitButtonContainer = function SplitButtonCo
|
|
|
95
95
|
/**
|
|
96
96
|
* __Split Button__
|
|
97
97
|
*
|
|
98
|
-
* @private __UNSAFE__ SplitButton is not yet safe for production use.
|
|
99
|
-
*
|
|
100
98
|
* A split button lets people perform an action or choose from a small group of similar actions.
|
|
101
99
|
*
|
|
102
100
|
* - [Examples](https://atlassian.design/components/button/split-button/examples)
|
|
@@ -14,8 +14,6 @@ var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDi
|
|
|
14
14
|
/**
|
|
15
15
|
* __Button__
|
|
16
16
|
*
|
|
17
|
-
* @private __UNSAFE__ Button is not yet safe for production use.
|
|
18
|
-
*
|
|
19
17
|
* A button triggers an event or action.
|
|
20
18
|
*
|
|
21
19
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
@@ -104,8 +104,6 @@ var WithRef = /*#__PURE__*/(0, _react.forwardRef)(LinkButtonBase);
|
|
|
104
104
|
/**
|
|
105
105
|
* __Link Button__
|
|
106
106
|
*
|
|
107
|
-
* @private __UNSAFE__ LinkButton is not yet safe for production use.
|
|
108
|
-
*
|
|
109
107
|
* Renders a link in the style of a button.
|
|
110
108
|
*
|
|
111
109
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
@@ -14,8 +14,6 @@ var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDi
|
|
|
14
14
|
/**
|
|
15
15
|
* __Icon Button__
|
|
16
16
|
*
|
|
17
|
-
* @private __UNSAFE__ IconButton is not yet safe for production use.
|
|
18
|
-
*
|
|
19
17
|
* TODO: Description
|
|
20
18
|
*
|
|
21
19
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
@@ -100,8 +100,6 @@ var WithRef = /*#__PURE__*/(0, _react.forwardRef)(LinkIconButtonBase);
|
|
|
100
100
|
/**
|
|
101
101
|
* __Link Icon Button__
|
|
102
102
|
*
|
|
103
|
-
* @private __UNSAFE__ LinkIconButton is not yet safe for production use.
|
|
104
|
-
*
|
|
105
103
|
* Renders a link in the style of an icon button.
|
|
106
104
|
*
|
|
107
105
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
@@ -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.
|
|
120
|
+
packageVersion: "16.18.1",
|
|
121
121
|
analyticsData: analyticsContext,
|
|
122
122
|
actionSubject: buttonType
|
|
123
123
|
});
|
package/dist/cjs/new.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "IconButton", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _button2.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "LinkButton", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _link.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "LinkIconButton", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _link2.default;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "SplitButton", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _splitButton.SplitButton;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "default", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function get() {
|
|
34
|
+
return _button.default;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
var _button = _interopRequireDefault(require("./new-button/variants/default/button"));
|
|
38
|
+
var _link = _interopRequireDefault(require("./new-button/variants/default/link"));
|
|
39
|
+
var _button2 = _interopRequireDefault(require("./new-button/variants/icon/button"));
|
|
40
|
+
var _link2 = _interopRequireDefault(require("./new-button/variants/icon/link"));
|
|
41
|
+
var _splitButton = require("./new-button/containers/split-button");
|
|
@@ -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.18.1",
|
|
122
122
|
analyticsData: analyticsContext
|
|
123
123
|
});
|
|
124
124
|
|
|
@@ -90,8 +90,6 @@ export const SplitButtonContainer = ({
|
|
|
90
90
|
/**
|
|
91
91
|
* __Split Button__
|
|
92
92
|
*
|
|
93
|
-
* @private __UNSAFE__ SplitButton is not yet safe for production use.
|
|
94
|
-
*
|
|
95
93
|
* A split button lets people perform an action or choose from a small group of similar actions.
|
|
96
94
|
*
|
|
97
95
|
* - [Examples](https://atlassian.design/components/button/split-button/examples)
|
|
@@ -5,8 +5,6 @@ import useDefaultButton from './use-default-button';
|
|
|
5
5
|
/**
|
|
6
6
|
* __Button__
|
|
7
7
|
*
|
|
8
|
-
* @private __UNSAFE__ Button is not yet safe for production use.
|
|
9
|
-
*
|
|
10
8
|
* A button triggers an event or action.
|
|
11
9
|
*
|
|
12
10
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
@@ -93,8 +93,6 @@ const WithRef = /*#__PURE__*/forwardRef(LinkButtonBase);
|
|
|
93
93
|
/**
|
|
94
94
|
* __Link Button__
|
|
95
95
|
*
|
|
96
|
-
* @private __UNSAFE__ LinkButton is not yet safe for production use.
|
|
97
|
-
*
|
|
98
96
|
* Renders a link in the style of a button.
|
|
99
97
|
*
|
|
100
98
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
@@ -89,8 +89,6 @@ const WithRef = /*#__PURE__*/forwardRef(LinkIconButtonBase);
|
|
|
89
89
|
/**
|
|
90
90
|
* __Link Icon Button__
|
|
91
91
|
*
|
|
92
|
-
* @private __UNSAFE__ LinkIconButton is not yet safe for production use.
|
|
93
|
-
*
|
|
94
92
|
* Renders a link in the style of an icon button.
|
|
95
93
|
*
|
|
96
94
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Relative exports so that constellation examples end up at @atlaskit/new
|
|
2
|
+
export { default } from './new-button/variants/default/button';
|
|
3
|
+
export { default as LinkButton } from './new-button/variants/default/link';
|
|
4
|
+
export { default as IconButton } from './new-button/variants/icon/button';
|
|
5
|
+
export { default as LinkIconButton } from './new-button/variants/icon/link';
|
|
6
|
+
export { SplitButton } from './new-button/containers/split-button';
|
|
@@ -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.18.1",
|
|
107
107
|
analyticsData: analyticsContext
|
|
108
108
|
});
|
|
109
109
|
|
|
@@ -89,8 +89,6 @@ export var SplitButtonContainer = function SplitButtonContainer(_ref2) {
|
|
|
89
89
|
/**
|
|
90
90
|
* __Split Button__
|
|
91
91
|
*
|
|
92
|
-
* @private __UNSAFE__ SplitButton is not yet safe for production use.
|
|
93
|
-
*
|
|
94
92
|
* A split button lets people perform an action or choose from a small group of similar actions.
|
|
95
93
|
*
|
|
96
94
|
* - [Examples](https://atlassian.design/components/button/split-button/examples)
|
|
@@ -7,8 +7,6 @@ import useDefaultButton from './use-default-button';
|
|
|
7
7
|
/**
|
|
8
8
|
* __Button__
|
|
9
9
|
*
|
|
10
|
-
* @private __UNSAFE__ Button is not yet safe for production use.
|
|
11
|
-
*
|
|
12
10
|
* A button triggers an event or action.
|
|
13
11
|
*
|
|
14
12
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
@@ -94,8 +94,6 @@ var WithRef = /*#__PURE__*/forwardRef(LinkButtonBase);
|
|
|
94
94
|
/**
|
|
95
95
|
* __Link Button__
|
|
96
96
|
*
|
|
97
|
-
* @private __UNSAFE__ LinkButton is not yet safe for production use.
|
|
98
|
-
*
|
|
99
97
|
* Renders a link in the style of a button.
|
|
100
98
|
*
|
|
101
99
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
@@ -90,8 +90,6 @@ var WithRef = /*#__PURE__*/forwardRef(LinkIconButtonBase);
|
|
|
90
90
|
/**
|
|
91
91
|
* __Link Icon Button__
|
|
92
92
|
*
|
|
93
|
-
* @private __UNSAFE__ LinkIconButton is not yet safe for production use.
|
|
94
|
-
*
|
|
95
93
|
* Renders a link in the style of an icon button.
|
|
96
94
|
*
|
|
97
95
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
@@ -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.
|
|
112
|
+
packageVersion: "16.18.1",
|
|
113
113
|
analyticsData: analyticsContext,
|
|
114
114
|
actionSubject: buttonType
|
|
115
115
|
});
|
package/dist/esm/new.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Relative exports so that constellation examples end up at @atlaskit/new
|
|
2
|
+
export { default } from './new-button/variants/default/button';
|
|
3
|
+
export { default as LinkButton } from './new-button/variants/default/link';
|
|
4
|
+
export { default as IconButton } from './new-button/variants/icon/button';
|
|
5
|
+
export { default as LinkIconButton } from './new-button/variants/icon/link';
|
|
6
|
+
export { SplitButton } from './new-button/containers/split-button';
|
|
@@ -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.18.1",
|
|
113
113
|
analyticsData: analyticsContext
|
|
114
114
|
});
|
|
115
115
|
|
|
@@ -20,8 +20,6 @@ export declare const SplitButtonContainer: ({ children }: {
|
|
|
20
20
|
/**
|
|
21
21
|
* __Split Button__
|
|
22
22
|
*
|
|
23
|
-
* @private __UNSAFE__ SplitButton is not yet safe for production use.
|
|
24
|
-
*
|
|
25
23
|
* A split button lets people perform an action or choose from a small group of similar actions.
|
|
26
24
|
*
|
|
27
25
|
* - [Examples](https://atlassian.design/components/button/split-button/examples)
|
|
@@ -5,13 +5,11 @@ export type ButtonProps = CommonDefaultButtonProps & CommonButtonVariantProps;
|
|
|
5
5
|
/**
|
|
6
6
|
* __Button__
|
|
7
7
|
*
|
|
8
|
-
* @private __UNSAFE__ Button is not yet safe for production use.
|
|
9
|
-
*
|
|
10
8
|
* A button triggers an event or action.
|
|
11
9
|
*
|
|
12
10
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
11
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
12
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
13
|
*/
|
|
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>>>;
|
|
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>>>;
|
|
17
15
|
export default Button;
|
|
@@ -1,20 +1,18 @@
|
|
|
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__
|
|
8
8
|
*
|
|
9
|
-
* @private __UNSAFE__ LinkButton is not yet safe for production use.
|
|
10
|
-
*
|
|
11
9
|
* Renders a link in the style of a button.
|
|
12
10
|
*
|
|
13
11
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
14
12
|
* - [Code](https://atlassian.design/components/button/code)
|
|
15
13
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
16
14
|
*/
|
|
17
|
-
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 & {
|
|
18
16
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
19
17
|
}) => ReturnType<typeof LinkButtonBase>;
|
|
20
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,17 +1,15 @@
|
|
|
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
|
*
|
|
8
|
-
* @private __UNSAFE__ IconButton is not yet safe for production use.
|
|
9
|
-
*
|
|
10
8
|
* TODO: Description
|
|
11
9
|
*
|
|
12
10
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
11
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
12
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
13
|
*/
|
|
16
|
-
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>>>;
|
|
17
15
|
export default IconButton;
|
|
@@ -1,20 +1,18 @@
|
|
|
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__
|
|
8
8
|
*
|
|
9
|
-
* @private __UNSAFE__ LinkIconButton is not yet safe for production use.
|
|
10
|
-
*
|
|
11
9
|
* Renders a link in the style of an icon button.
|
|
12
10
|
*
|
|
13
11
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
14
12
|
* - [Code](https://atlassian.design/components/button/code)
|
|
15
13
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
16
14
|
*/
|
|
17
|
-
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> & {
|
|
18
16
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
19
17
|
}) => ReturnType<typeof LinkIconButtonBase>;
|
|
20
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 {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default, type ButtonProps, } from './new-button/variants/default/button';
|
|
2
|
+
export { default as LinkButton, type LinkButtonProps, } from './new-button/variants/default/link';
|
|
3
|
+
export { default as IconButton, type IconButtonProps, } from './new-button/variants/icon/button';
|
|
4
|
+
export { default as LinkIconButton, type LinkIconButtonProps, } from './new-button/variants/icon/link';
|
|
5
|
+
export { SplitButton } from './new-button/containers/split-button';
|
|
6
|
+
export type { Appearance, Spacing } from './new-button/variants/types';
|
|
@@ -20,8 +20,6 @@ export declare const SplitButtonContainer: ({ children }: {
|
|
|
20
20
|
/**
|
|
21
21
|
* __Split Button__
|
|
22
22
|
*
|
|
23
|
-
* @private __UNSAFE__ SplitButton is not yet safe for production use.
|
|
24
|
-
*
|
|
25
23
|
* A split button lets people perform an action or choose from a small group of similar actions.
|
|
26
24
|
*
|
|
27
25
|
* - [Examples](https://atlassian.design/components/button/split-button/examples)
|
|
@@ -5,13 +5,11 @@ export type ButtonProps = CommonDefaultButtonProps & CommonButtonVariantProps;
|
|
|
5
5
|
/**
|
|
6
6
|
* __Button__
|
|
7
7
|
*
|
|
8
|
-
* @private __UNSAFE__ Button is not yet safe for production use.
|
|
9
|
-
*
|
|
10
8
|
* A button triggers an event or action.
|
|
11
9
|
*
|
|
12
10
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
11
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
12
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
13
|
*/
|
|
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>>>;
|
|
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>>>;
|
|
17
15
|
export default Button;
|
|
@@ -1,20 +1,18 @@
|
|
|
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__
|
|
8
8
|
*
|
|
9
|
-
* @private __UNSAFE__ LinkButton is not yet safe for production use.
|
|
10
|
-
*
|
|
11
9
|
* Renders a link in the style of a button.
|
|
12
10
|
*
|
|
13
11
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
14
12
|
* - [Code](https://atlassian.design/components/button/code)
|
|
15
13
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
16
14
|
*/
|
|
17
|
-
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 & {
|
|
18
16
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
19
17
|
}) => ReturnType<typeof LinkButtonBase>;
|
|
20
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,17 +1,15 @@
|
|
|
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
|
*
|
|
8
|
-
* @private __UNSAFE__ IconButton is not yet safe for production use.
|
|
9
|
-
*
|
|
10
8
|
* TODO: Description
|
|
11
9
|
*
|
|
12
10
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
13
11
|
* - [Code](https://atlassian.design/components/button/code)
|
|
14
12
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
15
13
|
*/
|
|
16
|
-
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>>>;
|
|
17
15
|
export default IconButton;
|
|
@@ -1,20 +1,18 @@
|
|
|
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__
|
|
8
8
|
*
|
|
9
|
-
* @private __UNSAFE__ LinkIconButton is not yet safe for production use.
|
|
10
|
-
*
|
|
11
9
|
* Renders a link in the style of an icon button.
|
|
12
10
|
*
|
|
13
11
|
* - [Examples](https://atlassian.design/components/button/examples)
|
|
14
12
|
* - [Code](https://atlassian.design/components/button/code)
|
|
15
13
|
* - [Usage](https://atlassian.design/components/button/usage)
|
|
16
14
|
*/
|
|
17
|
-
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> & {
|
|
18
16
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
19
17
|
}) => ReturnType<typeof LinkIconButtonBase>;
|
|
20
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 {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default, type ButtonProps, } from './new-button/variants/default/button';
|
|
2
|
+
export { default as LinkButton, type LinkButtonProps, } from './new-button/variants/default/link';
|
|
3
|
+
export { default as IconButton, type IconButtonProps, } from './new-button/variants/icon/button';
|
|
4
|
+
export { default as LinkIconButton, type LinkIconButtonProps, } from './new-button/variants/icon/link';
|
|
5
|
+
export { SplitButton } from './new-button/containers/split-button';
|
|
6
|
+
export type { Appearance, Spacing } from './new-button/variants/types';
|
|
@@ -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/new/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/button/new",
|
|
3
|
+
"main": "../dist/cjs/entry-points/new.js",
|
|
4
|
+
"module": "../dist/esm/entry-points/new.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/entry-points/new.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/entry-points/new.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <4.9": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/entry-points/new.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.18.1",
|
|
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/"
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"./loading-button": "./src/entry-points/loading-button.tsx",
|
|
71
71
|
"./standard-button": "./src/entry-points/standard-button.tsx",
|
|
72
72
|
"./unsafe": "./src/entry-points/unsafe.tsx",
|
|
73
|
+
"./new": "./src/entry-points/new.tsx",
|
|
73
74
|
"./types": "./src/entry-points/types.tsx",
|
|
74
75
|
".": "./src/index.tsx"
|
|
75
76
|
},
|