@atlaskit/button 16.17.6 → 16.17.8
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 +6 -1
- package/dist/cjs/new-button/variants/icon/link.js +4 -2
- package/dist/cjs/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/cjs/old-button/custom-theme-button/custom-theme-button.js +4 -2
- package/dist/cjs/old-button/loading-button.js +4 -2
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/cjs/old-button/shared/loading-spinner.js +1 -0
- package/dist/cjs/utils/appearances.js +3 -2
- package/dist/cjs/utils/variants.js +56 -8
- package/dist/es2019/new-button/containers/split-button/split-button.js +6 -1
- package/dist/es2019/new-button/variants/icon/link.js +3 -1
- package/dist/es2019/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/es2019/old-button/custom-theme-button/custom-theme-button.js +4 -2
- package/dist/es2019/old-button/loading-button.js +4 -2
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/es2019/old-button/shared/loading-spinner.js +1 -0
- package/dist/es2019/utils/appearances.js +2 -1
- package/dist/es2019/utils/variants.js +43 -7
- package/dist/esm/new-button/containers/split-button/split-button.js +6 -1
- package/dist/esm/new-button/variants/icon/link.js +4 -2
- package/dist/esm/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/esm/old-button/custom-theme-button/custom-theme-button.js +4 -2
- package/dist/esm/old-button/loading-button.js +4 -2
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/esm/old-button/shared/loading-spinner.js +1 -0
- package/dist/esm/utils/appearances.js +2 -1
- package/dist/esm/utils/variants.js +56 -8
- package/dist/types/new-button/containers/split-button/split-button.d.ts +6 -13
- package/dist/types/new-button/containers/split-button/types.d.ts +23 -3
- package/dist/types/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types/new-button/variants/icon/types.d.ts +2 -4
- package/dist/types/utils/appearances.d.ts +3 -2
- package/dist/types/utils/variants.d.ts +34 -14
- package/dist/types-ts4.5/new-button/containers/split-button/split-button.d.ts +6 -13
- package/dist/types-ts4.5/new-button/containers/split-button/types.d.ts +23 -3
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +2 -4
- package/dist/types-ts4.5/utils/appearances.d.ts +3 -2
- package/dist/types-ts4.5/utils/variants.d.ts +34 -14
- package/extract-react-types/new-button/containers/split-button/split-button-props.tsx +5 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 16.17.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#56967](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/56967) [`d491c321ae12`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d491c321ae12) - Remove use of aria-busy
|
|
8
|
+
|
|
9
|
+
## 16.17.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#57511](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/57511) [`a3fc003a2d20`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a3fc003a2d20) - [ux] Fixes a bug in `LinkIconButton` (in closed beta) where the `UNSAFE_size` prop did not apply
|
|
14
|
+
|
|
3
15
|
## 16.17.6
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -78,12 +78,17 @@ var SplitButtonContainer = exports.SplitButtonContainer = function SplitButtonCo
|
|
|
78
78
|
css: splitButtonStyles
|
|
79
79
|
}, children);
|
|
80
80
|
};
|
|
81
|
+
|
|
81
82
|
/**
|
|
82
83
|
* __Split Button__
|
|
83
84
|
*
|
|
84
85
|
* @private __UNSAFE__ SplitButton is not yet safe for production use.
|
|
85
86
|
*
|
|
86
|
-
*
|
|
87
|
+
* A split button lets people perform an action or choose from a small group of similar actions.
|
|
88
|
+
*
|
|
89
|
+
* - [Examples](https://atlassian.design/components/button/split-button/examples)
|
|
90
|
+
* - [Code](https://atlassian.design/components/button/split-button/code)
|
|
91
|
+
* - [Usage](https://atlassian.design/components/button/split-button/usage)
|
|
87
92
|
*/
|
|
88
93
|
var SplitButton = exports.SplitButton = function SplitButton(_ref3) {
|
|
89
94
|
var children = _ref3.children,
|
|
@@ -11,7 +11,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _link = _interopRequireDefault(require("@atlaskit/primitives/link"));
|
|
13
13
|
var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
|
|
14
|
-
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "testId", "href"];
|
|
14
|
+
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "testId", "UNSAFE_size", "href"];
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
@@ -36,6 +36,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
36
36
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
37
37
|
onClickCapture = _ref.onClickCapture,
|
|
38
38
|
testId = _ref.testId,
|
|
39
|
+
UNSAFE_size = _ref.UNSAFE_size,
|
|
39
40
|
href = _ref.href,
|
|
40
41
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
41
42
|
var baseProps = (0, _useIconButton.default)({
|
|
@@ -62,7 +63,8 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
62
63
|
onClickCapture: onClickCapture,
|
|
63
64
|
overlay: overlay,
|
|
64
65
|
ref: ref,
|
|
65
|
-
spacing: spacing
|
|
66
|
+
spacing: spacing,
|
|
67
|
+
UNSAFE_size: UNSAFE_size
|
|
66
68
|
});
|
|
67
69
|
return /*#__PURE__*/_react.default.createElement(_link.default
|
|
68
70
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
@@ -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.17.
|
|
118
|
+
packageVersion: "16.17.8",
|
|
119
119
|
analyticsData: analyticsContext,
|
|
120
120
|
actionSubject: buttonType
|
|
121
121
|
});
|
|
@@ -184,8 +184,10 @@ var CustomThemeButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.de
|
|
|
184
184
|
var buttonStyles = _ref4.buttonStyles;
|
|
185
185
|
return /*#__PURE__*/_react.default.createElement(_buttonBase.default, (0, _extends2.default)({}, restProps, {
|
|
186
186
|
ref: ref,
|
|
187
|
-
overlay: isLoading ? /*#__PURE__*/_react.default.createElement(_loadingSpinner.default, restProps) : null
|
|
188
|
-
|
|
187
|
+
overlay: isLoading ? /*#__PURE__*/_react.default.createElement(_loadingSpinner.default, restProps) : null
|
|
188
|
+
// No need to render aria-disabled when it is false
|
|
189
|
+
,
|
|
190
|
+
"aria-disabled": isLoading || undefined,
|
|
189
191
|
onMouseEnter: onMouseEnter,
|
|
190
192
|
onMouseLeave: onMouseLeave,
|
|
191
193
|
onMouseDown: onMouseDown,
|
|
@@ -29,8 +29,10 @@ var LoadingButton = /*#__PURE__*/_react.default.forwardRef(function LoadingButto
|
|
|
29
29
|
// Button already has React.memo, so just leaning on that
|
|
30
30
|
return /*#__PURE__*/_react.default.createElement(_button.default, (0, _extends2.default)({}, rest, {
|
|
31
31
|
ref: ref,
|
|
32
|
-
appearance: appearance
|
|
33
|
-
|
|
32
|
+
appearance: appearance
|
|
33
|
+
// No need to render aria-disabled when it is false
|
|
34
|
+
,
|
|
35
|
+
"aria-disabled": isLoading || undefined,
|
|
34
36
|
isDisabled: isDisabled,
|
|
35
37
|
isSelected: isSelected,
|
|
36
38
|
overlay: isLoading ? /*#__PURE__*/_react.default.createElement(_loadingSpinner.default, {
|
|
@@ -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.17.
|
|
121
|
+
packageVersion: "16.17.8",
|
|
122
122
|
analyticsData: analyticsContext
|
|
123
123
|
});
|
|
124
124
|
|
|
@@ -31,6 +31,7 @@ function LoadingSpinner(_ref2) {
|
|
|
31
31
|
var size = spacing === 'default' ? 'medium' : 'small';
|
|
32
32
|
return /*#__PURE__*/_react.default.createElement(_spinner.default, {
|
|
33
33
|
size: size,
|
|
34
|
+
label: ", Loading",
|
|
34
35
|
appearance: getSpinnerAppearance({
|
|
35
36
|
appearance: appearance,
|
|
36
37
|
isDisabled: isDisabled,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.linkButtonAppearances = exports.buttonAppearances = void 0;
|
|
6
|
+
exports.linkButtonAppearances = exports.iconButtonAppearances = exports.buttonAppearances = void 0;
|
|
7
7
|
var buttonAppearances = exports.buttonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger'];
|
|
8
|
-
var linkButtonAppearances = exports.linkButtonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger', 'link', 'subtle-link'];
|
|
8
|
+
var linkButtonAppearances = exports.linkButtonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger', 'link', 'subtle-link'];
|
|
9
|
+
var iconButtonAppearances = exports.iconButtonAppearances = ['default', 'primary', 'subtle'];
|
|
@@ -5,14 +5,19 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.linkButtonVariants = exports.default = void 0;
|
|
8
|
+
exports.linkButtonVariants = exports.iconButtonVariants = exports.defaultButtonVariants = exports.default = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _starFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/star-filled"));
|
|
12
13
|
var _button = _interopRequireDefault(require("../new-button/variants/default/button"));
|
|
13
14
|
var _link = _interopRequireDefault(require("../new-button/variants/default/link"));
|
|
15
|
+
var _button2 = _interopRequireDefault(require("../new-button/variants/icon/button"));
|
|
16
|
+
var _link2 = _interopRequireDefault(require("../new-button/variants/icon/link"));
|
|
14
17
|
var _appearances = require("./appearances");
|
|
15
|
-
var _excluded = ["href", "children"]
|
|
18
|
+
var _excluded = ["href", "children"],
|
|
19
|
+
_excluded2 = ["icon", "label"],
|
|
20
|
+
_excluded3 = ["href", "icon", "label"];
|
|
16
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
23
|
// Add required default props to variants
|
|
@@ -26,12 +31,33 @@ var LinkButtonRender = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
26
31
|
href: href
|
|
27
32
|
}, rest), children);
|
|
28
33
|
});
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
var IconButtonRender = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
35
|
+
var _ref2$icon = _ref2.icon,
|
|
36
|
+
icon = _ref2$icon === void 0 ? _starFilled.default : _ref2$icon,
|
|
37
|
+
_ref2$label = _ref2.label,
|
|
38
|
+
label = _ref2$label === void 0 ? 'Label' : _ref2$label,
|
|
39
|
+
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_button2.default, (0, _extends2.default)({
|
|
41
|
+
ref: ref,
|
|
42
|
+
icon: icon,
|
|
43
|
+
label: label
|
|
44
|
+
}, rest));
|
|
45
|
+
});
|
|
46
|
+
var LinkIconButtonRender = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
47
|
+
var _ref3$href = _ref3.href,
|
|
48
|
+
href = _ref3$href === void 0 ? 'home' : _ref3$href,
|
|
49
|
+
_ref3$icon = _ref3.icon,
|
|
50
|
+
icon = _ref3$icon === void 0 ? _starFilled.default : _ref3$icon,
|
|
51
|
+
_ref3$label = _ref3.label,
|
|
52
|
+
label = _ref3$label === void 0 ? 'Label' : _ref3$label,
|
|
53
|
+
rest = (0, _objectWithoutProperties2.default)(_ref3, _excluded3);
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_link2.default, (0, _extends2.default)({
|
|
55
|
+
ref: ref,
|
|
56
|
+
href: href,
|
|
57
|
+
icon: icon,
|
|
58
|
+
label: label
|
|
59
|
+
}, rest));
|
|
60
|
+
});
|
|
35
61
|
var variants = [{
|
|
36
62
|
name: 'Button',
|
|
37
63
|
Component: _button.default,
|
|
@@ -42,5 +68,27 @@ var variants = [{
|
|
|
42
68
|
Component: LinkButtonRender,
|
|
43
69
|
elementType: HTMLAnchorElement,
|
|
44
70
|
appearances: _appearances.linkButtonAppearances
|
|
71
|
+
}, {
|
|
72
|
+
name: 'IconButton',
|
|
73
|
+
Component: IconButtonRender,
|
|
74
|
+
elementType: HTMLButtonElement,
|
|
75
|
+
appearances: _appearances.iconButtonAppearances
|
|
76
|
+
}, {
|
|
77
|
+
name: 'LinkIconButton',
|
|
78
|
+
Component: LinkIconButtonRender,
|
|
79
|
+
elementType: HTMLAnchorElement,
|
|
80
|
+
appearances: _appearances.iconButtonAppearances
|
|
45
81
|
}];
|
|
82
|
+
var defaultButtonVariants = exports.defaultButtonVariants = variants.filter(function (_ref4) {
|
|
83
|
+
var name = _ref4.name;
|
|
84
|
+
return name === 'Button' || name === 'LinkButton';
|
|
85
|
+
});
|
|
86
|
+
var linkButtonVariants = exports.linkButtonVariants = variants.filter(function (_ref5) {
|
|
87
|
+
var name = _ref5.name;
|
|
88
|
+
return name === 'LinkButton' || name === 'LinkIconButton';
|
|
89
|
+
});
|
|
90
|
+
var iconButtonVariants = exports.iconButtonVariants = variants.filter(function (_ref6) {
|
|
91
|
+
var name = _ref6.name;
|
|
92
|
+
return name === 'IconButton' || name === 'LinkIconButton';
|
|
93
|
+
});
|
|
46
94
|
var _default = exports.default = variants;
|
|
@@ -73,12 +73,17 @@ export const SplitButtonContainer = ({
|
|
|
73
73
|
css: splitButtonStyles
|
|
74
74
|
}, children);
|
|
75
75
|
};
|
|
76
|
+
|
|
76
77
|
/**
|
|
77
78
|
* __Split Button__
|
|
78
79
|
*
|
|
79
80
|
* @private __UNSAFE__ SplitButton is not yet safe for production use.
|
|
80
81
|
*
|
|
81
|
-
*
|
|
82
|
+
* A split button lets people perform an action or choose from a small group of similar actions.
|
|
83
|
+
*
|
|
84
|
+
* - [Examples](https://atlassian.design/components/button/split-button/examples)
|
|
85
|
+
* - [Code](https://atlassian.design/components/button/split-button/code)
|
|
86
|
+
* - [Usage](https://atlassian.design/components/button/split-button/usage)
|
|
82
87
|
*/
|
|
83
88
|
export const SplitButton = ({
|
|
84
89
|
children,
|
|
@@ -24,6 +24,7 @@ const LinkIconButtonBase = ({
|
|
|
24
24
|
onPointerUpCapture,
|
|
25
25
|
onClickCapture,
|
|
26
26
|
testId,
|
|
27
|
+
UNSAFE_size,
|
|
27
28
|
href,
|
|
28
29
|
...rest
|
|
29
30
|
}, ref) => {
|
|
@@ -51,7 +52,8 @@ const LinkIconButtonBase = ({
|
|
|
51
52
|
onClickCapture,
|
|
52
53
|
overlay,
|
|
53
54
|
ref,
|
|
54
|
-
spacing
|
|
55
|
+
spacing,
|
|
56
|
+
UNSAFE_size
|
|
55
57
|
});
|
|
56
58
|
return /*#__PURE__*/React.createElement(UNSAFE_LINK
|
|
57
59
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
@@ -150,8 +150,10 @@ const CustomThemeButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef
|
|
|
150
150
|
buttonStyles
|
|
151
151
|
}) => /*#__PURE__*/React.createElement(ButtonBase, _extends({}, restProps, {
|
|
152
152
|
ref: ref,
|
|
153
|
-
overlay: isLoading ? /*#__PURE__*/React.createElement(LoadingSpinner, restProps) : null
|
|
154
|
-
|
|
153
|
+
overlay: isLoading ? /*#__PURE__*/React.createElement(LoadingSpinner, restProps) : null
|
|
154
|
+
// No need to render aria-disabled when it is false
|
|
155
|
+
,
|
|
156
|
+
"aria-disabled": isLoading || undefined,
|
|
155
157
|
onMouseEnter: onMouseEnter,
|
|
156
158
|
onMouseLeave: onMouseLeave,
|
|
157
159
|
onMouseDown: onMouseDown,
|
|
@@ -20,8 +20,10 @@ const LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton({
|
|
|
20
20
|
// Button already has React.memo, so just leaning on that
|
|
21
21
|
return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
|
|
22
22
|
ref: ref,
|
|
23
|
-
appearance: appearance
|
|
24
|
-
|
|
23
|
+
appearance: appearance
|
|
24
|
+
// No need to render aria-disabled when it is false
|
|
25
|
+
,
|
|
26
|
+
"aria-disabled": isLoading || undefined,
|
|
25
27
|
isDisabled: isDisabled,
|
|
26
28
|
isSelected: isSelected,
|
|
27
29
|
overlay: isLoading ? /*#__PURE__*/React.createElement(LoadingSpinner, {
|
|
@@ -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.17.
|
|
106
|
+
packageVersion: "16.17.8",
|
|
107
107
|
analyticsData: analyticsContext
|
|
108
108
|
});
|
|
109
109
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
const buttonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger'];
|
|
2
2
|
const linkButtonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger', 'link', 'subtle-link'];
|
|
3
|
-
|
|
3
|
+
const iconButtonAppearances = ['default', 'primary', 'subtle'];
|
|
4
|
+
export { buttonAppearances, linkButtonAppearances, iconButtonAppearances };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
|
+
import StarFilledIcon from '@atlaskit/icon/glyph/star-filled';
|
|
3
4
|
import Button from '../new-button/variants/default/button';
|
|
4
5
|
import LinkButton from '../new-button/variants/default/link';
|
|
5
|
-
import
|
|
6
|
+
import IconButton from '../new-button/variants/icon/button';
|
|
7
|
+
import LinkIconButton from '../new-button/variants/icon/link';
|
|
8
|
+
import { buttonAppearances, iconButtonAppearances, linkButtonAppearances } from './appearances';
|
|
6
9
|
// Add required default props to variants
|
|
7
10
|
const LinkButtonRender = /*#__PURE__*/forwardRef(({
|
|
8
11
|
href = 'home',
|
|
@@ -12,12 +15,26 @@ const LinkButtonRender = /*#__PURE__*/forwardRef(({
|
|
|
12
15
|
ref: ref,
|
|
13
16
|
href: href
|
|
14
17
|
}, rest), children));
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const IconButtonRender = /*#__PURE__*/forwardRef(({
|
|
19
|
+
icon = StarFilledIcon,
|
|
20
|
+
label = 'Label',
|
|
21
|
+
...rest
|
|
22
|
+
}, ref) => /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
23
|
+
ref: ref,
|
|
24
|
+
icon: icon,
|
|
25
|
+
label: label
|
|
26
|
+
}, rest)));
|
|
27
|
+
const LinkIconButtonRender = /*#__PURE__*/forwardRef(({
|
|
28
|
+
href = 'home',
|
|
29
|
+
icon = StarFilledIcon,
|
|
30
|
+
label = 'Label',
|
|
31
|
+
...rest
|
|
32
|
+
}, ref) => /*#__PURE__*/React.createElement(LinkIconButton, _extends({
|
|
33
|
+
ref: ref,
|
|
34
|
+
href: href,
|
|
35
|
+
icon: icon,
|
|
36
|
+
label: label
|
|
37
|
+
}, rest)));
|
|
21
38
|
const variants = [{
|
|
22
39
|
name: 'Button',
|
|
23
40
|
Component: Button,
|
|
@@ -28,5 +45,24 @@ const variants = [{
|
|
|
28
45
|
Component: LinkButtonRender,
|
|
29
46
|
elementType: HTMLAnchorElement,
|
|
30
47
|
appearances: linkButtonAppearances
|
|
48
|
+
}, {
|
|
49
|
+
name: 'IconButton',
|
|
50
|
+
Component: IconButtonRender,
|
|
51
|
+
elementType: HTMLButtonElement,
|
|
52
|
+
appearances: iconButtonAppearances
|
|
53
|
+
}, {
|
|
54
|
+
name: 'LinkIconButton',
|
|
55
|
+
Component: LinkIconButtonRender,
|
|
56
|
+
elementType: HTMLAnchorElement,
|
|
57
|
+
appearances: iconButtonAppearances
|
|
31
58
|
}];
|
|
59
|
+
export const defaultButtonVariants = variants.filter(({
|
|
60
|
+
name
|
|
61
|
+
}) => name === 'Button' || name === 'LinkButton');
|
|
62
|
+
export const linkButtonVariants = variants.filter(({
|
|
63
|
+
name
|
|
64
|
+
}) => name === 'LinkButton' || name === 'LinkIconButton');
|
|
65
|
+
export const iconButtonVariants = variants.filter(({
|
|
66
|
+
name
|
|
67
|
+
}) => name === 'IconButton' || name === 'LinkIconButton');
|
|
32
68
|
export default variants;
|
|
@@ -72,12 +72,17 @@ export var SplitButtonContainer = function SplitButtonContainer(_ref2) {
|
|
|
72
72
|
css: splitButtonStyles
|
|
73
73
|
}, children);
|
|
74
74
|
};
|
|
75
|
+
|
|
75
76
|
/**
|
|
76
77
|
* __Split Button__
|
|
77
78
|
*
|
|
78
79
|
* @private __UNSAFE__ SplitButton is not yet safe for production use.
|
|
79
80
|
*
|
|
80
|
-
*
|
|
81
|
+
* A split button lets people perform an action or choose from a small group of similar actions.
|
|
82
|
+
*
|
|
83
|
+
* - [Examples](https://atlassian.design/components/button/split-button/examples)
|
|
84
|
+
* - [Code](https://atlassian.design/components/button/split-button/code)
|
|
85
|
+
* - [Usage](https://atlassian.design/components/button/split-button/usage)
|
|
81
86
|
*/
|
|
82
87
|
export var SplitButton = function SplitButton(_ref3) {
|
|
83
88
|
var children = _ref3.children,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "testId", "href"];
|
|
3
|
+
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "testId", "UNSAFE_size", "href"];
|
|
4
4
|
import React, { forwardRef, memo } from 'react';
|
|
5
5
|
import UNSAFE_LINK from '@atlaskit/primitives/link';
|
|
6
6
|
import useIconButton from './use-icon-button';
|
|
@@ -26,6 +26,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
26
26
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
27
27
|
onClickCapture = _ref.onClickCapture,
|
|
28
28
|
testId = _ref.testId,
|
|
29
|
+
UNSAFE_size = _ref.UNSAFE_size,
|
|
29
30
|
href = _ref.href,
|
|
30
31
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
32
|
var baseProps = useIconButton({
|
|
@@ -52,7 +53,8 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
52
53
|
onClickCapture: onClickCapture,
|
|
53
54
|
overlay: overlay,
|
|
54
55
|
ref: ref,
|
|
55
|
-
spacing: spacing
|
|
56
|
+
spacing: spacing,
|
|
57
|
+
UNSAFE_size: UNSAFE_size
|
|
56
58
|
});
|
|
57
59
|
return /*#__PURE__*/React.createElement(UNSAFE_LINK
|
|
58
60
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
@@ -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.17.
|
|
110
|
+
packageVersion: "16.17.8",
|
|
111
111
|
analyticsData: analyticsContext,
|
|
112
112
|
actionSubject: buttonType
|
|
113
113
|
});
|
|
@@ -174,8 +174,10 @@ var CustomThemeButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(f
|
|
|
174
174
|
var buttonStyles = _ref4.buttonStyles;
|
|
175
175
|
return /*#__PURE__*/React.createElement(ButtonBase, _extends({}, restProps, {
|
|
176
176
|
ref: ref,
|
|
177
|
-
overlay: isLoading ? /*#__PURE__*/React.createElement(LoadingSpinner, restProps) : null
|
|
178
|
-
|
|
177
|
+
overlay: isLoading ? /*#__PURE__*/React.createElement(LoadingSpinner, restProps) : null
|
|
178
|
+
// No need to render aria-disabled when it is false
|
|
179
|
+
,
|
|
180
|
+
"aria-disabled": isLoading || undefined,
|
|
179
181
|
onMouseEnter: onMouseEnter,
|
|
180
182
|
onMouseLeave: onMouseLeave,
|
|
181
183
|
onMouseDown: onMouseDown,
|
|
@@ -22,8 +22,10 @@ var LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton(_ref, r
|
|
|
22
22
|
// Button already has React.memo, so just leaning on that
|
|
23
23
|
return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
|
|
24
24
|
ref: ref,
|
|
25
|
-
appearance: appearance
|
|
26
|
-
|
|
25
|
+
appearance: appearance
|
|
26
|
+
// No need to render aria-disabled when it is false
|
|
27
|
+
,
|
|
28
|
+
"aria-disabled": isLoading || undefined,
|
|
27
29
|
isDisabled: isDisabled,
|
|
28
30
|
isSelected: isSelected,
|
|
29
31
|
overlay: isLoading ? /*#__PURE__*/React.createElement(LoadingSpinner, {
|
|
@@ -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.17.
|
|
112
|
+
packageVersion: "16.17.8",
|
|
113
113
|
analyticsData: analyticsContext
|
|
114
114
|
});
|
|
115
115
|
|
|
@@ -24,6 +24,7 @@ export default function LoadingSpinner(_ref2) {
|
|
|
24
24
|
var size = spacing === 'default' ? 'medium' : 'small';
|
|
25
25
|
return /*#__PURE__*/React.createElement(Spinner, {
|
|
26
26
|
size: size,
|
|
27
|
+
label: ", Loading",
|
|
27
28
|
appearance: getSpinnerAppearance({
|
|
28
29
|
appearance: appearance,
|
|
29
30
|
isDisabled: isDisabled,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
var buttonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger'];
|
|
2
2
|
var linkButtonAppearances = ['default', 'primary', 'subtle', 'warning', 'danger', 'link', 'subtle-link'];
|
|
3
|
-
|
|
3
|
+
var iconButtonAppearances = ['default', 'primary', 'subtle'];
|
|
4
|
+
export { buttonAppearances, linkButtonAppearances, iconButtonAppearances };
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["href", "children"]
|
|
3
|
+
var _excluded = ["href", "children"],
|
|
4
|
+
_excluded2 = ["icon", "label"],
|
|
5
|
+
_excluded3 = ["href", "icon", "label"];
|
|
4
6
|
import React, { forwardRef } from 'react';
|
|
7
|
+
import StarFilledIcon from '@atlaskit/icon/glyph/star-filled';
|
|
5
8
|
import Button from '../new-button/variants/default/button';
|
|
6
9
|
import LinkButton from '../new-button/variants/default/link';
|
|
7
|
-
import
|
|
10
|
+
import IconButton from '../new-button/variants/icon/button';
|
|
11
|
+
import LinkIconButton from '../new-button/variants/icon/link';
|
|
12
|
+
import { buttonAppearances, iconButtonAppearances, linkButtonAppearances } from './appearances';
|
|
8
13
|
// Add required default props to variants
|
|
9
14
|
var LinkButtonRender = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
10
15
|
var _ref$href = _ref.href,
|
|
@@ -16,12 +21,33 @@ var LinkButtonRender = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
16
21
|
href: href
|
|
17
22
|
}, rest), children);
|
|
18
23
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
var IconButtonRender = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
25
|
+
var _ref2$icon = _ref2.icon,
|
|
26
|
+
icon = _ref2$icon === void 0 ? StarFilledIcon : _ref2$icon,
|
|
27
|
+
_ref2$label = _ref2.label,
|
|
28
|
+
label = _ref2$label === void 0 ? 'Label' : _ref2$label,
|
|
29
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
30
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
31
|
+
ref: ref,
|
|
32
|
+
icon: icon,
|
|
33
|
+
label: label
|
|
34
|
+
}, rest));
|
|
35
|
+
});
|
|
36
|
+
var LinkIconButtonRender = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
37
|
+
var _ref3$href = _ref3.href,
|
|
38
|
+
href = _ref3$href === void 0 ? 'home' : _ref3$href,
|
|
39
|
+
_ref3$icon = _ref3.icon,
|
|
40
|
+
icon = _ref3$icon === void 0 ? StarFilledIcon : _ref3$icon,
|
|
41
|
+
_ref3$label = _ref3.label,
|
|
42
|
+
label = _ref3$label === void 0 ? 'Label' : _ref3$label,
|
|
43
|
+
rest = _objectWithoutProperties(_ref3, _excluded3);
|
|
44
|
+
return /*#__PURE__*/React.createElement(LinkIconButton, _extends({
|
|
45
|
+
ref: ref,
|
|
46
|
+
href: href,
|
|
47
|
+
icon: icon,
|
|
48
|
+
label: label
|
|
49
|
+
}, rest));
|
|
50
|
+
});
|
|
25
51
|
var variants = [{
|
|
26
52
|
name: 'Button',
|
|
27
53
|
Component: Button,
|
|
@@ -32,5 +58,27 @@ var variants = [{
|
|
|
32
58
|
Component: LinkButtonRender,
|
|
33
59
|
elementType: HTMLAnchorElement,
|
|
34
60
|
appearances: linkButtonAppearances
|
|
61
|
+
}, {
|
|
62
|
+
name: 'IconButton',
|
|
63
|
+
Component: IconButtonRender,
|
|
64
|
+
elementType: HTMLButtonElement,
|
|
65
|
+
appearances: iconButtonAppearances
|
|
66
|
+
}, {
|
|
67
|
+
name: 'LinkIconButton',
|
|
68
|
+
Component: LinkIconButtonRender,
|
|
69
|
+
elementType: HTMLAnchorElement,
|
|
70
|
+
appearances: iconButtonAppearances
|
|
35
71
|
}];
|
|
72
|
+
export var defaultButtonVariants = variants.filter(function (_ref4) {
|
|
73
|
+
var name = _ref4.name;
|
|
74
|
+
return name === 'Button' || name === 'LinkButton';
|
|
75
|
+
});
|
|
76
|
+
export var linkButtonVariants = variants.filter(function (_ref5) {
|
|
77
|
+
var name = _ref5.name;
|
|
78
|
+
return name === 'LinkButton' || name === 'LinkIconButton';
|
|
79
|
+
});
|
|
80
|
+
export var iconButtonVariants = variants.filter(function (_ref6) {
|
|
81
|
+
var name = _ref6.name;
|
|
82
|
+
return name === 'IconButton' || name === 'LinkIconButton';
|
|
83
|
+
});
|
|
36
84
|
export default variants;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import type { SplitButtonAppearance, SplitButtonContextAppearance, SplitButtonSpacing } from './types';
|
|
4
|
+
import type { SplitButtonAppearance, SplitButtonContextAppearance, SplitButtonProps, SplitButtonSpacing } from './types';
|
|
5
5
|
type DividerProps = {
|
|
6
6
|
appearance: SplitButtonContextAppearance;
|
|
7
7
|
spacing: SplitButtonSpacing;
|
|
@@ -17,23 +17,16 @@ export declare const Divider: ({ appearance, spacing, isDisabled, }: DividerProp
|
|
|
17
17
|
export declare const SplitButtonContainer: ({ children }: {
|
|
18
18
|
children: ReactNode;
|
|
19
19
|
}) => jsx.JSX.Element;
|
|
20
|
-
type SplitButtonProps = {
|
|
21
|
-
/**
|
|
22
|
-
* Only two children are allowed.
|
|
23
|
-
* First child is the primary action, second child is the secondary action.
|
|
24
|
-
* The assumption is that for both children trees there is a button reading the context.
|
|
25
|
-
*/
|
|
26
|
-
children: ReactNode;
|
|
27
|
-
appearance?: SplitButtonAppearance;
|
|
28
|
-
spacing?: SplitButtonSpacing;
|
|
29
|
-
isDisabled?: boolean;
|
|
30
|
-
};
|
|
31
20
|
/**
|
|
32
21
|
* __Split Button__
|
|
33
22
|
*
|
|
34
23
|
* @private __UNSAFE__ SplitButton is not yet safe for production use.
|
|
35
24
|
*
|
|
36
|
-
*
|
|
25
|
+
* A split button lets people perform an action or choose from a small group of similar actions.
|
|
26
|
+
*
|
|
27
|
+
* - [Examples](https://atlassian.design/components/button/split-button/examples)
|
|
28
|
+
* - [Code](https://atlassian.design/components/button/split-button/code)
|
|
29
|
+
* - [Usage](https://atlassian.design/components/button/split-button/usage)
|
|
37
30
|
*/
|
|
38
31
|
export declare const SplitButton: ({ children, appearance, spacing, isDisabled, }: SplitButtonProps) => jsx.JSX.Element;
|
|
39
32
|
type SplitButtonWithSlotsProps = {
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type SplitButtonAppearance =
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type SplitButtonAppearance = 'default' | 'primary';
|
|
3
3
|
export type SplitButtonContextAppearance = SplitButtonAppearance | 'navigation';
|
|
4
|
-
export type SplitButtonSpacing =
|
|
4
|
+
export type SplitButtonSpacing = 'default' | 'compact';
|
|
5
|
+
export type SplitButtonProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Only two children are allowed.
|
|
8
|
+
* First child is the primary action, second child is the secondary action.
|
|
9
|
+
* The assumption is that for both children trees there is a button reading the context.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* The style variation for child buttons. Will override any appearance set on a child button.
|
|
14
|
+
*/
|
|
15
|
+
appearance?: SplitButtonAppearance;
|
|
16
|
+
/**
|
|
17
|
+
* Controls the amount of padding in the child buttons.
|
|
18
|
+
*/
|
|
19
|
+
spacing?: SplitButtonSpacing;
|
|
20
|
+
/**
|
|
21
|
+
* Whether all child buttons should be disabled.
|
|
22
|
+
*/
|
|
23
|
+
isDisabled?: boolean;
|
|
24
|
+
};
|
|
@@ -2,7 +2,7 @@ import React, { type Ref } from 'react';
|
|
|
2
2
|
import { type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
4
|
export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & Omit<CommonLinkVariantProps<RouterLinkConfig>, 'children' | 'appearance'>;
|
|
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, testId, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
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, testId, UNSAFE_size, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Icon Button__
|
|
8
8
|
*
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type Size } from '@atlaskit/icon/types';
|
|
2
1
|
import { type IconButtonAppearance, type IconProp } from '../types';
|
|
3
2
|
export type CommonIconButtonProps = {
|
|
4
3
|
/**
|
|
@@ -14,9 +13,8 @@ export type CommonIconButtonProps = {
|
|
|
14
13
|
*/
|
|
15
14
|
label: string;
|
|
16
15
|
/**
|
|
17
|
-
* Set the size of the icon
|
|
18
|
-
*
|
|
16
|
+
* Set the size of the icon. `medium` is default, so it does not need to be specified.
|
|
19
17
|
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API
|
|
20
18
|
*/
|
|
21
|
-
UNSAFE_size?:
|
|
19
|
+
UNSAFE_size?: 'small' | 'large' | 'xlarge';
|
|
22
20
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type ButtonAppearance, type LinkButtonAppearance } from '../new-button/variants/types';
|
|
1
|
+
import { type ButtonAppearance, type IconButtonAppearance, type LinkButtonAppearance } from '../new-button/variants/types';
|
|
2
2
|
declare const buttonAppearances: ButtonAppearance[];
|
|
3
3
|
declare const linkButtonAppearances: LinkButtonAppearance[];
|
|
4
|
-
|
|
4
|
+
declare const iconButtonAppearances: IconButtonAppearance[];
|
|
5
|
+
export { buttonAppearances, linkButtonAppearances, iconButtonAppearances };
|
|
@@ -1,31 +1,51 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Button from '../new-button/variants/default/button';
|
|
3
3
|
import { LinkButtonProps } from '../new-button/variants/default/link';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { type IconButtonProps } from '../new-button/variants/icon/button';
|
|
5
|
+
import { type LinkIconButtonProps } from '../new-button/variants/icon/link';
|
|
6
|
+
import { buttonAppearances, iconButtonAppearances, linkButtonAppearances } from './appearances';
|
|
7
|
+
type DefaultButtonVariant = {
|
|
6
8
|
name: 'Button';
|
|
7
9
|
Component: typeof Button;
|
|
8
10
|
elementType: typeof HTMLButtonElement;
|
|
9
11
|
appearances: typeof buttonAppearances;
|
|
10
|
-
}
|
|
12
|
+
};
|
|
13
|
+
type LinkButtonVariant = {
|
|
11
14
|
name: 'LinkButton';
|
|
12
15
|
Component: typeof LinkButtonRender;
|
|
13
16
|
elementType: typeof HTMLAnchorElement;
|
|
14
17
|
appearances: typeof linkButtonAppearances;
|
|
15
18
|
};
|
|
19
|
+
type IconButtonVariant = {
|
|
20
|
+
name: 'IconButton';
|
|
21
|
+
Component: typeof IconButtonRender;
|
|
22
|
+
elementType: typeof HTMLButtonElement;
|
|
23
|
+
appearances: typeof iconButtonAppearances;
|
|
24
|
+
};
|
|
25
|
+
type LinkIconButtonVariant = {
|
|
26
|
+
name: 'LinkIconButton';
|
|
27
|
+
Component: typeof LinkIconButtonRender;
|
|
28
|
+
elementType: typeof HTMLAnchorElement;
|
|
29
|
+
appearances: typeof iconButtonAppearances;
|
|
30
|
+
};
|
|
31
|
+
type DefaultButtonVariants = DefaultButtonVariant | LinkButtonVariant;
|
|
32
|
+
type LinkButtonVariants = LinkButtonVariant | LinkIconButtonVariant;
|
|
33
|
+
type IconButtonVariants = IconButtonVariant | LinkIconButtonVariant;
|
|
34
|
+
export type Variant = DefaultButtonVariant | LinkButtonVariant | IconButtonVariant | LinkIconButtonVariant;
|
|
16
35
|
declare const LinkButtonRender: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
|
|
17
36
|
href?: string | undefined;
|
|
18
37
|
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
appearances: import("../new-button/variants/types").LinkButtonAppearance[];
|
|
29
|
-
}[];
|
|
38
|
+
declare const IconButtonRender: React.ForwardRefExoticComponent<Omit<IconButtonProps, "label" | "icon"> & {
|
|
39
|
+
icon?: import("../new-button/variants/types").IconProp | undefined;
|
|
40
|
+
label?: string | undefined;
|
|
41
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
42
|
+
declare const LinkIconButtonRender: React.ForwardRefExoticComponent<Omit<LinkIconButtonProps<never>, "label" | "href" | "icon"> & {
|
|
43
|
+
href?: string | undefined;
|
|
44
|
+
icon?: import("../new-button/variants/types").IconProp | undefined;
|
|
45
|
+
label?: string | undefined;
|
|
46
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
30
47
|
declare const variants: Variant[];
|
|
48
|
+
export declare const defaultButtonVariants: DefaultButtonVariants[];
|
|
49
|
+
export declare const linkButtonVariants: LinkButtonVariants[];
|
|
50
|
+
export declare const iconButtonVariants: IconButtonVariants[];
|
|
31
51
|
export default variants;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import type { SplitButtonAppearance, SplitButtonContextAppearance, SplitButtonSpacing } from './types';
|
|
4
|
+
import type { SplitButtonAppearance, SplitButtonContextAppearance, SplitButtonProps, SplitButtonSpacing } from './types';
|
|
5
5
|
type DividerProps = {
|
|
6
6
|
appearance: SplitButtonContextAppearance;
|
|
7
7
|
spacing: SplitButtonSpacing;
|
|
@@ -17,23 +17,16 @@ export declare const Divider: ({ appearance, spacing, isDisabled, }: DividerProp
|
|
|
17
17
|
export declare const SplitButtonContainer: ({ children }: {
|
|
18
18
|
children: ReactNode;
|
|
19
19
|
}) => jsx.JSX.Element;
|
|
20
|
-
type SplitButtonProps = {
|
|
21
|
-
/**
|
|
22
|
-
* Only two children are allowed.
|
|
23
|
-
* First child is the primary action, second child is the secondary action.
|
|
24
|
-
* The assumption is that for both children trees there is a button reading the context.
|
|
25
|
-
*/
|
|
26
|
-
children: ReactNode;
|
|
27
|
-
appearance?: SplitButtonAppearance;
|
|
28
|
-
spacing?: SplitButtonSpacing;
|
|
29
|
-
isDisabled?: boolean;
|
|
30
|
-
};
|
|
31
20
|
/**
|
|
32
21
|
* __Split Button__
|
|
33
22
|
*
|
|
34
23
|
* @private __UNSAFE__ SplitButton is not yet safe for production use.
|
|
35
24
|
*
|
|
36
|
-
*
|
|
25
|
+
* A split button lets people perform an action or choose from a small group of similar actions.
|
|
26
|
+
*
|
|
27
|
+
* - [Examples](https://atlassian.design/components/button/split-button/examples)
|
|
28
|
+
* - [Code](https://atlassian.design/components/button/split-button/code)
|
|
29
|
+
* - [Usage](https://atlassian.design/components/button/split-button/usage)
|
|
37
30
|
*/
|
|
38
31
|
export declare const SplitButton: ({ children, appearance, spacing, isDisabled, }: SplitButtonProps) => jsx.JSX.Element;
|
|
39
32
|
type SplitButtonWithSlotsProps = {
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type SplitButtonAppearance =
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type SplitButtonAppearance = 'default' | 'primary';
|
|
3
3
|
export type SplitButtonContextAppearance = SplitButtonAppearance | 'navigation';
|
|
4
|
-
export type SplitButtonSpacing =
|
|
4
|
+
export type SplitButtonSpacing = 'default' | 'compact';
|
|
5
|
+
export type SplitButtonProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Only two children are allowed.
|
|
8
|
+
* First child is the primary action, second child is the secondary action.
|
|
9
|
+
* The assumption is that for both children trees there is a button reading the context.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* The style variation for child buttons. Will override any appearance set on a child button.
|
|
14
|
+
*/
|
|
15
|
+
appearance?: SplitButtonAppearance;
|
|
16
|
+
/**
|
|
17
|
+
* Controls the amount of padding in the child buttons.
|
|
18
|
+
*/
|
|
19
|
+
spacing?: SplitButtonSpacing;
|
|
20
|
+
/**
|
|
21
|
+
* Whether all child buttons should be disabled.
|
|
22
|
+
*/
|
|
23
|
+
isDisabled?: boolean;
|
|
24
|
+
};
|
|
@@ -2,7 +2,7 @@ import React, { type Ref } from 'react';
|
|
|
2
2
|
import { type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
4
|
export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & Omit<CommonLinkVariantProps<RouterLinkConfig>, 'children' | 'appearance'>;
|
|
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, testId, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
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, testId, UNSAFE_size, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Icon Button__
|
|
8
8
|
*
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type Size } from '@atlaskit/icon/types';
|
|
2
1
|
import { type IconButtonAppearance, type IconProp } from '../types';
|
|
3
2
|
export type CommonIconButtonProps = {
|
|
4
3
|
/**
|
|
@@ -14,9 +13,8 @@ export type CommonIconButtonProps = {
|
|
|
14
13
|
*/
|
|
15
14
|
label: string;
|
|
16
15
|
/**
|
|
17
|
-
* Set the size of the icon
|
|
18
|
-
*
|
|
16
|
+
* Set the size of the icon. `medium` is default, so it does not need to be specified.
|
|
19
17
|
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API
|
|
20
18
|
*/
|
|
21
|
-
UNSAFE_size?:
|
|
19
|
+
UNSAFE_size?: 'small' | 'large' | 'xlarge';
|
|
22
20
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type ButtonAppearance, type LinkButtonAppearance } from '../new-button/variants/types';
|
|
1
|
+
import { type ButtonAppearance, type IconButtonAppearance, type LinkButtonAppearance } from '../new-button/variants/types';
|
|
2
2
|
declare const buttonAppearances: ButtonAppearance[];
|
|
3
3
|
declare const linkButtonAppearances: LinkButtonAppearance[];
|
|
4
|
-
|
|
4
|
+
declare const iconButtonAppearances: IconButtonAppearance[];
|
|
5
|
+
export { buttonAppearances, linkButtonAppearances, iconButtonAppearances };
|
|
@@ -1,31 +1,51 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Button from '../new-button/variants/default/button';
|
|
3
3
|
import { LinkButtonProps } from '../new-button/variants/default/link';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { type IconButtonProps } from '../new-button/variants/icon/button';
|
|
5
|
+
import { type LinkIconButtonProps } from '../new-button/variants/icon/link';
|
|
6
|
+
import { buttonAppearances, iconButtonAppearances, linkButtonAppearances } from './appearances';
|
|
7
|
+
type DefaultButtonVariant = {
|
|
6
8
|
name: 'Button';
|
|
7
9
|
Component: typeof Button;
|
|
8
10
|
elementType: typeof HTMLButtonElement;
|
|
9
11
|
appearances: typeof buttonAppearances;
|
|
10
|
-
}
|
|
12
|
+
};
|
|
13
|
+
type LinkButtonVariant = {
|
|
11
14
|
name: 'LinkButton';
|
|
12
15
|
Component: typeof LinkButtonRender;
|
|
13
16
|
elementType: typeof HTMLAnchorElement;
|
|
14
17
|
appearances: typeof linkButtonAppearances;
|
|
15
18
|
};
|
|
19
|
+
type IconButtonVariant = {
|
|
20
|
+
name: 'IconButton';
|
|
21
|
+
Component: typeof IconButtonRender;
|
|
22
|
+
elementType: typeof HTMLButtonElement;
|
|
23
|
+
appearances: typeof iconButtonAppearances;
|
|
24
|
+
};
|
|
25
|
+
type LinkIconButtonVariant = {
|
|
26
|
+
name: 'LinkIconButton';
|
|
27
|
+
Component: typeof LinkIconButtonRender;
|
|
28
|
+
elementType: typeof HTMLAnchorElement;
|
|
29
|
+
appearances: typeof iconButtonAppearances;
|
|
30
|
+
};
|
|
31
|
+
type DefaultButtonVariants = DefaultButtonVariant | LinkButtonVariant;
|
|
32
|
+
type LinkButtonVariants = LinkButtonVariant | LinkIconButtonVariant;
|
|
33
|
+
type IconButtonVariants = IconButtonVariant | LinkIconButtonVariant;
|
|
34
|
+
export type Variant = DefaultButtonVariant | LinkButtonVariant | IconButtonVariant | LinkIconButtonVariant;
|
|
16
35
|
declare const LinkButtonRender: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
|
|
17
36
|
href?: string | undefined;
|
|
18
37
|
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
appearances: import("../new-button/variants/types").LinkButtonAppearance[];
|
|
29
|
-
}[];
|
|
38
|
+
declare const IconButtonRender: React.ForwardRefExoticComponent<Omit<IconButtonProps, "label" | "icon"> & {
|
|
39
|
+
icon?: import("../new-button/variants/types").IconProp | undefined;
|
|
40
|
+
label?: string | undefined;
|
|
41
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
42
|
+
declare const LinkIconButtonRender: React.ForwardRefExoticComponent<Omit<LinkIconButtonProps<never>, "label" | "href" | "icon"> & {
|
|
43
|
+
href?: string | undefined;
|
|
44
|
+
icon?: import("../new-button/variants/types").IconProp | undefined;
|
|
45
|
+
label?: string | undefined;
|
|
46
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
30
47
|
declare const variants: Variant[];
|
|
48
|
+
export declare const defaultButtonVariants: DefaultButtonVariants[];
|
|
49
|
+
export declare const linkButtonVariants: LinkButtonVariants[];
|
|
50
|
+
export declare const iconButtonVariants: IconButtonVariants[];
|
|
31
51
|
export default variants;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/button",
|
|
3
|
-
"version": "16.17.
|
|
3
|
+
"version": "16.17.8",
|
|
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/"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"title": "Split button",
|
|
58
58
|
"id": "split-button",
|
|
59
59
|
"status": {
|
|
60
|
-
"type": "
|
|
60
|
+
"type": "closed-beta"
|
|
61
61
|
},
|
|
62
62
|
"sortKey": 4
|
|
63
63
|
}
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@atlaskit/icon": "^22.0.0",
|
|
86
86
|
"@atlaskit/interaction-context": "^2.1.0",
|
|
87
87
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
88
|
-
"@atlaskit/primitives": "^1.
|
|
88
|
+
"@atlaskit/primitives": "^1.13.0",
|
|
89
89
|
"@atlaskit/spinner": "^16.0.0",
|
|
90
90
|
"@atlaskit/theme": "^12.6.0",
|
|
91
91
|
"@atlaskit/tokens": "^1.29.0",
|