@atlaskit/button 16.17.8 → 16.17.10
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 +26 -5
- package/dist/cjs/new-button/variants/icon/button.js +3 -3
- package/dist/cjs/new-button/variants/icon/link.js +3 -3
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +3 -0
- package/dist/cjs/new-button/variants/shared/use-button-base.js +5 -2
- package/dist/cjs/new-button/variants/shared/xcss.js +2 -9
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/containers/split-button/split-button.js +26 -5
- package/dist/es2019/new-button/variants/icon/button.js +2 -2
- package/dist/es2019/new-button/variants/icon/link.js +2 -2
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +3 -0
- package/dist/es2019/new-button/variants/shared/use-button-base.js +4 -2
- package/dist/es2019/new-button/variants/shared/xcss.js +2 -9
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/containers/split-button/split-button.js +26 -5
- package/dist/esm/new-button/variants/icon/button.js +3 -3
- package/dist/esm/new-button/variants/icon/link.js +3 -3
- package/dist/esm/new-button/variants/icon/use-icon-button.js +3 -0
- package/dist/esm/new-button/variants/shared/use-button-base.js +5 -2
- package/dist/esm/new-button/variants/shared/xcss.js +2 -9
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types/new-button/variants/icon/types.d.ts +4 -0
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +2 -2
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +2 -1
- package/dist/types/new-button/variants/shared/xcss.d.ts +2 -1
- 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 +4 -0
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +2 -2
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +2 -1
- package/dist/types-ts4.5/new-button/variants/shared/xcss.d.ts +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 16.17.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#55666](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/55666) [`7be116fed51b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7be116fed51b) - Add support for shape to IconButton
|
|
8
|
+
|
|
9
|
+
## 16.17.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#57808](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/57808) [`b99d50f91202`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b99d50f91202) - Internal changes to styling on SplitButton (closed beta) to fix issues with border radius when wrapper elements are used.
|
|
14
|
+
|
|
3
15
|
## 16.17.8
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -68,7 +68,20 @@ var splitButtonStyles = (0, _react.css)({
|
|
|
68
68
|
alignItems: 'center',
|
|
69
69
|
whiteSpace: 'nowrap'
|
|
70
70
|
});
|
|
71
|
-
|
|
71
|
+
var primaryButtonStyles = (0, _react.css)({
|
|
72
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
73
|
+
'button,a': {
|
|
74
|
+
borderEndEndRadius: 0,
|
|
75
|
+
borderStartEndRadius: 0
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
var secondaryButtonStyles = (0, _react.css)({
|
|
79
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
80
|
+
'button,a': {
|
|
81
|
+
borderEndStartRadius: 0,
|
|
82
|
+
borderStartStartRadius: 0
|
|
83
|
+
}
|
|
84
|
+
});
|
|
72
85
|
/**
|
|
73
86
|
* TODO: Add JSdoc
|
|
74
87
|
*/
|
|
@@ -107,11 +120,15 @@ var SplitButton = exports.SplitButton = function SplitButton(_ref3) {
|
|
|
107
120
|
spacing: spacing,
|
|
108
121
|
isDisabled: isDisabled
|
|
109
122
|
}
|
|
110
|
-
},
|
|
123
|
+
}, (0, _react.jsx)("div", {
|
|
124
|
+
css: primaryButtonStyles
|
|
125
|
+
}, PrimaryAction), (0, _react.jsx)(Divider, {
|
|
111
126
|
appearance: appearance,
|
|
112
127
|
spacing: spacing,
|
|
113
128
|
isDisabled: isDisabled
|
|
114
|
-
}),
|
|
129
|
+
}), (0, _react.jsx)("div", {
|
|
130
|
+
css: secondaryButtonStyles
|
|
131
|
+
}, SecondaryAction)));
|
|
115
132
|
};
|
|
116
133
|
/**
|
|
117
134
|
* TODO: Decide on API
|
|
@@ -131,9 +148,13 @@ var SplitButtonWithSlots = exports.SplitButtonWithSlots = function SplitButtonWi
|
|
|
131
148
|
spacing: spacing,
|
|
132
149
|
isDisabled: isDisabled
|
|
133
150
|
}
|
|
134
|
-
},
|
|
151
|
+
}, (0, _react.jsx)("div", {
|
|
152
|
+
css: primaryButtonStyles
|
|
153
|
+
}, primaryAction), (0, _react.jsx)(Divider, {
|
|
135
154
|
appearance: appearance,
|
|
136
155
|
spacing: spacing,
|
|
137
156
|
isDisabled: isDisabled
|
|
138
|
-
}),
|
|
157
|
+
}), (0, _react.jsx)("div", {
|
|
158
|
+
css: secondaryButtonStyles
|
|
159
|
+
}, secondaryAction)));
|
|
139
160
|
};
|
|
@@ -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", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "type", "testId", "UNSAFE_size"];
|
|
13
|
+
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "type", "testId", "UNSAFE_size"];
|
|
14
14
|
/**
|
|
15
15
|
* __Icon Button__
|
|
16
16
|
*
|
|
@@ -43,6 +43,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
43
43
|
onPointerDownCapture = _ref.onPointerDownCapture,
|
|
44
44
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
45
45
|
onClickCapture = _ref.onClickCapture,
|
|
46
|
+
shape = _ref.shape,
|
|
46
47
|
_ref$type = _ref.type,
|
|
47
48
|
type = _ref$type === void 0 ? 'button' : _ref$type,
|
|
48
49
|
testId = _ref.testId,
|
|
@@ -57,8 +58,6 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
57
58
|
appearance: appearance,
|
|
58
59
|
autoFocus: autoFocus,
|
|
59
60
|
buttonType: 'button',
|
|
60
|
-
children: null,
|
|
61
|
-
// Set in hook.
|
|
62
61
|
icon: icon,
|
|
63
62
|
interactionName: interactionName,
|
|
64
63
|
isDisabled: isDisabled,
|
|
@@ -76,6 +75,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
76
75
|
onClickCapture: onClickCapture,
|
|
77
76
|
overlay: overlay,
|
|
78
77
|
ref: ref,
|
|
78
|
+
shape: shape,
|
|
79
79
|
spacing: spacing,
|
|
80
80
|
UNSAFE_size: UNSAFE_size
|
|
81
81
|
});
|
|
@@ -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", "UNSAFE_size", "href"];
|
|
14
|
+
var _excluded = ["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"];
|
|
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) {
|
|
@@ -35,6 +35,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
35
35
|
onPointerDownCapture = _ref.onPointerDownCapture,
|
|
36
36
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
37
37
|
onClickCapture = _ref.onClickCapture,
|
|
38
|
+
shape = _ref.shape,
|
|
38
39
|
testId = _ref.testId,
|
|
39
40
|
UNSAFE_size = _ref.UNSAFE_size,
|
|
40
41
|
href = _ref.href,
|
|
@@ -44,8 +45,6 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
44
45
|
appearance: appearance,
|
|
45
46
|
autoFocus: autoFocus,
|
|
46
47
|
buttonType: 'link',
|
|
47
|
-
children: null,
|
|
48
|
-
// Set in hook.
|
|
49
48
|
icon: icon,
|
|
50
49
|
interactionName: interactionName,
|
|
51
50
|
isDisabled: isDisabled,
|
|
@@ -63,6 +62,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
63
62
|
onClickCapture: onClickCapture,
|
|
64
63
|
overlay: overlay,
|
|
65
64
|
ref: ref,
|
|
65
|
+
shape: shape,
|
|
66
66
|
spacing: spacing,
|
|
67
67
|
UNSAFE_size: UNSAFE_size
|
|
68
68
|
});
|
|
@@ -40,10 +40,12 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
40
40
|
onClickCapture = _ref.onClickCapture,
|
|
41
41
|
overlay = _ref.overlay,
|
|
42
42
|
ref = _ref.ref,
|
|
43
|
+
shape = _ref.shape,
|
|
43
44
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
44
45
|
spacing = _ref.spacing,
|
|
45
46
|
UNSAFE_size = _ref.UNSAFE_size;
|
|
46
47
|
var hasOverlay = Boolean(overlay);
|
|
48
|
+
var isCircle = shape === 'circle';
|
|
47
49
|
var baseProps = (0, _useButtonBase.default)({
|
|
48
50
|
analyticsContext: analyticsContext,
|
|
49
51
|
appearance: appearance,
|
|
@@ -60,6 +62,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
60
62
|
isDisabled: isDisabled,
|
|
61
63
|
isSelected: isSelected,
|
|
62
64
|
isIconButton: true,
|
|
65
|
+
isCircle: isCircle,
|
|
63
66
|
onClick: onClick,
|
|
64
67
|
onMouseDownCapture: onMouseDownCapture,
|
|
65
68
|
onMouseUpCapture: onMouseUpCapture,
|
|
@@ -60,6 +60,8 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
60
60
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
61
61
|
_ref$isIconButton = _ref.isIconButton,
|
|
62
62
|
isIconButton = _ref$isIconButton === void 0 ? false : _ref$isIconButton,
|
|
63
|
+
_ref$isCircle = _ref.isCircle,
|
|
64
|
+
isCircle = _ref$isCircle === void 0 ? false : _ref$isCircle,
|
|
63
65
|
_ref$hasIconBefore = _ref.hasIconBefore,
|
|
64
66
|
hasIconBefore = _ref$hasIconBefore === void 0 ? false : _ref$hasIconBefore,
|
|
65
67
|
_ref$hasIconAfter = _ref.hasIconAfter,
|
|
@@ -115,7 +117,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
115
117
|
action: 'clicked',
|
|
116
118
|
componentName: 'button',
|
|
117
119
|
packageName: "@atlaskit/button",
|
|
118
|
-
packageVersion: "16.17.
|
|
120
|
+
packageVersion: "16.17.10",
|
|
119
121
|
analyticsData: analyticsContext,
|
|
120
122
|
actionSubject: buttonType
|
|
121
123
|
});
|
|
@@ -129,6 +131,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
129
131
|
isActiveOverSelected: isActiveOverSelected,
|
|
130
132
|
shouldFitContainer: shouldFitContainer,
|
|
131
133
|
isIconButton: isIconButton,
|
|
134
|
+
isCircle: isCircle,
|
|
132
135
|
hasOverlay: Boolean(overlay),
|
|
133
136
|
isLink: buttonType === 'link',
|
|
134
137
|
hasIconBefore: hasIconBefore,
|
|
@@ -136,7 +139,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
136
139
|
isSplit: isSplitButton,
|
|
137
140
|
isNavigationSplit: isNavigationSplitButton
|
|
138
141
|
});
|
|
139
|
-
}, [appearance, buttonType, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
142
|
+
}, [appearance, buttonType, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
140
143
|
var isEffectivelyDisabled = isDisabled || Boolean(overlay);
|
|
141
144
|
return _objectSpread({
|
|
142
145
|
ref: setRef,
|
|
@@ -48,14 +48,6 @@ var verticalAlign = {
|
|
|
48
48
|
none: 'baseline'
|
|
49
49
|
};
|
|
50
50
|
var splitBorderStyles = {
|
|
51
|
-
':first-of-type': {
|
|
52
|
-
borderTopRightRadius: 0,
|
|
53
|
-
borderBottomRightRadius: 0
|
|
54
|
-
},
|
|
55
|
-
':last-of-type': {
|
|
56
|
-
borderTopLeftRadius: 0,
|
|
57
|
-
borderBottomLeftRadius: 0
|
|
58
|
-
},
|
|
59
51
|
':focus-visible': {
|
|
60
52
|
zIndex: 1
|
|
61
53
|
}
|
|
@@ -99,6 +91,7 @@ function getXCSS(_ref3) {
|
|
|
99
91
|
isHighlighted = _ref3.isHighlighted,
|
|
100
92
|
isActiveOverSelected = _ref3.isActiveOverSelected,
|
|
101
93
|
isIconButton = _ref3.isIconButton,
|
|
94
|
+
isCircle = _ref3.isCircle,
|
|
102
95
|
shouldFitContainer = _ref3.shouldFitContainer,
|
|
103
96
|
isLink = _ref3.isLink,
|
|
104
97
|
isSplit = _ref3.isSplit,
|
|
@@ -144,7 +137,7 @@ function getXCSS(_ref3) {
|
|
|
144
137
|
return (0, _primitives.xcss)(_objectSpread(_objectSpread(_objectSpread({
|
|
145
138
|
alignItems: 'baseline',
|
|
146
139
|
borderWidth: 'border.width.0',
|
|
147
|
-
borderRadius: 'border.radius.100',
|
|
140
|
+
borderRadius: isCircle && !isSplit ? 'border.radius.circle' : 'border.radius.100',
|
|
148
141
|
boxSizing: 'border-box',
|
|
149
142
|
display: 'inline-flex',
|
|
150
143
|
fontSize: 'inherit',
|
|
@@ -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.10",
|
|
122
122
|
analyticsData: analyticsContext
|
|
123
123
|
});
|
|
124
124
|
|
|
@@ -62,7 +62,20 @@ const splitButtonStyles = css({
|
|
|
62
62
|
alignItems: 'center',
|
|
63
63
|
whiteSpace: 'nowrap'
|
|
64
64
|
});
|
|
65
|
-
|
|
65
|
+
const primaryButtonStyles = css({
|
|
66
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
67
|
+
'button,a': {
|
|
68
|
+
borderEndEndRadius: 0,
|
|
69
|
+
borderStartEndRadius: 0
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const secondaryButtonStyles = css({
|
|
73
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
74
|
+
'button,a': {
|
|
75
|
+
borderEndStartRadius: 0,
|
|
76
|
+
borderStartStartRadius: 0
|
|
77
|
+
}
|
|
78
|
+
});
|
|
66
79
|
/**
|
|
67
80
|
* TODO: Add JSdoc
|
|
68
81
|
*/
|
|
@@ -101,11 +114,15 @@ export const SplitButton = ({
|
|
|
101
114
|
spacing,
|
|
102
115
|
isDisabled
|
|
103
116
|
}
|
|
104
|
-
},
|
|
117
|
+
}, jsx("div", {
|
|
118
|
+
css: primaryButtonStyles
|
|
119
|
+
}, PrimaryAction), jsx(Divider, {
|
|
105
120
|
appearance: appearance,
|
|
106
121
|
spacing: spacing,
|
|
107
122
|
isDisabled: isDisabled
|
|
108
|
-
}),
|
|
123
|
+
}), jsx("div", {
|
|
124
|
+
css: secondaryButtonStyles
|
|
125
|
+
}, SecondaryAction)));
|
|
109
126
|
};
|
|
110
127
|
/**
|
|
111
128
|
* TODO: Decide on API
|
|
@@ -123,9 +140,13 @@ export const SplitButtonWithSlots = ({
|
|
|
123
140
|
spacing,
|
|
124
141
|
isDisabled
|
|
125
142
|
}
|
|
126
|
-
},
|
|
143
|
+
}, jsx("div", {
|
|
144
|
+
css: primaryButtonStyles
|
|
145
|
+
}, primaryAction), jsx(Divider, {
|
|
127
146
|
appearance: appearance,
|
|
128
147
|
spacing: spacing,
|
|
129
148
|
isDisabled: isDisabled
|
|
130
|
-
}),
|
|
149
|
+
}), jsx("div", {
|
|
150
|
+
css: secondaryButtonStyles
|
|
151
|
+
}, secondaryAction)));
|
|
131
152
|
};
|
|
@@ -34,6 +34,7 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
|
|
|
34
34
|
onPointerDownCapture,
|
|
35
35
|
onPointerUpCapture,
|
|
36
36
|
onClickCapture,
|
|
37
|
+
shape,
|
|
37
38
|
type = 'button',
|
|
38
39
|
testId,
|
|
39
40
|
UNSAFE_size,
|
|
@@ -48,8 +49,6 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
|
|
|
48
49
|
appearance,
|
|
49
50
|
autoFocus,
|
|
50
51
|
buttonType: 'button',
|
|
51
|
-
children: null,
|
|
52
|
-
// Set in hook.
|
|
53
52
|
icon,
|
|
54
53
|
interactionName,
|
|
55
54
|
isDisabled,
|
|
@@ -67,6 +66,7 @@ const IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(functi
|
|
|
67
66
|
onClickCapture,
|
|
68
67
|
overlay,
|
|
69
68
|
ref,
|
|
69
|
+
shape,
|
|
70
70
|
spacing,
|
|
71
71
|
UNSAFE_size
|
|
72
72
|
});
|
|
@@ -23,6 +23,7 @@ const LinkIconButtonBase = ({
|
|
|
23
23
|
onPointerDownCapture,
|
|
24
24
|
onPointerUpCapture,
|
|
25
25
|
onClickCapture,
|
|
26
|
+
shape,
|
|
26
27
|
testId,
|
|
27
28
|
UNSAFE_size,
|
|
28
29
|
href,
|
|
@@ -33,8 +34,6 @@ const LinkIconButtonBase = ({
|
|
|
33
34
|
appearance,
|
|
34
35
|
autoFocus,
|
|
35
36
|
buttonType: 'link',
|
|
36
|
-
children: null,
|
|
37
|
-
// Set in hook.
|
|
38
37
|
icon,
|
|
39
38
|
interactionName,
|
|
40
39
|
isDisabled,
|
|
@@ -52,6 +51,7 @@ const LinkIconButtonBase = ({
|
|
|
52
51
|
onClickCapture,
|
|
53
52
|
overlay,
|
|
54
53
|
ref,
|
|
54
|
+
shape,
|
|
55
55
|
spacing,
|
|
56
56
|
UNSAFE_size
|
|
57
57
|
});
|
|
@@ -33,11 +33,13 @@ const useIconButton = ({
|
|
|
33
33
|
onClickCapture,
|
|
34
34
|
overlay,
|
|
35
35
|
ref,
|
|
36
|
+
shape,
|
|
36
37
|
shouldFitContainer,
|
|
37
38
|
spacing,
|
|
38
39
|
UNSAFE_size
|
|
39
40
|
}) => {
|
|
40
41
|
const hasOverlay = Boolean(overlay);
|
|
42
|
+
const isCircle = shape === 'circle';
|
|
41
43
|
const baseProps = useButtonBase({
|
|
42
44
|
analyticsContext,
|
|
43
45
|
appearance,
|
|
@@ -54,6 +56,7 @@ const useIconButton = ({
|
|
|
54
56
|
isDisabled,
|
|
55
57
|
isSelected,
|
|
56
58
|
isIconButton: true,
|
|
59
|
+
isCircle,
|
|
57
60
|
onClick,
|
|
58
61
|
onMouseDownCapture,
|
|
59
62
|
onMouseUpCapture,
|
|
@@ -45,6 +45,7 @@ const useButtonBase = ({
|
|
|
45
45
|
isSelected = false,
|
|
46
46
|
// TODO: Separate Icon Button styling from button base
|
|
47
47
|
isIconButton = false,
|
|
48
|
+
isCircle = false,
|
|
48
49
|
// TODO: Separate icon slot styling from button base
|
|
49
50
|
hasIconBefore = false,
|
|
50
51
|
hasIconAfter = false,
|
|
@@ -97,7 +98,7 @@ const useButtonBase = ({
|
|
|
97
98
|
action: 'clicked',
|
|
98
99
|
componentName: 'button',
|
|
99
100
|
packageName: "@atlaskit/button",
|
|
100
|
-
packageVersion: "16.17.
|
|
101
|
+
packageVersion: "16.17.10",
|
|
101
102
|
analyticsData: analyticsContext,
|
|
102
103
|
actionSubject: buttonType
|
|
103
104
|
});
|
|
@@ -110,13 +111,14 @@ const useButtonBase = ({
|
|
|
110
111
|
isActiveOverSelected,
|
|
111
112
|
shouldFitContainer,
|
|
112
113
|
isIconButton,
|
|
114
|
+
isCircle,
|
|
113
115
|
hasOverlay: Boolean(overlay),
|
|
114
116
|
isLink: buttonType === 'link',
|
|
115
117
|
hasIconBefore,
|
|
116
118
|
hasIconAfter,
|
|
117
119
|
isSplit: isSplitButton,
|
|
118
120
|
isNavigationSplit: isNavigationSplitButton
|
|
119
|
-
}), [appearance, buttonType, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
121
|
+
}), [appearance, buttonType, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
120
122
|
const isEffectivelyDisabled = isDisabled || Boolean(overlay);
|
|
121
123
|
return {
|
|
122
124
|
ref: setRef,
|
|
@@ -37,14 +37,6 @@ const verticalAlign = {
|
|
|
37
37
|
none: 'baseline'
|
|
38
38
|
};
|
|
39
39
|
const splitBorderStyles = {
|
|
40
|
-
':first-of-type': {
|
|
41
|
-
borderTopRightRadius: 0,
|
|
42
|
-
borderBottomRightRadius: 0
|
|
43
|
-
},
|
|
44
|
-
':last-of-type': {
|
|
45
|
-
borderTopLeftRadius: 0,
|
|
46
|
-
borderBottomLeftRadius: 0
|
|
47
|
-
},
|
|
48
40
|
':focus-visible': {
|
|
49
41
|
zIndex: 1
|
|
50
42
|
}
|
|
@@ -89,6 +81,7 @@ export function getXCSS({
|
|
|
89
81
|
isHighlighted,
|
|
90
82
|
isActiveOverSelected,
|
|
91
83
|
isIconButton,
|
|
84
|
+
isCircle,
|
|
92
85
|
shouldFitContainer,
|
|
93
86
|
isLink,
|
|
94
87
|
isSplit,
|
|
@@ -138,7 +131,7 @@ export function getXCSS({
|
|
|
138
131
|
return xcss({
|
|
139
132
|
alignItems: 'baseline',
|
|
140
133
|
borderWidth: 'border.width.0',
|
|
141
|
-
borderRadius: 'border.radius.100',
|
|
134
|
+
borderRadius: isCircle && !isSplit ? 'border.radius.circle' : 'border.radius.100',
|
|
142
135
|
boxSizing: 'border-box',
|
|
143
136
|
display: 'inline-flex',
|
|
144
137
|
fontSize: 'inherit',
|
|
@@ -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.10",
|
|
107
107
|
analyticsData: analyticsContext
|
|
108
108
|
});
|
|
109
109
|
|
|
@@ -62,7 +62,20 @@ var splitButtonStyles = css({
|
|
|
62
62
|
alignItems: 'center',
|
|
63
63
|
whiteSpace: 'nowrap'
|
|
64
64
|
});
|
|
65
|
-
|
|
65
|
+
var primaryButtonStyles = css({
|
|
66
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
67
|
+
'button,a': {
|
|
68
|
+
borderEndEndRadius: 0,
|
|
69
|
+
borderStartEndRadius: 0
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
var secondaryButtonStyles = css({
|
|
73
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
74
|
+
'button,a': {
|
|
75
|
+
borderEndStartRadius: 0,
|
|
76
|
+
borderStartStartRadius: 0
|
|
77
|
+
}
|
|
78
|
+
});
|
|
66
79
|
/**
|
|
67
80
|
* TODO: Add JSdoc
|
|
68
81
|
*/
|
|
@@ -101,11 +114,15 @@ export var SplitButton = function SplitButton(_ref3) {
|
|
|
101
114
|
spacing: spacing,
|
|
102
115
|
isDisabled: isDisabled
|
|
103
116
|
}
|
|
104
|
-
},
|
|
117
|
+
}, jsx("div", {
|
|
118
|
+
css: primaryButtonStyles
|
|
119
|
+
}, PrimaryAction), jsx(Divider, {
|
|
105
120
|
appearance: appearance,
|
|
106
121
|
spacing: spacing,
|
|
107
122
|
isDisabled: isDisabled
|
|
108
|
-
}),
|
|
123
|
+
}), jsx("div", {
|
|
124
|
+
css: secondaryButtonStyles
|
|
125
|
+
}, SecondaryAction)));
|
|
109
126
|
};
|
|
110
127
|
/**
|
|
111
128
|
* TODO: Decide on API
|
|
@@ -125,9 +142,13 @@ export var SplitButtonWithSlots = function SplitButtonWithSlots(_ref4) {
|
|
|
125
142
|
spacing: spacing,
|
|
126
143
|
isDisabled: isDisabled
|
|
127
144
|
}
|
|
128
|
-
},
|
|
145
|
+
}, jsx("div", {
|
|
146
|
+
css: primaryButtonStyles
|
|
147
|
+
}, primaryAction), jsx(Divider, {
|
|
129
148
|
appearance: appearance,
|
|
130
149
|
spacing: spacing,
|
|
131
150
|
isDisabled: isDisabled
|
|
132
|
-
}),
|
|
151
|
+
}), jsx("div", {
|
|
152
|
+
css: secondaryButtonStyles
|
|
153
|
+
}, secondaryAction)));
|
|
133
154
|
};
|
|
@@ -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", "type", "testId", "UNSAFE_size"];
|
|
3
|
+
var _excluded = ["analyticsContext", "autoFocus", "appearance", "spacing", "isDisabled", "isSelected", "icon", "interactionName", "label", "overlay", "onClick", "onMouseDownCapture", "onMouseUpCapture", "onKeyDownCapture", "onKeyUpCapture", "onTouchStartCapture", "onTouchEndCapture", "onPointerDownCapture", "onPointerUpCapture", "onClickCapture", "shape", "type", "testId", "UNSAFE_size"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import UNSAFE_PRESSABLE from '@atlaskit/primitives/pressable';
|
|
6
6
|
import useIconButton from './use-icon-button';
|
|
@@ -36,6 +36,7 @@ var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
36
36
|
onPointerDownCapture = _ref.onPointerDownCapture,
|
|
37
37
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
38
38
|
onClickCapture = _ref.onClickCapture,
|
|
39
|
+
shape = _ref.shape,
|
|
39
40
|
_ref$type = _ref.type,
|
|
40
41
|
type = _ref$type === void 0 ? 'button' : _ref$type,
|
|
41
42
|
testId = _ref.testId,
|
|
@@ -50,8 +51,6 @@ var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
50
51
|
appearance: appearance,
|
|
51
52
|
autoFocus: autoFocus,
|
|
52
53
|
buttonType: 'button',
|
|
53
|
-
children: null,
|
|
54
|
-
// Set in hook.
|
|
55
54
|
icon: icon,
|
|
56
55
|
interactionName: interactionName,
|
|
57
56
|
isDisabled: isDisabled,
|
|
@@ -69,6 +68,7 @@ var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
69
68
|
onClickCapture: onClickCapture,
|
|
70
69
|
overlay: overlay,
|
|
71
70
|
ref: ref,
|
|
71
|
+
shape: shape,
|
|
72
72
|
spacing: spacing,
|
|
73
73
|
UNSAFE_size: UNSAFE_size
|
|
74
74
|
});
|
|
@@ -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", "UNSAFE_size", "href"];
|
|
3
|
+
var _excluded = ["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"];
|
|
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';
|
|
@@ -25,6 +25,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
25
25
|
onPointerDownCapture = _ref.onPointerDownCapture,
|
|
26
26
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
27
27
|
onClickCapture = _ref.onClickCapture,
|
|
28
|
+
shape = _ref.shape,
|
|
28
29
|
testId = _ref.testId,
|
|
29
30
|
UNSAFE_size = _ref.UNSAFE_size,
|
|
30
31
|
href = _ref.href,
|
|
@@ -34,8 +35,6 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
34
35
|
appearance: appearance,
|
|
35
36
|
autoFocus: autoFocus,
|
|
36
37
|
buttonType: 'link',
|
|
37
|
-
children: null,
|
|
38
|
-
// Set in hook.
|
|
39
38
|
icon: icon,
|
|
40
39
|
interactionName: interactionName,
|
|
41
40
|
isDisabled: isDisabled,
|
|
@@ -53,6 +52,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
53
52
|
onClickCapture: onClickCapture,
|
|
54
53
|
overlay: overlay,
|
|
55
54
|
ref: ref,
|
|
55
|
+
shape: shape,
|
|
56
56
|
spacing: spacing,
|
|
57
57
|
UNSAFE_size: UNSAFE_size
|
|
58
58
|
});
|
|
@@ -33,10 +33,12 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
33
33
|
onClickCapture = _ref.onClickCapture,
|
|
34
34
|
overlay = _ref.overlay,
|
|
35
35
|
ref = _ref.ref,
|
|
36
|
+
shape = _ref.shape,
|
|
36
37
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
37
38
|
spacing = _ref.spacing,
|
|
38
39
|
UNSAFE_size = _ref.UNSAFE_size;
|
|
39
40
|
var hasOverlay = Boolean(overlay);
|
|
41
|
+
var isCircle = shape === 'circle';
|
|
40
42
|
var baseProps = useButtonBase({
|
|
41
43
|
analyticsContext: analyticsContext,
|
|
42
44
|
appearance: appearance,
|
|
@@ -53,6 +55,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
53
55
|
isDisabled: isDisabled,
|
|
54
56
|
isSelected: isSelected,
|
|
55
57
|
isIconButton: true,
|
|
58
|
+
isCircle: isCircle,
|
|
56
59
|
onClick: onClick,
|
|
57
60
|
onMouseDownCapture: onMouseDownCapture,
|
|
58
61
|
onMouseUpCapture: onMouseUpCapture,
|
|
@@ -52,6 +52,8 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
52
52
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
53
53
|
_ref$isIconButton = _ref.isIconButton,
|
|
54
54
|
isIconButton = _ref$isIconButton === void 0 ? false : _ref$isIconButton,
|
|
55
|
+
_ref$isCircle = _ref.isCircle,
|
|
56
|
+
isCircle = _ref$isCircle === void 0 ? false : _ref$isCircle,
|
|
55
57
|
_ref$hasIconBefore = _ref.hasIconBefore,
|
|
56
58
|
hasIconBefore = _ref$hasIconBefore === void 0 ? false : _ref$hasIconBefore,
|
|
57
59
|
_ref$hasIconAfter = _ref.hasIconAfter,
|
|
@@ -107,7 +109,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
107
109
|
action: 'clicked',
|
|
108
110
|
componentName: 'button',
|
|
109
111
|
packageName: "@atlaskit/button",
|
|
110
|
-
packageVersion: "16.17.
|
|
112
|
+
packageVersion: "16.17.10",
|
|
111
113
|
analyticsData: analyticsContext,
|
|
112
114
|
actionSubject: buttonType
|
|
113
115
|
});
|
|
@@ -121,6 +123,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
121
123
|
isActiveOverSelected: isActiveOverSelected,
|
|
122
124
|
shouldFitContainer: shouldFitContainer,
|
|
123
125
|
isIconButton: isIconButton,
|
|
126
|
+
isCircle: isCircle,
|
|
124
127
|
hasOverlay: Boolean(overlay),
|
|
125
128
|
isLink: buttonType === 'link',
|
|
126
129
|
hasIconBefore: hasIconBefore,
|
|
@@ -128,7 +131,7 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
128
131
|
isSplit: isSplitButton,
|
|
129
132
|
isNavigationSplit: isNavigationSplitButton
|
|
130
133
|
});
|
|
131
|
-
}, [appearance, buttonType, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
134
|
+
}, [appearance, buttonType, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, overlay, hasIconBefore, hasIconAfter, isSplitButton, isNavigationSplitButton]);
|
|
132
135
|
var isEffectivelyDisabled = isDisabled || Boolean(overlay);
|
|
133
136
|
return _objectSpread({
|
|
134
137
|
ref: setRef,
|
|
@@ -40,14 +40,6 @@ var verticalAlign = {
|
|
|
40
40
|
none: 'baseline'
|
|
41
41
|
};
|
|
42
42
|
var splitBorderStyles = {
|
|
43
|
-
':first-of-type': {
|
|
44
|
-
borderTopRightRadius: 0,
|
|
45
|
-
borderBottomRightRadius: 0
|
|
46
|
-
},
|
|
47
|
-
':last-of-type': {
|
|
48
|
-
borderTopLeftRadius: 0,
|
|
49
|
-
borderBottomLeftRadius: 0
|
|
50
|
-
},
|
|
51
43
|
':focus-visible': {
|
|
52
44
|
zIndex: 1
|
|
53
45
|
}
|
|
@@ -91,6 +83,7 @@ export function getXCSS(_ref3) {
|
|
|
91
83
|
isHighlighted = _ref3.isHighlighted,
|
|
92
84
|
isActiveOverSelected = _ref3.isActiveOverSelected,
|
|
93
85
|
isIconButton = _ref3.isIconButton,
|
|
86
|
+
isCircle = _ref3.isCircle,
|
|
94
87
|
shouldFitContainer = _ref3.shouldFitContainer,
|
|
95
88
|
isLink = _ref3.isLink,
|
|
96
89
|
isSplit = _ref3.isSplit,
|
|
@@ -136,7 +129,7 @@ export function getXCSS(_ref3) {
|
|
|
136
129
|
return xcss(_objectSpread(_objectSpread(_objectSpread({
|
|
137
130
|
alignItems: 'baseline',
|
|
138
131
|
borderWidth: 'border.width.0',
|
|
139
|
-
borderRadius: 'border.radius.100',
|
|
132
|
+
borderRadius: isCircle && !isSplit ? 'border.radius.circle' : 'border.radius.100',
|
|
140
133
|
boxSizing: 'border-box',
|
|
141
134
|
display: 'inline-flex',
|
|
142
135
|
fontSize: 'inherit',
|
|
@@ -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.10",
|
|
113
113
|
analyticsData: analyticsContext
|
|
114
114
|
});
|
|
115
115
|
|
|
@@ -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, UNSAFE_size, 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, shape, testId, UNSAFE_size, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Icon Button__
|
|
8
8
|
*
|
|
@@ -12,6 +12,10 @@ export type CommonIconButtonProps = {
|
|
|
12
12
|
* Provide an accessible label, often used by screen readers
|
|
13
13
|
*/
|
|
14
14
|
label: string;
|
|
15
|
+
/**
|
|
16
|
+
* Set the shape of the icon, defaults to square with rounded corners
|
|
17
|
+
*/
|
|
18
|
+
shape?: 'default' | 'circle';
|
|
15
19
|
/**
|
|
16
20
|
* Set the size of the icon. `medium` is default, so it does not need to be specified.
|
|
17
21
|
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UseButtonBaseArgs, type UseButtonBaseReturn } from '../shared/use-button-base';
|
|
2
2
|
import { type CommonIconButtonProps } from './types';
|
|
3
|
-
type UseIconButtonArgs<TagName extends HTMLElement> = UseButtonBaseArgs<TagName> & CommonIconButtonProps;
|
|
3
|
+
type UseIconButtonArgs<TagName extends HTMLElement> = Omit<UseButtonBaseArgs<TagName>, 'children'> & CommonIconButtonProps;
|
|
4
4
|
type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>;
|
|
5
5
|
/**
|
|
6
6
|
* __Use icon button__
|
|
@@ -11,5 +11,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
|
|
|
11
11
|
*
|
|
12
12
|
* @private
|
|
13
13
|
*/
|
|
14
|
-
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isSelected, label, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
14
|
+
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isSelected, label, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shape, shouldFitContainer, spacing, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
15
15
|
export default useIconButton;
|
|
@@ -10,6 +10,7 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
10
10
|
*/
|
|
11
11
|
buttonType: 'button' | 'link';
|
|
12
12
|
isIconButton?: boolean;
|
|
13
|
+
isCircle?: boolean;
|
|
13
14
|
hasIconBefore?: boolean;
|
|
14
15
|
hasIconAfter?: boolean;
|
|
15
16
|
shouldFitContainer?: boolean;
|
|
@@ -34,5 +35,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
|
34
35
|
*
|
|
35
36
|
* @private
|
|
36
37
|
*/
|
|
37
|
-
declare const useButtonBase: <TagName extends HTMLElement>({ analyticsContext, appearance: propAppearance, autoFocus, buttonType, interactionName, isDisabled: propIsDisabled, isSelected, isIconButton, hasIconBefore, hasIconAfter, children, onClick: providedOnClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
38
|
+
declare const useButtonBase: <TagName extends HTMLElement>({ analyticsContext, appearance: propAppearance, autoFocus, buttonType, interactionName, isDisabled: propIsDisabled, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick: providedOnClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
38
39
|
export default useButtonBase;
|
|
@@ -13,6 +13,7 @@ export type GetXCSSArgs = {
|
|
|
13
13
|
shouldFitContainer: boolean;
|
|
14
14
|
hasOverlay: boolean;
|
|
15
15
|
isIconButton: boolean;
|
|
16
|
+
isCircle: boolean;
|
|
16
17
|
hasIconBefore: boolean;
|
|
17
18
|
hasIconAfter: boolean;
|
|
18
19
|
/**
|
|
@@ -28,4 +29,4 @@ export type GetXCSSArgs = {
|
|
|
28
29
|
*/
|
|
29
30
|
isNavigationSplit: boolean;
|
|
30
31
|
};
|
|
31
|
-
export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
|
|
32
|
+
export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
|
|
@@ -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, UNSAFE_size, 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, shape, testId, UNSAFE_size, href, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Icon Button__
|
|
8
8
|
*
|
|
@@ -12,6 +12,10 @@ export type CommonIconButtonProps = {
|
|
|
12
12
|
* Provide an accessible label, often used by screen readers
|
|
13
13
|
*/
|
|
14
14
|
label: string;
|
|
15
|
+
/**
|
|
16
|
+
* Set the shape of the icon, defaults to square with rounded corners
|
|
17
|
+
*/
|
|
18
|
+
shape?: 'default' | 'circle';
|
|
15
19
|
/**
|
|
16
20
|
* Set the size of the icon. `medium` is default, so it does not need to be specified.
|
|
17
21
|
* This is UNSAFE as it will be removed in future in favor of a 100% bounded API
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UseButtonBaseArgs, type UseButtonBaseReturn } from '../shared/use-button-base';
|
|
2
2
|
import { type CommonIconButtonProps } from './types';
|
|
3
|
-
type UseIconButtonArgs<TagName extends HTMLElement> = UseButtonBaseArgs<TagName> & CommonIconButtonProps;
|
|
3
|
+
type UseIconButtonArgs<TagName extends HTMLElement> = Omit<UseButtonBaseArgs<TagName>, 'children'> & CommonIconButtonProps;
|
|
4
4
|
type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>;
|
|
5
5
|
/**
|
|
6
6
|
* __Use icon button__
|
|
@@ -11,5 +11,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
|
|
|
11
11
|
*
|
|
12
12
|
* @private
|
|
13
13
|
*/
|
|
14
|
-
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isSelected, label, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
14
|
+
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isSelected, label, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shape, shouldFitContainer, spacing, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
15
15
|
export default useIconButton;
|
|
@@ -10,6 +10,7 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
10
10
|
*/
|
|
11
11
|
buttonType: 'button' | 'link';
|
|
12
12
|
isIconButton?: boolean;
|
|
13
|
+
isCircle?: boolean;
|
|
13
14
|
hasIconBefore?: boolean;
|
|
14
15
|
hasIconAfter?: boolean;
|
|
15
16
|
shouldFitContainer?: boolean;
|
|
@@ -34,5 +35,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
|
34
35
|
*
|
|
35
36
|
* @private
|
|
36
37
|
*/
|
|
37
|
-
declare const useButtonBase: <TagName extends HTMLElement>({ analyticsContext, appearance: propAppearance, autoFocus, buttonType, interactionName, isDisabled: propIsDisabled, isSelected, isIconButton, hasIconBefore, hasIconAfter, children, onClick: providedOnClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
38
|
+
declare const useButtonBase: <TagName extends HTMLElement>({ analyticsContext, appearance: propAppearance, autoFocus, buttonType, interactionName, isDisabled: propIsDisabled, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick: providedOnClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
38
39
|
export default useButtonBase;
|
|
@@ -13,6 +13,7 @@ export type GetXCSSArgs = {
|
|
|
13
13
|
shouldFitContainer: boolean;
|
|
14
14
|
hasOverlay: boolean;
|
|
15
15
|
isIconButton: boolean;
|
|
16
|
+
isCircle: boolean;
|
|
16
17
|
hasIconBefore: boolean;
|
|
17
18
|
hasIconAfter: boolean;
|
|
18
19
|
/**
|
|
@@ -28,4 +29,4 @@ export type GetXCSSArgs = {
|
|
|
28
29
|
*/
|
|
29
30
|
isNavigationSplit: boolean;
|
|
30
31
|
};
|
|
31
|
-
export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
|
|
32
|
+
export declare function getXCSS({ appearance, spacing, isDisabled, isSelected, isHighlighted, isActiveOverSelected, isIconButton, isCircle, shouldFitContainer, isLink, isSplit, isNavigationSplit, hasOverlay, hasIconBefore, hasIconAfter, }: GetXCSSArgs): ReturnType<typeof xcss>;
|
package/package.json
CHANGED