@atlaskit/button 16.17.5 → 16.17.7

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/new-button/variants/icon/link.js +4 -2
  3. package/dist/cjs/new-button/variants/shared/use-button-base.js +1 -1
  4. package/dist/cjs/new-button/variants/shared/xcss.js +7 -1
  5. package/dist/cjs/old-button/shared/button-base.js +1 -1
  6. package/dist/cjs/utils/appearances.js +3 -2
  7. package/dist/cjs/utils/variants.js +56 -8
  8. package/dist/es2019/new-button/variants/icon/link.js +3 -1
  9. package/dist/es2019/new-button/variants/shared/use-button-base.js +1 -1
  10. package/dist/es2019/new-button/variants/shared/xcss.js +7 -1
  11. package/dist/es2019/old-button/shared/button-base.js +1 -1
  12. package/dist/es2019/utils/appearances.js +2 -1
  13. package/dist/es2019/utils/variants.js +43 -7
  14. package/dist/esm/new-button/variants/icon/link.js +4 -2
  15. package/dist/esm/new-button/variants/shared/use-button-base.js +1 -1
  16. package/dist/esm/new-button/variants/shared/xcss.js +7 -1
  17. package/dist/esm/old-button/shared/button-base.js +1 -1
  18. package/dist/esm/utils/appearances.js +2 -1
  19. package/dist/esm/utils/variants.js +56 -8
  20. package/dist/types/new-button/variants/icon/link.d.ts +1 -1
  21. package/dist/types/new-button/variants/icon/types.d.ts +2 -4
  22. package/dist/types/utils/appearances.d.ts +3 -2
  23. package/dist/types/utils/variants.d.ts +34 -14
  24. package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -1
  25. package/dist/types-ts4.5/new-button/variants/icon/types.d.ts +2 -4
  26. package/dist/types-ts4.5/utils/appearances.d.ts +3 -2
  27. package/dist/types-ts4.5/utils/variants.d.ts +34 -14
  28. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/button
2
2
 
3
+ ## 16.17.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+
9
+ ## 16.17.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [#57229](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/57229) [`dd91461d616d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dd91461d616d) - [ux] Fixes a bug in new Buttons (in closed beta) that affected text alignment
14
+
3
15
  ## 16.17.5
4
16
 
5
17
  ### Patch Changes
@@ -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.5",
118
+ packageVersion: "16.17.7",
119
119
  analyticsData: analyticsContext,
120
120
  actionSubject: buttonType
121
121
  });
@@ -18,6 +18,11 @@ var heights = exports.heights = {
18
18
  compact: "".concat(24 / fontSize, "em"),
19
19
  none: 'auto'
20
20
  };
21
+ var lineHeights = {
22
+ default: heights.default,
23
+ compact: heights.compact,
24
+ none: 'inherit'
25
+ };
21
26
  var paddingInline = {
22
27
  default: {
23
28
  default: 'space.150',
@@ -137,7 +142,7 @@ function getXCSS(_ref3) {
137
142
  paddingInlineStart = _getNavigationSplitBu.paddingInlineStart,
138
143
  paddingInlineEnd = _getNavigationSplitBu.paddingInlineEnd;
139
144
  return (0, _primitives.xcss)(_objectSpread(_objectSpread(_objectSpread({
140
- alignItems: 'center',
145
+ alignItems: 'baseline',
141
146
  borderWidth: 'border.width.0',
142
147
  borderRadius: 'border.radius.100',
143
148
  boxSizing: 'border-box',
@@ -153,6 +158,7 @@ function getXCSS(_ref3) {
153
158
  transition: 'background 0.1s ease-out, box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38)',
154
159
  whiteSpace: 'nowrap',
155
160
  height: height,
161
+ lineHeight: lineHeights[spacing],
156
162
  paddingBlock: 'space.0',
157
163
  paddingInlineStart: paddingInlineStart,
158
164
  paddingInlineEnd: paddingInlineEnd,
@@ -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.5",
121
+ packageVersion: "16.17.7",
122
122
  analyticsData: analyticsContext
123
123
  });
124
124
 
@@ -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 linkButtonVariants = exports.linkButtonVariants = [{
30
- name: 'LinkButton',
31
- Component: LinkButtonRender,
32
- elementType: HTMLAnchorElement,
33
- appearances: _appearances.linkButtonAppearances
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;
@@ -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
@@ -97,7 +97,7 @@ const useButtonBase = ({
97
97
  action: 'clicked',
98
98
  componentName: 'button',
99
99
  packageName: "@atlaskit/button",
100
- packageVersion: "16.17.5",
100
+ packageVersion: "16.17.7",
101
101
  analyticsData: analyticsContext,
102
102
  actionSubject: buttonType
103
103
  });
@@ -7,6 +7,11 @@ export const heights = {
7
7
  compact: `${24 / fontSize}em`,
8
8
  none: 'auto'
9
9
  };
10
+ const lineHeights = {
11
+ default: heights.default,
12
+ compact: heights.compact,
13
+ none: 'inherit'
14
+ };
10
15
  const paddingInline = {
11
16
  default: {
12
17
  default: 'space.150',
@@ -131,7 +136,7 @@ export function getXCSS({
131
136
  paddingInlineEnd
132
137
  } = getNavigationSplitButtonPaddings();
133
138
  return xcss({
134
- alignItems: 'center',
139
+ alignItems: 'baseline',
135
140
  borderWidth: 'border.width.0',
136
141
  borderRadius: 'border.radius.100',
137
142
  boxSizing: 'border-box',
@@ -147,6 +152,7 @@ export function getXCSS({
147
152
  transition: 'background 0.1s ease-out, box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38)',
148
153
  whiteSpace: 'nowrap',
149
154
  height,
155
+ lineHeight: lineHeights[spacing],
150
156
  paddingBlock: 'space.0',
151
157
  paddingInlineStart,
152
158
  paddingInlineEnd,
@@ -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.5",
106
+ packageVersion: "16.17.7",
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
- export { buttonAppearances, linkButtonAppearances };
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 { buttonAppearances, linkButtonAppearances } from './appearances';
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
- export const linkButtonVariants = [{
16
- name: 'LinkButton',
17
- Component: LinkButtonRender,
18
- elementType: HTMLAnchorElement,
19
- appearances: linkButtonAppearances
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;
@@ -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.5",
110
+ packageVersion: "16.17.7",
111
111
  analyticsData: analyticsContext,
112
112
  actionSubject: buttonType
113
113
  });
@@ -10,6 +10,11 @@ export var heights = {
10
10
  compact: "".concat(24 / fontSize, "em"),
11
11
  none: 'auto'
12
12
  };
13
+ var lineHeights = {
14
+ default: heights.default,
15
+ compact: heights.compact,
16
+ none: 'inherit'
17
+ };
13
18
  var paddingInline = {
14
19
  default: {
15
20
  default: 'space.150',
@@ -129,7 +134,7 @@ export function getXCSS(_ref3) {
129
134
  paddingInlineStart = _getNavigationSplitBu.paddingInlineStart,
130
135
  paddingInlineEnd = _getNavigationSplitBu.paddingInlineEnd;
131
136
  return xcss(_objectSpread(_objectSpread(_objectSpread({
132
- alignItems: 'center',
137
+ alignItems: 'baseline',
133
138
  borderWidth: 'border.width.0',
134
139
  borderRadius: 'border.radius.100',
135
140
  boxSizing: 'border-box',
@@ -145,6 +150,7 @@ export function getXCSS(_ref3) {
145
150
  transition: 'background 0.1s ease-out, box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38)',
146
151
  whiteSpace: 'nowrap',
147
152
  height: height,
153
+ lineHeight: lineHeights[spacing],
148
154
  paddingBlock: 'space.0',
149
155
  paddingInlineStart: paddingInlineStart,
150
156
  paddingInlineEnd: paddingInlineEnd,
@@ -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.5",
112
+ packageVersion: "16.17.7",
113
113
  analyticsData: analyticsContext
114
114
  });
115
115
 
@@ -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
- export { buttonAppearances, linkButtonAppearances };
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 { buttonAppearances, linkButtonAppearances } from './appearances';
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
- export var linkButtonVariants = [{
20
- name: 'LinkButton',
21
- Component: LinkButtonRender,
22
- elementType: HTMLAnchorElement,
23
- appearances: linkButtonAppearances
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;
@@ -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?: 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
- export { buttonAppearances, linkButtonAppearances };
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 { buttonAppearances, linkButtonAppearances } from './appearances';
5
- export type Variant = {
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
- export declare const linkButtonVariants: {
20
- name: string;
21
- Component: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
22
- href?: string | undefined;
23
- } & React.RefAttributes<HTMLAnchorElement>>;
24
- elementType: {
25
- new (): HTMLAnchorElement;
26
- prototype: HTMLAnchorElement;
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;
@@ -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?: 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
- export { buttonAppearances, linkButtonAppearances };
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 { buttonAppearances, linkButtonAppearances } from './appearances';
5
- export type Variant = {
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
- export declare const linkButtonVariants: {
20
- name: string;
21
- Component: React.ForwardRefExoticComponent<Omit<LinkButtonProps<never>, "href"> & {
22
- href?: string | undefined;
23
- } & React.RefAttributes<HTMLAnchorElement>>;
24
- elementType: {
25
- new (): HTMLAnchorElement;
26
- prototype: HTMLAnchorElement;
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.5",
3
+ "version": "16.17.7",
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/"