@atlaskit/button 16.17.0 → 16.17.2
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 +16 -12
- package/dist/cjs/new-button/variants/icon/button.js +8 -4
- package/dist/cjs/new-button/variants/icon/link.js +5 -3
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +9 -3
- package/dist/cjs/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/cjs/utils/variants.js +3 -61
- package/dist/es2019/new-button/containers/split-button/split-button.js +16 -12
- package/dist/es2019/new-button/variants/icon/button.js +7 -3
- package/dist/es2019/new-button/variants/icon/link.js +4 -2
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +9 -5
- package/dist/es2019/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/es2019/utils/variants.js +2 -59
- package/dist/esm/new-button/containers/split-button/split-button.js +16 -12
- package/dist/esm/new-button/variants/icon/button.js +8 -4
- package/dist/esm/new-button/variants/icon/link.js +5 -3
- package/dist/esm/new-button/variants/icon/use-icon-button.js +9 -3
- package/dist/esm/new-button/variants/shared/use-button-base.js +1 -1
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/esm/utils/variants.js +3 -64
- package/dist/types/new-button/variants/icon/button.d.ts +2 -2
- package/dist/types/new-button/variants/icon/link.d.ts +3 -3
- package/dist/types/new-button/variants/icon/types.d.ts +19 -4
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +1 -1
- package/dist/types/new-button/variants/types.d.ts +5 -4
- package/dist/types/utils/variants.d.ts +3 -15
- package/dist/types-ts4.5/new-button/variants/icon/button.d.ts +2 -2
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +3 -3
- package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +19 -4
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/types.d.ts +5 -4
- package/dist/types-ts4.5/utils/variants.d.ts +3 -15
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 16.17.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#43263](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43263) [`09f29df6245`](https://bitbucket.org/atlassian/atlassian-frontend/commits/09f29df6245) - Update IconButton API to be bounded with unsafe fallback for icon sizing
|
|
8
|
+
|
|
9
|
+
## 16.17.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#42681](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42681) [`df138bd3900`](https://bitbucket.org/atlassian/atlassian-frontend/commits/df138bd3900) - [ux] Update to divider colors and height in SplitButton (alpha)
|
|
14
|
+
|
|
3
15
|
## 16.17.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -5,18 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SplitButtonWithSlots = exports.SplitButtonContainer = exports.SplitButton = exports.Divider = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
9
8
|
var _splitButtonContext = require("./split-button-context");
|
|
10
9
|
var _utils = require("./utils");
|
|
11
10
|
/** @jsx jsx */
|
|
12
11
|
|
|
13
|
-
var
|
|
14
|
-
var defaultDividerHeight = 20 / fontSize + 'em';
|
|
12
|
+
var defaultDividerHeight = '16px';
|
|
15
13
|
var defaultDividerStyles = (0, _react.css)({
|
|
16
14
|
height: defaultDividerHeight,
|
|
17
15
|
margin: "var(--ds-space-075, 6px)".concat(" -0.5px")
|
|
18
16
|
});
|
|
19
|
-
var compactDividerHeight =
|
|
17
|
+
var compactDividerHeight = '12px';
|
|
20
18
|
var compactDividerStyles = (0, _react.css)({
|
|
21
19
|
height: compactDividerHeight,
|
|
22
20
|
margin: "var(--ds-space-050, 4px)".concat(" -0.5px")
|
|
@@ -27,27 +25,32 @@ var baseDividerStyles = (0, _react.css)({
|
|
|
27
25
|
position: 'relative',
|
|
28
26
|
zIndex: 2
|
|
29
27
|
});
|
|
30
|
-
var
|
|
31
|
-
backgroundColor: "var(--ds-
|
|
28
|
+
var dividerDisabledStyles = (0, _react.css)({
|
|
29
|
+
backgroundColor: "var(--ds-text-disabled, #091E4224)",
|
|
32
30
|
cursor: 'not-allowed'
|
|
33
31
|
});
|
|
34
32
|
var navigationDividerStyles = (0, _react.css)({
|
|
35
33
|
height: compactDividerHeight,
|
|
36
34
|
margin: "var(--ds-space-100, 8px)".concat(" -0.5px"),
|
|
37
|
-
backgroundColor: "var(--ds-
|
|
35
|
+
backgroundColor: "var(--ds-text-subtle, #0052cc)",
|
|
36
|
+
opacity: 0.62
|
|
38
37
|
});
|
|
39
38
|
var dividerAppearance = {
|
|
40
39
|
default: (0, _react.css)({
|
|
41
|
-
backgroundColor: "var(--ds-text, #172B4D)"
|
|
40
|
+
backgroundColor: "var(--ds-text, #172B4D)",
|
|
41
|
+
opacity: 0.51
|
|
42
42
|
}),
|
|
43
43
|
primary: (0, _react.css)({
|
|
44
|
-
backgroundColor: "var(--ds-text-inverse, #FFF)"
|
|
44
|
+
backgroundColor: "var(--ds-text-inverse, #FFF)",
|
|
45
|
+
opacity: 0.64
|
|
45
46
|
}),
|
|
46
47
|
danger: (0, _react.css)({
|
|
47
|
-
backgroundColor: "var(--ds-text-inverse, #FFF)"
|
|
48
|
+
backgroundColor: "var(--ds-text-inverse, #FFF)",
|
|
49
|
+
opacity: 0.66
|
|
48
50
|
}),
|
|
49
51
|
warning: (0, _react.css)({
|
|
50
|
-
backgroundColor: "var(--ds-text-warning-inverse, #172B4D)"
|
|
52
|
+
backgroundColor: "var(--ds-text-warning-inverse, #172B4D)",
|
|
53
|
+
opacity: 0.52
|
|
51
54
|
}),
|
|
52
55
|
navigation: navigationDividerStyles
|
|
53
56
|
};
|
|
@@ -66,13 +69,14 @@ var Divider = exports.Divider = function Divider(_ref) {
|
|
|
66
69
|
return (
|
|
67
70
|
// I find it funny to provide a div for Divider
|
|
68
71
|
(0, _react.jsx)("div", {
|
|
69
|
-
css: [baseDividerStyles, dividerAppearance[appearance], dividerHeight[spacing], isDisabled ?
|
|
72
|
+
css: [baseDividerStyles, dividerAppearance[appearance], dividerHeight[spacing], isDisabled ? dividerDisabledStyles : undefined]
|
|
70
73
|
})
|
|
71
74
|
);
|
|
72
75
|
};
|
|
73
76
|
var splitButtonStyles = (0, _react.css)({
|
|
74
77
|
display: 'inline-flex',
|
|
75
78
|
position: 'relative',
|
|
79
|
+
alignItems: 'center',
|
|
76
80
|
whiteSpace: 'nowrap'
|
|
77
81
|
});
|
|
78
82
|
|
|
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
|
|
12
12
|
var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
|
|
13
|
-
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "
|
|
13
|
+
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "type", "testId", "UNSAFE_size"];
|
|
14
14
|
/**
|
|
15
15
|
* __Icon Button__
|
|
16
16
|
*
|
|
@@ -30,8 +30,8 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
30
30
|
isDisabled = _ref.isDisabled,
|
|
31
31
|
isSelected = _ref.isSelected,
|
|
32
32
|
icon = _ref.icon,
|
|
33
|
-
children = _ref.children,
|
|
34
33
|
interactionName = _ref.interactionName,
|
|
34
|
+
label = _ref.label,
|
|
35
35
|
overlay = _ref.overlay,
|
|
36
36
|
onClick = _ref.onClick,
|
|
37
37
|
onMouseDownCapture = _ref.onMouseDownCapture,
|
|
@@ -46,6 +46,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
46
46
|
_ref$type = _ref.type,
|
|
47
47
|
type = _ref$type === void 0 ? 'button' : _ref$type,
|
|
48
48
|
testId = _ref.testId,
|
|
49
|
+
UNSAFE_size = _ref.UNSAFE_size,
|
|
49
50
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
50
51
|
/**
|
|
51
52
|
* TODO: At some stage I'll look into re-using more logic across 'default' and 'icon'
|
|
@@ -56,11 +57,13 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
56
57
|
appearance: appearance,
|
|
57
58
|
autoFocus: autoFocus,
|
|
58
59
|
buttonType: 'button',
|
|
59
|
-
children:
|
|
60
|
+
children: null,
|
|
61
|
+
// Set in hook.
|
|
60
62
|
icon: icon,
|
|
61
63
|
interactionName: interactionName,
|
|
62
64
|
isDisabled: isDisabled,
|
|
63
65
|
isSelected: isSelected,
|
|
66
|
+
label: label,
|
|
64
67
|
onClick: onClick,
|
|
65
68
|
onMouseDownCapture: onMouseDownCapture,
|
|
66
69
|
onMouseUpCapture: onMouseUpCapture,
|
|
@@ -73,7 +76,8 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
73
76
|
onClickCapture: onClickCapture,
|
|
74
77
|
overlay: overlay,
|
|
75
78
|
ref: ref,
|
|
76
|
-
spacing: spacing
|
|
79
|
+
spacing: spacing,
|
|
80
|
+
UNSAFE_size: UNSAFE_size
|
|
77
81
|
});
|
|
78
82
|
return /*#__PURE__*/_react.default.createElement(_pressable.default, (0, _extends2.default)({}, rest, {
|
|
79
83
|
ref: baseProps.ref,
|
|
@@ -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", "
|
|
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"];
|
|
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) {
|
|
@@ -22,8 +22,8 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
22
22
|
isDisabled = _ref.isDisabled,
|
|
23
23
|
isSelected = _ref.isSelected,
|
|
24
24
|
icon = _ref.icon,
|
|
25
|
-
children = _ref.children,
|
|
26
25
|
interactionName = _ref.interactionName,
|
|
26
|
+
label = _ref.label,
|
|
27
27
|
overlay = _ref.overlay,
|
|
28
28
|
onClick = _ref.onClick,
|
|
29
29
|
onMouseDownCapture = _ref.onMouseDownCapture,
|
|
@@ -43,11 +43,13 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
43
43
|
appearance: appearance,
|
|
44
44
|
autoFocus: autoFocus,
|
|
45
45
|
buttonType: 'link',
|
|
46
|
-
children:
|
|
46
|
+
children: null,
|
|
47
|
+
// Set in hook.
|
|
47
48
|
icon: icon,
|
|
48
49
|
interactionName: interactionName,
|
|
49
50
|
isDisabled: isDisabled,
|
|
50
51
|
isSelected: isSelected,
|
|
52
|
+
label: label,
|
|
51
53
|
onClick: onClick,
|
|
52
54
|
onMouseDownCapture: onMouseDownCapture,
|
|
53
55
|
onMouseUpCapture: onMouseUpCapture,
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
9
10
|
var _content = _interopRequireDefault(require("../shared/content"));
|
|
10
11
|
var _useButtonBase = _interopRequireDefault(require("../shared/use-button-base"));
|
|
11
12
|
/**
|
|
@@ -22,10 +23,11 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
22
23
|
appearance = _ref.appearance,
|
|
23
24
|
autoFocus = _ref.autoFocus,
|
|
24
25
|
buttonType = _ref.buttonType,
|
|
25
|
-
|
|
26
|
+
Icon = _ref.icon,
|
|
26
27
|
interactionName = _ref.interactionName,
|
|
27
28
|
isDisabled = _ref.isDisabled,
|
|
28
29
|
isSelected = _ref.isSelected,
|
|
30
|
+
label = _ref.label,
|
|
29
31
|
onClick = _ref.onClick,
|
|
30
32
|
onMouseDownCapture = _ref.onMouseDownCapture,
|
|
31
33
|
onMouseUpCapture = _ref.onMouseUpCapture,
|
|
@@ -39,7 +41,8 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
39
41
|
overlay = _ref.overlay,
|
|
40
42
|
ref = _ref.ref,
|
|
41
43
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
42
|
-
spacing = _ref.spacing
|
|
44
|
+
spacing = _ref.spacing,
|
|
45
|
+
UNSAFE_size = _ref.UNSAFE_size;
|
|
43
46
|
var hasOverlay = Boolean(overlay);
|
|
44
47
|
var baseProps = (0, _useButtonBase.default)({
|
|
45
48
|
analyticsContext: analyticsContext,
|
|
@@ -53,7 +56,10 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
53
56
|
children: /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
54
57
|
type: "icon",
|
|
55
58
|
hasOverlay: hasOverlay
|
|
56
|
-
},
|
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(Icon, {
|
|
60
|
+
label: "",
|
|
61
|
+
size: UNSAFE_size
|
|
62
|
+
}), /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, null, label)),
|
|
57
63
|
interactionName: interactionName,
|
|
58
64
|
isDisabled: isDisabled,
|
|
59
65
|
isSelected: isSelected,
|
|
@@ -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.2",
|
|
119
119
|
analyticsData: analyticsContext,
|
|
120
120
|
actionSubject: buttonType
|
|
121
121
|
});
|
|
@@ -118,7 +118,7 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
|
|
|
118
118
|
action: 'clicked',
|
|
119
119
|
componentName: 'button',
|
|
120
120
|
packageName: "@atlaskit/button",
|
|
121
|
-
packageVersion: "16.17.
|
|
121
|
+
packageVersion: "16.17.2",
|
|
122
122
|
analyticsData: analyticsContext
|
|
123
123
|
});
|
|
124
124
|
|
|
@@ -9,16 +9,10 @@ exports.linkButtonVariants = exports.default = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _add = _interopRequireDefault(require("@atlaskit/icon/glyph/add"));
|
|
13
12
|
var _button = _interopRequireDefault(require("../new-button/variants/default/button"));
|
|
14
13
|
var _link = _interopRequireDefault(require("../new-button/variants/default/link"));
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var _excluded = ["href", "children"],
|
|
18
|
-
_excluded2 = ["href", "children", "icon"]; // eslint-disable-next-line import/no-extraneous-dependencies
|
|
19
|
-
// import IconButton, {
|
|
20
|
-
// IconButtonProps,
|
|
21
|
-
// } from '../new-button/variants/icon/button';
|
|
14
|
+
var _appearances = require("./appearances");
|
|
15
|
+
var _excluded = ["href", "children"];
|
|
22
16
|
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); }
|
|
23
17
|
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; }
|
|
24
18
|
// Add required default props to variants
|
|
@@ -32,51 +26,11 @@ var LinkButtonRender = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
32
26
|
href: href
|
|
33
27
|
}, rest), children);
|
|
34
28
|
});
|
|
35
|
-
|
|
36
|
-
// TODO: Enable icon button in tests once it's ready
|
|
37
|
-
// const IconButtonRender = forwardRef(
|
|
38
|
-
// (
|
|
39
|
-
// {
|
|
40
|
-
// children,
|
|
41
|
-
// icon = <AddIcon label="" />,
|
|
42
|
-
// ...rest
|
|
43
|
-
// }: Omit<IconButtonProps, 'icon'> & {
|
|
44
|
-
// icon?: IconButtonProps['icon'];
|
|
45
|
-
// },
|
|
46
|
-
// ref: React.Ref<HTMLButtonElement>,
|
|
47
|
-
// ) => (
|
|
48
|
-
// <IconButton ref={ref} icon={icon} {...rest}>
|
|
49
|
-
// {children}
|
|
50
|
-
// </IconButton>
|
|
51
|
-
// ),
|
|
52
|
-
// );
|
|
53
|
-
|
|
54
|
-
var LinkIconButtonRender = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
55
|
-
var _ref2$href = _ref2.href,
|
|
56
|
-
href = _ref2$href === void 0 ? '/home' : _ref2$href,
|
|
57
|
-
children = _ref2.children,
|
|
58
|
-
_ref2$icon = _ref2.icon,
|
|
59
|
-
icon = _ref2$icon === void 0 ? /*#__PURE__*/_react.default.createElement(_add.default, {
|
|
60
|
-
label: ""
|
|
61
|
-
}) : _ref2$icon,
|
|
62
|
-
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
63
|
-
return /*#__PURE__*/_react.default.createElement(_link2.default, (0, _extends2.default)({
|
|
64
|
-
ref: ref,
|
|
65
|
-
icon: icon,
|
|
66
|
-
href: href
|
|
67
|
-
}, rest), children);
|
|
68
|
-
});
|
|
69
29
|
var linkButtonVariants = exports.linkButtonVariants = [{
|
|
70
30
|
name: 'LinkButton',
|
|
71
31
|
Component: LinkButtonRender,
|
|
72
32
|
elementType: HTMLAnchorElement,
|
|
73
33
|
appearances: _appearances.linkButtonAppearances
|
|
74
|
-
}, {
|
|
75
|
-
name: 'LinkIconButton',
|
|
76
|
-
Component: LinkIconButtonRender,
|
|
77
|
-
elementType: HTMLAnchorElement,
|
|
78
|
-
// TODO: Make specific to icon button
|
|
79
|
-
appearances: _appearances.linkButtonAppearances
|
|
80
34
|
}];
|
|
81
35
|
var variants = [{
|
|
82
36
|
name: 'Button',
|
|
@@ -88,17 +42,5 @@ var variants = [{
|
|
|
88
42
|
Component: LinkButtonRender,
|
|
89
43
|
elementType: HTMLAnchorElement,
|
|
90
44
|
appearances: _appearances.linkButtonAppearances
|
|
91
|
-
}
|
|
92
|
-
// TODO: Enable icon buttons in tests once it's ready
|
|
93
|
-
// {
|
|
94
|
-
// name: 'IconButton',
|
|
95
|
-
// Component: IconButtonRender,
|
|
96
|
-
// elementType: HTMLButtonElement,
|
|
97
|
-
// },
|
|
98
|
-
// {
|
|
99
|
-
// name: 'LinkIconButton',
|
|
100
|
-
// Component: LinkIconButtonRender,
|
|
101
|
-
// elementType: HTMLAnchorElement,
|
|
102
|
-
// },
|
|
103
|
-
];
|
|
45
|
+
}];
|
|
104
46
|
var _default = exports.default = variants;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import { fontSize as getFontSize } from '@atlaskit/theme/constants';
|
|
5
4
|
import { SplitButtonContext } from './split-button-context';
|
|
6
5
|
import { getActions } from './utils';
|
|
7
|
-
const
|
|
8
|
-
const defaultDividerHeight = 20 / fontSize + 'em';
|
|
6
|
+
const defaultDividerHeight = '16px';
|
|
9
7
|
const defaultDividerStyles = css({
|
|
10
8
|
height: defaultDividerHeight,
|
|
11
9
|
margin: `${"var(--ds-space-075, 6px)"} -0.5px`
|
|
12
10
|
});
|
|
13
|
-
const compactDividerHeight =
|
|
11
|
+
const compactDividerHeight = '12px';
|
|
14
12
|
const compactDividerStyles = css({
|
|
15
13
|
height: compactDividerHeight,
|
|
16
14
|
margin: `${"var(--ds-space-050, 4px)"} -0.5px`
|
|
@@ -21,27 +19,32 @@ const baseDividerStyles = css({
|
|
|
21
19
|
position: 'relative',
|
|
22
20
|
zIndex: 2
|
|
23
21
|
});
|
|
24
|
-
const
|
|
25
|
-
backgroundColor: "var(--ds-
|
|
22
|
+
const dividerDisabledStyles = css({
|
|
23
|
+
backgroundColor: "var(--ds-text-disabled, #091E4224)",
|
|
26
24
|
cursor: 'not-allowed'
|
|
27
25
|
});
|
|
28
26
|
const navigationDividerStyles = css({
|
|
29
27
|
height: compactDividerHeight,
|
|
30
28
|
margin: `${"var(--ds-space-100, 8px)"} -0.5px`,
|
|
31
|
-
backgroundColor: "var(--ds-
|
|
29
|
+
backgroundColor: "var(--ds-text-subtle, #0052cc)",
|
|
30
|
+
opacity: 0.62
|
|
32
31
|
});
|
|
33
32
|
const dividerAppearance = {
|
|
34
33
|
default: css({
|
|
35
|
-
backgroundColor: "var(--ds-text, #172B4D)"
|
|
34
|
+
backgroundColor: "var(--ds-text, #172B4D)",
|
|
35
|
+
opacity: 0.51
|
|
36
36
|
}),
|
|
37
37
|
primary: css({
|
|
38
|
-
backgroundColor: "var(--ds-text-inverse, #FFF)"
|
|
38
|
+
backgroundColor: "var(--ds-text-inverse, #FFF)",
|
|
39
|
+
opacity: 0.64
|
|
39
40
|
}),
|
|
40
41
|
danger: css({
|
|
41
|
-
backgroundColor: "var(--ds-text-inverse, #FFF)"
|
|
42
|
+
backgroundColor: "var(--ds-text-inverse, #FFF)",
|
|
43
|
+
opacity: 0.66
|
|
42
44
|
}),
|
|
43
45
|
warning: css({
|
|
44
|
-
backgroundColor: "var(--ds-text-warning-inverse, #172B4D)"
|
|
46
|
+
backgroundColor: "var(--ds-text-warning-inverse, #172B4D)",
|
|
47
|
+
opacity: 0.52
|
|
45
48
|
}),
|
|
46
49
|
navigation: navigationDividerStyles
|
|
47
50
|
};
|
|
@@ -60,13 +63,14 @@ export const Divider = ({
|
|
|
60
63
|
return (
|
|
61
64
|
// I find it funny to provide a div for Divider
|
|
62
65
|
jsx("div", {
|
|
63
|
-
css: [baseDividerStyles, dividerAppearance[appearance], dividerHeight[spacing], isDisabled ?
|
|
66
|
+
css: [baseDividerStyles, dividerAppearance[appearance], dividerHeight[spacing], isDisabled ? dividerDisabledStyles : undefined]
|
|
64
67
|
})
|
|
65
68
|
);
|
|
66
69
|
};
|
|
67
70
|
const splitButtonStyles = css({
|
|
68
71
|
display: 'inline-flex',
|
|
69
72
|
position: 'relative',
|
|
73
|
+
alignItems: 'center',
|
|
70
74
|
whiteSpace: 'nowrap'
|
|
71
75
|
});
|
|
72
76
|
|
|
@@ -21,8 +21,8 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
|
|
|
21
21
|
isDisabled,
|
|
22
22
|
isSelected,
|
|
23
23
|
icon,
|
|
24
|
-
children,
|
|
25
24
|
interactionName,
|
|
25
|
+
label,
|
|
26
26
|
overlay,
|
|
27
27
|
onClick,
|
|
28
28
|
onMouseDownCapture,
|
|
@@ -36,6 +36,7 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
|
|
|
36
36
|
onClickCapture,
|
|
37
37
|
type = 'button',
|
|
38
38
|
testId,
|
|
39
|
+
UNSAFE_size,
|
|
39
40
|
...rest
|
|
40
41
|
}, ref) {
|
|
41
42
|
/**
|
|
@@ -47,11 +48,13 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
|
|
|
47
48
|
appearance,
|
|
48
49
|
autoFocus,
|
|
49
50
|
buttonType: 'button',
|
|
50
|
-
children,
|
|
51
|
+
children: null,
|
|
52
|
+
// Set in hook.
|
|
51
53
|
icon,
|
|
52
54
|
interactionName,
|
|
53
55
|
isDisabled,
|
|
54
56
|
isSelected,
|
|
57
|
+
label,
|
|
55
58
|
onClick,
|
|
56
59
|
onMouseDownCapture,
|
|
57
60
|
onMouseUpCapture,
|
|
@@ -64,7 +67,8 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
|
|
|
64
67
|
onClickCapture,
|
|
65
68
|
overlay,
|
|
66
69
|
ref,
|
|
67
|
-
spacing
|
|
70
|
+
spacing,
|
|
71
|
+
UNSAFE_size
|
|
68
72
|
});
|
|
69
73
|
return /*#__PURE__*/React.createElement(UNSAFE_PRESSABLE, _extends({}, rest, {
|
|
70
74
|
ref: baseProps.ref,
|
|
@@ -10,8 +10,8 @@ const LinkIconButtonBase = ({
|
|
|
10
10
|
isDisabled,
|
|
11
11
|
isSelected,
|
|
12
12
|
icon,
|
|
13
|
-
children,
|
|
14
13
|
interactionName,
|
|
14
|
+
label,
|
|
15
15
|
overlay,
|
|
16
16
|
onClick,
|
|
17
17
|
onMouseDownCapture,
|
|
@@ -32,11 +32,13 @@ const LinkIconButtonBase = ({
|
|
|
32
32
|
appearance,
|
|
33
33
|
autoFocus,
|
|
34
34
|
buttonType: 'link',
|
|
35
|
-
children,
|
|
35
|
+
children: null,
|
|
36
|
+
// Set in hook.
|
|
36
37
|
icon,
|
|
37
38
|
interactionName,
|
|
38
39
|
isDisabled,
|
|
39
40
|
isSelected,
|
|
41
|
+
label,
|
|
40
42
|
onClick,
|
|
41
43
|
onMouseDownCapture,
|
|
42
44
|
onMouseUpCapture,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
2
3
|
import Content from '../shared/content';
|
|
3
4
|
import useButtonBase from '../shared/use-button-base';
|
|
4
5
|
/**
|
|
@@ -15,12 +16,11 @@ const useIconButton = ({
|
|
|
15
16
|
appearance,
|
|
16
17
|
autoFocus,
|
|
17
18
|
buttonType,
|
|
18
|
-
icon,
|
|
19
|
+
icon: Icon,
|
|
19
20
|
interactionName,
|
|
20
21
|
isDisabled,
|
|
21
22
|
isSelected,
|
|
22
|
-
|
|
23
|
-
// children,
|
|
23
|
+
label,
|
|
24
24
|
onClick,
|
|
25
25
|
onMouseDownCapture,
|
|
26
26
|
onMouseUpCapture,
|
|
@@ -34,7 +34,8 @@ const useIconButton = ({
|
|
|
34
34
|
overlay,
|
|
35
35
|
ref,
|
|
36
36
|
shouldFitContainer,
|
|
37
|
-
spacing
|
|
37
|
+
spacing,
|
|
38
|
+
UNSAFE_size
|
|
38
39
|
}) => {
|
|
39
40
|
const hasOverlay = Boolean(overlay);
|
|
40
41
|
const baseProps = useButtonBase({
|
|
@@ -49,7 +50,10 @@ const useIconButton = ({
|
|
|
49
50
|
children: /*#__PURE__*/React.createElement(Content, {
|
|
50
51
|
type: "icon",
|
|
51
52
|
hasOverlay: hasOverlay
|
|
52
|
-
},
|
|
53
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
54
|
+
label: "",
|
|
55
|
+
size: UNSAFE_size
|
|
56
|
+
}), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)),
|
|
53
57
|
interactionName,
|
|
54
58
|
isDisabled,
|
|
55
59
|
isSelected,
|
|
@@ -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.2",
|
|
107
107
|
analyticsData: analyticsContext
|
|
108
108
|
});
|
|
109
109
|
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
|
-
|
|
4
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
|
-
import AddIcon from '@atlaskit/icon/glyph/add';
|
|
6
3
|
import Button from '../new-button/variants/default/button';
|
|
7
4
|
import LinkButton from '../new-button/variants/default/link';
|
|
8
|
-
|
|
9
|
-
// IconButtonProps,
|
|
10
|
-
// } from '../new-button/variants/icon/button';
|
|
11
|
-
import LinkIconButton from '../new-button/variants/icon/link';
|
|
12
|
-
import { buttonAppearances, linkButtonAppearances } from '../utils/appearances';
|
|
5
|
+
import { buttonAppearances, linkButtonAppearances } from './appearances';
|
|
13
6
|
// Add required default props to variants
|
|
14
7
|
const LinkButtonRender = /*#__PURE__*/forwardRef(({
|
|
15
8
|
href = 'home',
|
|
@@ -19,48 +12,11 @@ const LinkButtonRender = /*#__PURE__*/forwardRef(({
|
|
|
19
12
|
ref: ref,
|
|
20
13
|
href: href
|
|
21
14
|
}, rest), children));
|
|
22
|
-
|
|
23
|
-
// TODO: Enable icon button in tests once it's ready
|
|
24
|
-
// const IconButtonRender = forwardRef(
|
|
25
|
-
// (
|
|
26
|
-
// {
|
|
27
|
-
// children,
|
|
28
|
-
// icon = <AddIcon label="" />,
|
|
29
|
-
// ...rest
|
|
30
|
-
// }: Omit<IconButtonProps, 'icon'> & {
|
|
31
|
-
// icon?: IconButtonProps['icon'];
|
|
32
|
-
// },
|
|
33
|
-
// ref: React.Ref<HTMLButtonElement>,
|
|
34
|
-
// ) => (
|
|
35
|
-
// <IconButton ref={ref} icon={icon} {...rest}>
|
|
36
|
-
// {children}
|
|
37
|
-
// </IconButton>
|
|
38
|
-
// ),
|
|
39
|
-
// );
|
|
40
|
-
|
|
41
|
-
const LinkIconButtonRender = /*#__PURE__*/forwardRef(({
|
|
42
|
-
href = '/home',
|
|
43
|
-
children,
|
|
44
|
-
icon = /*#__PURE__*/React.createElement(AddIcon, {
|
|
45
|
-
label: ""
|
|
46
|
-
}),
|
|
47
|
-
...rest
|
|
48
|
-
}, ref) => /*#__PURE__*/React.createElement(LinkIconButton, _extends({
|
|
49
|
-
ref: ref,
|
|
50
|
-
icon: icon,
|
|
51
|
-
href: href
|
|
52
|
-
}, rest), children));
|
|
53
15
|
export const linkButtonVariants = [{
|
|
54
16
|
name: 'LinkButton',
|
|
55
17
|
Component: LinkButtonRender,
|
|
56
18
|
elementType: HTMLAnchorElement,
|
|
57
19
|
appearances: linkButtonAppearances
|
|
58
|
-
}, {
|
|
59
|
-
name: 'LinkIconButton',
|
|
60
|
-
Component: LinkIconButtonRender,
|
|
61
|
-
elementType: HTMLAnchorElement,
|
|
62
|
-
// TODO: Make specific to icon button
|
|
63
|
-
appearances: linkButtonAppearances
|
|
64
20
|
}];
|
|
65
21
|
const variants = [{
|
|
66
22
|
name: 'Button',
|
|
@@ -72,18 +28,5 @@ const variants = [{
|
|
|
72
28
|
Component: LinkButtonRender,
|
|
73
29
|
elementType: HTMLAnchorElement,
|
|
74
30
|
appearances: linkButtonAppearances
|
|
75
|
-
}
|
|
76
|
-
// TODO: Enable icon buttons in tests once it's ready
|
|
77
|
-
// {
|
|
78
|
-
// name: 'IconButton',
|
|
79
|
-
// Component: IconButtonRender,
|
|
80
|
-
// elementType: HTMLButtonElement,
|
|
81
|
-
// },
|
|
82
|
-
// {
|
|
83
|
-
// name: 'LinkIconButton',
|
|
84
|
-
// Component: LinkIconButtonRender,
|
|
85
|
-
// elementType: HTMLAnchorElement,
|
|
86
|
-
// },
|
|
87
|
-
];
|
|
88
|
-
|
|
31
|
+
}];
|
|
89
32
|
export default variants;
|