@atlaskit/button 17.14.2 → 17.15.0

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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/button
2
2
 
3
+ ## 17.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#99861](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99861)
8
+ [`452b917ff365`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/452b917ff365) -
9
+ Add support for React 18.
10
+
11
+ ## 17.14.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [#95202](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/95202)
16
+ [`99bd29123e13`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/99bd29123e13) -
17
+ Internal change to support experimental icon components
18
+ - Updated dependencies
19
+
3
20
  ## 17.14.2
4
21
 
5
22
  ### Patch Changes
@@ -58,18 +58,22 @@ var useDefaultButton = function useDefaultButton(_ref) {
58
58
  buttonType: buttonType,
59
59
  children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, IconBefore && /*#__PURE__*/_react.default.createElement(_content.default, {
60
60
  type: "icon",
61
+ position: "before",
61
62
  hasOverlay: hasOverlay
62
63
  }, /*#__PURE__*/_react.default.createElement(IconBefore, {
63
64
  label: "",
64
- size: UNSAFE_iconBefore_size
65
+ size: UNSAFE_iconBefore_size,
66
+ color: 'currentColor'
65
67
  })), children && /*#__PURE__*/_react.default.createElement(_content.default, {
66
68
  hasOverlay: hasOverlay
67
69
  }, children), IconAfter && /*#__PURE__*/_react.default.createElement(_content.default, {
68
70
  type: "icon",
71
+ position: "after",
69
72
  hasOverlay: hasOverlay
70
73
  }, /*#__PURE__*/_react.default.createElement(IconAfter, {
71
74
  label: "",
72
- size: UNSAFE_iconAfter_size
75
+ size: UNSAFE_iconAfter_size,
76
+ color: 'currentColor'
73
77
  }))),
74
78
  interactionName: interactionName,
75
79
  isDisabled: isDisabled,
@@ -58,7 +58,8 @@ var useIconButton = function useIconButton(_ref) {
58
58
  hasOverlay: hasOverlay
59
59
  }, /*#__PURE__*/_react.default.createElement(Icon, {
60
60
  label: "",
61
- size: UNSAFE_size
61
+ size: UNSAFE_size,
62
+ color: 'currentColor'
62
63
  }), /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, null, label)),
63
64
  interactionName: interactionName,
64
65
  isDisabled: isDisabled,
@@ -33,6 +33,27 @@ var commonStyles = (0, _primitives.xcss)({
33
33
  var fadeStyles = (0, _primitives.xcss)({
34
34
  opacity: 0
35
35
  });
36
+
37
+ /**
38
+ * These CSS variables consumed by the new icons, to allow them to have appropriate
39
+ * padding inside Button while also maintaining spacing for the existing icons.
40
+ *
41
+ * These styles can be removed once the new icons are fully rolled out, feature flag
42
+ * platform.design-system-team.enable-new-icons is cleaned up,
43
+ * and we bump Button to set padding based on the new icons.
44
+ */
45
+ var beforeIconStyles = (0, _primitives.xcss)({
46
+ // @ts-ignore
47
+ '--ds--button--new-icon-padding-start': "var(--ds-space-050, 4px)",
48
+ // @ts-ignore
49
+ '--ds--button--new-icon-padding-end': "var(--ds-space-025, 2px)"
50
+ });
51
+ var afterIconStyles = (0, _primitives.xcss)({
52
+ // @ts-ignore
53
+ '--ds--button--new-icon-padding-start': "var(--ds-space-025, 2px)",
54
+ // @ts-ignore
55
+ '--ds--button--new-icon-padding-end': "var(--ds-space-050, 4px)"
56
+ });
36
57
  /**
37
58
  * __Content__
38
59
  *
@@ -42,10 +63,11 @@ var Content = function Content(_ref) {
42
63
  var children = _ref.children,
43
64
  _ref$type = _ref.type,
44
65
  type = _ref$type === void 0 ? 'text' : _ref$type,
45
- hasOverlay = _ref.hasOverlay;
66
+ hasOverlay = _ref.hasOverlay,
67
+ position = _ref.position;
46
68
  return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
47
69
  as: "span",
48
- xcss: [commonStyles].concat((0, _toConsumableArray2.default)(type === 'text' ? [textStyles] : [iconStyles]), (0, _toConsumableArray2.default)(hasOverlay ? [fadeStyles] : []))
70
+ xcss: [commonStyles].concat((0, _toConsumableArray2.default)(type === 'text' ? [textStyles] : [iconStyles]), (0, _toConsumableArray2.default)(hasOverlay ? [fadeStyles] : []), (0, _toConsumableArray2.default)(position === 'before' ? [beforeIconStyles] : []), (0, _toConsumableArray2.default)(position === 'after' ? [afterIconStyles] : []))
49
71
  }, children);
50
72
  };
51
73
  var _default = exports.default = Content;
@@ -34,10 +34,22 @@ var noPointerEventsOnChildrenCss = {
34
34
  pointerEvents: 'none'
35
35
  }
36
36
  };
37
+ /**
38
+ * These CSS variables consumed by the new icons, to allow them to have appropriate
39
+ * padding inside Button while also maintaining spacing for the existing icons.
40
+ *
41
+ * These styles can be removed once the new icons are fully rolled out, feature flag
42
+ * platform.design-system-team.enable-new-icons is cleaned up,
43
+ * and we bump Button to set padding based on the new icons.
44
+ */
37
45
  var iconBeforeSpacingFixStyle = (0, _react2.css)({
46
+ '--ds--button--new-icon-padding-end': "var(--ds-space-025, 2px)",
47
+ '--ds--button--new-icon-padding-start': "var(--ds-space-050, 4px)",
38
48
  marginInlineStart: "var(--ds-space-negative-025, -2px)"
39
49
  });
40
50
  var iconAfterSpacingFixStyle = (0, _react2.css)({
51
+ '--ds--button--new-icon-padding-end': "var(--ds-space-050, 4px)",
52
+ '--ds--button--new-icon-padding-start': "var(--ds-space-025, 2px)",
41
53
  marginInlineEnd: "var(--ds-space-negative-025, -2px)"
42
54
  });
43
55
  var getSpacingFix = function getSpacingFix(children, spacingStyles) {
@@ -117,7 +129,7 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
117
129
  action: 'clicked',
118
130
  componentName: 'button',
119
131
  packageName: "@atlaskit/button",
120
- packageVersion: "17.14.2",
132
+ packageVersion: "17.15.0",
121
133
  analyticsData: analyticsContext
122
134
  });
123
135
 
@@ -48,18 +48,22 @@ const useDefaultButton = ({
48
48
  buttonType,
49
49
  children: /*#__PURE__*/React.createElement(Fragment, null, IconBefore && /*#__PURE__*/React.createElement(Content, {
50
50
  type: "icon",
51
+ position: "before",
51
52
  hasOverlay: hasOverlay
52
53
  }, /*#__PURE__*/React.createElement(IconBefore, {
53
54
  label: "",
54
- size: UNSAFE_iconBefore_size
55
+ size: UNSAFE_iconBefore_size,
56
+ color: 'currentColor'
55
57
  })), children && /*#__PURE__*/React.createElement(Content, {
56
58
  hasOverlay: hasOverlay
57
59
  }, children), IconAfter && /*#__PURE__*/React.createElement(Content, {
58
60
  type: "icon",
61
+ position: "after",
59
62
  hasOverlay: hasOverlay
60
63
  }, /*#__PURE__*/React.createElement(IconAfter, {
61
64
  label: "",
62
- size: UNSAFE_iconAfter_size
65
+ size: UNSAFE_iconAfter_size,
66
+ color: 'currentColor'
63
67
  }))),
64
68
  interactionName,
65
69
  isDisabled,
@@ -52,7 +52,8 @@ const useIconButton = ({
52
52
  hasOverlay: hasOverlay
53
53
  }, /*#__PURE__*/React.createElement(Icon, {
54
54
  label: "",
55
- size: UNSAFE_size
55
+ size: UNSAFE_size,
56
+ color: 'currentColor'
56
57
  }), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)),
57
58
  interactionName,
58
59
  isDisabled,
@@ -25,6 +25,27 @@ const commonStyles = xcss({
25
25
  const fadeStyles = xcss({
26
26
  opacity: 0
27
27
  });
28
+
29
+ /**
30
+ * These CSS variables consumed by the new icons, to allow them to have appropriate
31
+ * padding inside Button while also maintaining spacing for the existing icons.
32
+ *
33
+ * These styles can be removed once the new icons are fully rolled out, feature flag
34
+ * platform.design-system-team.enable-new-icons is cleaned up,
35
+ * and we bump Button to set padding based on the new icons.
36
+ */
37
+ const beforeIconStyles = xcss({
38
+ // @ts-ignore
39
+ '--ds--button--new-icon-padding-start': "var(--ds-space-050, 4px)",
40
+ // @ts-ignore
41
+ '--ds--button--new-icon-padding-end': "var(--ds-space-025, 2px)"
42
+ });
43
+ const afterIconStyles = xcss({
44
+ // @ts-ignore
45
+ '--ds--button--new-icon-padding-start': "var(--ds-space-025, 2px)",
46
+ // @ts-ignore
47
+ '--ds--button--new-icon-padding-end': "var(--ds-space-050, 4px)"
48
+ });
28
49
  /**
29
50
  * __Content__
30
51
  *
@@ -33,11 +54,12 @@ const fadeStyles = xcss({
33
54
  const Content = ({
34
55
  children,
35
56
  type = 'text',
36
- hasOverlay
57
+ hasOverlay,
58
+ position
37
59
  }) => {
38
60
  return /*#__PURE__*/React.createElement(Box, {
39
61
  as: "span",
40
- xcss: [commonStyles, ...(type === 'text' ? [textStyles] : [iconStyles]), ...(hasOverlay ? [fadeStyles] : [])]
62
+ xcss: [commonStyles, ...(type === 'text' ? [textStyles] : [iconStyles]), ...(hasOverlay ? [fadeStyles] : []), ...(position === 'before' ? [beforeIconStyles] : []), ...(position === 'after' ? [afterIconStyles] : [])]
41
63
  }, children);
42
64
  };
43
65
  export default Content;
@@ -23,10 +23,22 @@ const noPointerEventsOnChildrenCss = {
23
23
  pointerEvents: 'none'
24
24
  }
25
25
  };
26
+ /**
27
+ * These CSS variables consumed by the new icons, to allow them to have appropriate
28
+ * padding inside Button while also maintaining spacing for the existing icons.
29
+ *
30
+ * These styles can be removed once the new icons are fully rolled out, feature flag
31
+ * platform.design-system-team.enable-new-icons is cleaned up,
32
+ * and we bump Button to set padding based on the new icons.
33
+ */
26
34
  const iconBeforeSpacingFixStyle = css({
35
+ '--ds--button--new-icon-padding-end': "var(--ds-space-025, 2px)",
36
+ '--ds--button--new-icon-padding-start': "var(--ds-space-050, 4px)",
27
37
  marginInlineStart: "var(--ds-space-negative-025, -2px)"
28
38
  });
29
39
  const iconAfterSpacingFixStyle = css({
40
+ '--ds--button--new-icon-padding-end': "var(--ds-space-050, 4px)",
41
+ '--ds--button--new-icon-padding-start': "var(--ds-space-025, 2px)",
30
42
  marginInlineEnd: "var(--ds-space-negative-025, -2px)"
31
43
  });
32
44
  const getSpacingFix = (children, spacingStyles) => {
@@ -102,7 +114,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
102
114
  action: 'clicked',
103
115
  componentName: 'button',
104
116
  packageName: "@atlaskit/button",
105
- packageVersion: "17.14.2",
117
+ packageVersion: "17.15.0",
106
118
  analyticsData: analyticsContext
107
119
  });
108
120
 
@@ -48,18 +48,22 @@ var useDefaultButton = function useDefaultButton(_ref) {
48
48
  buttonType: buttonType,
49
49
  children: /*#__PURE__*/React.createElement(Fragment, null, IconBefore && /*#__PURE__*/React.createElement(Content, {
50
50
  type: "icon",
51
+ position: "before",
51
52
  hasOverlay: hasOverlay
52
53
  }, /*#__PURE__*/React.createElement(IconBefore, {
53
54
  label: "",
54
- size: UNSAFE_iconBefore_size
55
+ size: UNSAFE_iconBefore_size,
56
+ color: 'currentColor'
55
57
  })), children && /*#__PURE__*/React.createElement(Content, {
56
58
  hasOverlay: hasOverlay
57
59
  }, children), IconAfter && /*#__PURE__*/React.createElement(Content, {
58
60
  type: "icon",
61
+ position: "after",
59
62
  hasOverlay: hasOverlay
60
63
  }, /*#__PURE__*/React.createElement(IconAfter, {
61
64
  label: "",
62
- size: UNSAFE_iconAfter_size
65
+ size: UNSAFE_iconAfter_size,
66
+ color: 'currentColor'
63
67
  }))),
64
68
  interactionName: interactionName,
65
69
  isDisabled: isDisabled,
@@ -51,7 +51,8 @@ var useIconButton = function useIconButton(_ref) {
51
51
  hasOverlay: hasOverlay
52
52
  }, /*#__PURE__*/React.createElement(Icon, {
53
53
  label: "",
54
- size: UNSAFE_size
54
+ size: UNSAFE_size,
55
+ color: 'currentColor'
55
56
  }), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)),
56
57
  interactionName: interactionName,
57
58
  isDisabled: isDisabled,
@@ -26,6 +26,27 @@ var commonStyles = xcss({
26
26
  var fadeStyles = xcss({
27
27
  opacity: 0
28
28
  });
29
+
30
+ /**
31
+ * These CSS variables consumed by the new icons, to allow them to have appropriate
32
+ * padding inside Button while also maintaining spacing for the existing icons.
33
+ *
34
+ * These styles can be removed once the new icons are fully rolled out, feature flag
35
+ * platform.design-system-team.enable-new-icons is cleaned up,
36
+ * and we bump Button to set padding based on the new icons.
37
+ */
38
+ var beforeIconStyles = xcss({
39
+ // @ts-ignore
40
+ '--ds--button--new-icon-padding-start': "var(--ds-space-050, 4px)",
41
+ // @ts-ignore
42
+ '--ds--button--new-icon-padding-end': "var(--ds-space-025, 2px)"
43
+ });
44
+ var afterIconStyles = xcss({
45
+ // @ts-ignore
46
+ '--ds--button--new-icon-padding-start': "var(--ds-space-025, 2px)",
47
+ // @ts-ignore
48
+ '--ds--button--new-icon-padding-end': "var(--ds-space-050, 4px)"
49
+ });
29
50
  /**
30
51
  * __Content__
31
52
  *
@@ -35,10 +56,11 @@ var Content = function Content(_ref) {
35
56
  var children = _ref.children,
36
57
  _ref$type = _ref.type,
37
58
  type = _ref$type === void 0 ? 'text' : _ref$type,
38
- hasOverlay = _ref.hasOverlay;
59
+ hasOverlay = _ref.hasOverlay,
60
+ position = _ref.position;
39
61
  return /*#__PURE__*/React.createElement(Box, {
40
62
  as: "span",
41
- xcss: [commonStyles].concat(_toConsumableArray(type === 'text' ? [textStyles] : [iconStyles]), _toConsumableArray(hasOverlay ? [fadeStyles] : []))
63
+ xcss: [commonStyles].concat(_toConsumableArray(type === 'text' ? [textStyles] : [iconStyles]), _toConsumableArray(hasOverlay ? [fadeStyles] : []), _toConsumableArray(position === 'before' ? [beforeIconStyles] : []), _toConsumableArray(position === 'after' ? [afterIconStyles] : []))
42
64
  }, children);
43
65
  };
44
66
  export default Content;
@@ -25,10 +25,22 @@ var noPointerEventsOnChildrenCss = {
25
25
  pointerEvents: 'none'
26
26
  }
27
27
  };
28
+ /**
29
+ * These CSS variables consumed by the new icons, to allow them to have appropriate
30
+ * padding inside Button while also maintaining spacing for the existing icons.
31
+ *
32
+ * These styles can be removed once the new icons are fully rolled out, feature flag
33
+ * platform.design-system-team.enable-new-icons is cleaned up,
34
+ * and we bump Button to set padding based on the new icons.
35
+ */
28
36
  var iconBeforeSpacingFixStyle = css({
37
+ '--ds--button--new-icon-padding-end': "var(--ds-space-025, 2px)",
38
+ '--ds--button--new-icon-padding-start': "var(--ds-space-050, 4px)",
29
39
  marginInlineStart: "var(--ds-space-negative-025, -2px)"
30
40
  });
31
41
  var iconAfterSpacingFixStyle = css({
42
+ '--ds--button--new-icon-padding-end': "var(--ds-space-050, 4px)",
43
+ '--ds--button--new-icon-padding-start': "var(--ds-space-025, 2px)",
32
44
  marginInlineEnd: "var(--ds-space-negative-025, -2px)"
33
45
  });
34
46
  var getSpacingFix = function getSpacingFix(children, spacingStyles) {
@@ -108,7 +120,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
108
120
  action: 'clicked',
109
121
  componentName: 'button',
110
122
  packageName: "@atlaskit/button",
111
- packageVersion: "17.14.2",
123
+ packageVersion: "17.15.0",
112
124
  analyticsData: analyticsContext
113
125
  });
114
126
 
@@ -3,11 +3,12 @@ type ContentProps = {
3
3
  children: React.ReactNode;
4
4
  type?: 'text' | 'icon';
5
5
  hasOverlay: boolean;
6
+ position?: 'before' | 'after';
6
7
  };
7
8
  /**
8
9
  * __Content__
9
10
  *
10
11
  * Used for slots within a Button, including icons and text content.
11
12
  */
12
- declare const Content: ({ children, type, hasOverlay }: ContentProps) => JSX.Element;
13
+ declare const Content: ({ children, type, hasOverlay, position, }: ContentProps) => JSX.Element;
13
14
  export default Content;
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import { type IconProps } from '@atlaskit/icon/types';
1
+ import type React from 'react';
2
+ import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import { type IconProps, type UNSAFE_NewIconProps } from '@atlaskit/icon/types';
4
4
  export type ButtonAppearance = 'default' | 'danger' | 'primary' | 'subtle' | 'warning' | 'discovery';
5
5
  export type LinkButtonAppearance = 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning' | 'discovery';
6
6
  export type IconButtonAppearance = 'default' | 'primary' | 'discovery' | 'subtle';
@@ -8,7 +8,7 @@ export type Appearance = ButtonAppearance | LinkButtonAppearance | IconButtonApp
8
8
  export type ButtonSpacing = 'compact' | 'default' | 'none';
9
9
  export type IconButtonSpacing = 'compact' | 'default';
10
10
  export type Spacing = ButtonSpacing | IconButtonSpacing;
11
- export type IconProp = React.ComponentType<IconProps>;
11
+ export type IconProp = React.ComponentType<IconProps | UNSAFE_NewIconProps>;
12
12
  export type IconSize = 'small' | 'large' | 'xlarge';
13
13
  type Combine<First, Second> = Omit<First, keyof Second> & Second;
14
14
  export type CommonButtonProps<TagName extends HTMLElement> = {
@@ -29,30 +29,29 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
29
29
  */
30
30
  isSelected?: boolean;
31
31
  /**
32
- * Handler to be called on blur.
32
+ * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
33
33
  */
34
- onBlur?: React.FocusEventHandler<TagName>;
34
+ testId?: string;
35
35
  /**
36
- * Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details.
36
+ * Handler called on blur.
37
37
  */
38
- onClick?: (e: React.MouseEvent<TagName>, analyticsEvent: UIAnalyticsEvent) => void;
38
+ onBlur?: React.FocusEventHandler<TagName>;
39
39
  /**
40
- * Handler to be called on focus.
40
+ * Handler called on focus.
41
41
  */
42
42
  onFocus?: React.FocusEventHandler<TagName>;
43
43
  /**
44
- * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
44
+ * Handler called on click. You can use the second argument to fire Atlaskit analytics events on custom channels. They could then be routed to GASv3 analytics. See the pressable or anchor primitive code examples for information on [firing Atlaskit analytics events](https://atlassian.design/components/primitives/pressable/examples#atlaskit-analytics) or [routing these to GASv3 analytics](https://atlassian.design/components/primitives/pressable/examples#gasv3-analytics).
45
45
  */
46
- testId?: string;
46
+ onClick?: (e: React.MouseEvent<TagName>, analyticsEvent: UIAnalyticsEvent) => void;
47
47
  /**
48
- * An optional name used to identify this component to press listeners. For example, interaction tracing. For more information,
49
- * see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
48
+ * Additional information to be included in the `context` of Atlaskit analytics events that come from button. See [the pressable or anchor primitive code examples](https://atlassian.design/components/primitives/anchor/examples#atlaskit-analytics) for more information.
50
49
  */
51
- interactionName?: string;
50
+ analyticsContext?: Record<string, any>;
52
51
  /**
53
- * Additional information to be included in the `context` of analytics events that come from button.
52
+ * An optional name used to identify the button to interaction content listeners. By default, button fires React UFO (Unified Frontend Observability) press interactions for available listeners. This helps Atlassian measure performance and reliability. See [the pressable or anchor primitive code examples](https://atlassian.design/components/primitives/anchor/examples#react-ufo-press-interactions) for more information.
54
53
  */
55
- analyticsContext?: Record<string, any>;
54
+ interactionName?: string;
56
55
  };
57
56
  export type SupportedElements = HTMLButtonElement | HTMLAnchorElement;
58
57
  type SupportedElementAttributes = React.ButtonHTMLAttributes<HTMLButtonElement> | React.AnchorHTMLAttributes<HTMLAnchorElement>;
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { CSSObject } from '@emotion/react';
3
+ import { type CSSObject } from '@emotion/react';
4
4
  declare const _default: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.AllHTMLAttributes<HTMLElement>, "disabled">, "data-testid" | "data-has-overlay"> & {
5
5
  'data-testid'?: undefined;
6
6
  'data-has-overlay'?: undefined;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
1
+ import type React from 'react';
2
+ import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  export type Appearance = 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
4
4
  export type Spacing = 'compact' | 'default' | 'none';
5
5
  type Combine<First, Second> = Omit<First, keyof Second> & Second;
@@ -41,15 +41,15 @@ export type BaseOwnProps = {
41
41
  */
42
42
  isSelected?: boolean;
43
43
  /**
44
- * Handler to be called on blur.
44
+ * Handler called on blur.
45
45
  */
46
46
  onBlur?: React.FocusEventHandler<HTMLElement>;
47
47
  /**
48
- * Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details.
48
+ * Handler called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details.
49
49
  */
50
50
  onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
51
51
  /**
52
- * Handler to be called on focus.
52
+ * Handler called on focus.
53
53
  */
54
54
  onFocus?: React.FocusEventHandler<HTMLElement>;
55
55
  /**
@@ -41,12 +41,12 @@ declare const LinkButtonRender: React.ForwardRefExoticComponent<Omit<LinkButtonP
41
41
  href?: string | undefined;
42
42
  } & React.RefAttributes<HTMLAnchorElement>>;
43
43
  declare const IconButtonRender: React.ForwardRefExoticComponent<Omit<IconButtonProps, "label" | "icon"> & {
44
- icon?: import("../new-button/variants/types").IconProp | undefined;
44
+ icon?: React.ComponentType<import("@atlaskit/icon").IconProps | import("@atlaskit/icon").UNSAFE_NewIconProps> | undefined;
45
45
  label?: IconButtonProps['label'];
46
46
  } & React.RefAttributes<HTMLButtonElement>>;
47
47
  declare const LinkIconButtonRender: React.ForwardRefExoticComponent<Omit<LinkIconButtonProps, "label" | "href" | "icon"> & {
48
48
  href?: string | undefined;
49
- icon?: import("../new-button/variants/types").IconProp | undefined;
49
+ icon?: React.ComponentType<import("@atlaskit/icon").IconProps | import("@atlaskit/icon").UNSAFE_NewIconProps> | undefined;
50
50
  label?: LinkIconButtonProps['label'];
51
51
  } & React.RefAttributes<HTMLAnchorElement>>;
52
52
  declare const variants: Variant[];
@@ -3,11 +3,12 @@ type ContentProps = {
3
3
  children: React.ReactNode;
4
4
  type?: 'text' | 'icon';
5
5
  hasOverlay: boolean;
6
+ position?: 'before' | 'after';
6
7
  };
7
8
  /**
8
9
  * __Content__
9
10
  *
10
11
  * Used for slots within a Button, including icons and text content.
11
12
  */
12
- declare const Content: ({ children, type, hasOverlay }: ContentProps) => JSX.Element;
13
+ declare const Content: ({ children, type, hasOverlay, position, }: ContentProps) => JSX.Element;
13
14
  export default Content;
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import { type IconProps } from '@atlaskit/icon/types';
1
+ import type React from 'react';
2
+ import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import { type IconProps, type UNSAFE_NewIconProps } from '@atlaskit/icon/types';
4
4
  export type ButtonAppearance = 'default' | 'danger' | 'primary' | 'subtle' | 'warning' | 'discovery';
5
5
  export type LinkButtonAppearance = 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning' | 'discovery';
6
6
  export type IconButtonAppearance = 'default' | 'primary' | 'discovery' | 'subtle';
@@ -8,7 +8,7 @@ export type Appearance = ButtonAppearance | LinkButtonAppearance | IconButtonApp
8
8
  export type ButtonSpacing = 'compact' | 'default' | 'none';
9
9
  export type IconButtonSpacing = 'compact' | 'default';
10
10
  export type Spacing = ButtonSpacing | IconButtonSpacing;
11
- export type IconProp = React.ComponentType<IconProps>;
11
+ export type IconProp = React.ComponentType<IconProps | UNSAFE_NewIconProps>;
12
12
  export type IconSize = 'small' | 'large' | 'xlarge';
13
13
  type Combine<First, Second> = Omit<First, keyof Second> & Second;
14
14
  export type CommonButtonProps<TagName extends HTMLElement> = {
@@ -29,30 +29,29 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
29
29
  */
30
30
  isSelected?: boolean;
31
31
  /**
32
- * Handler to be called on blur.
32
+ * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
33
33
  */
34
- onBlur?: React.FocusEventHandler<TagName>;
34
+ testId?: string;
35
35
  /**
36
- * Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details.
36
+ * Handler called on blur.
37
37
  */
38
- onClick?: (e: React.MouseEvent<TagName>, analyticsEvent: UIAnalyticsEvent) => void;
38
+ onBlur?: React.FocusEventHandler<TagName>;
39
39
  /**
40
- * Handler to be called on focus.
40
+ * Handler called on focus.
41
41
  */
42
42
  onFocus?: React.FocusEventHandler<TagName>;
43
43
  /**
44
- * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
44
+ * Handler called on click. You can use the second argument to fire Atlaskit analytics events on custom channels. They could then be routed to GASv3 analytics. See the pressable or anchor primitive code examples for information on [firing Atlaskit analytics events](https://atlassian.design/components/primitives/pressable/examples#atlaskit-analytics) or [routing these to GASv3 analytics](https://atlassian.design/components/primitives/pressable/examples#gasv3-analytics).
45
45
  */
46
- testId?: string;
46
+ onClick?: (e: React.MouseEvent<TagName>, analyticsEvent: UIAnalyticsEvent) => void;
47
47
  /**
48
- * An optional name used to identify this component to press listeners. For example, interaction tracing. For more information,
49
- * see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
48
+ * Additional information to be included in the `context` of Atlaskit analytics events that come from button. See [the pressable or anchor primitive code examples](https://atlassian.design/components/primitives/anchor/examples#atlaskit-analytics) for more information.
50
49
  */
51
- interactionName?: string;
50
+ analyticsContext?: Record<string, any>;
52
51
  /**
53
- * Additional information to be included in the `context` of analytics events that come from button.
52
+ * An optional name used to identify the button to interaction content listeners. By default, button fires React UFO (Unified Frontend Observability) press interactions for available listeners. This helps Atlassian measure performance and reliability. See [the pressable or anchor primitive code examples](https://atlassian.design/components/primitives/anchor/examples#react-ufo-press-interactions) for more information.
54
53
  */
55
- analyticsContext?: Record<string, any>;
54
+ interactionName?: string;
56
55
  };
57
56
  export type SupportedElements = HTMLButtonElement | HTMLAnchorElement;
58
57
  type SupportedElementAttributes = React.ButtonHTMLAttributes<HTMLButtonElement> | React.AnchorHTMLAttributes<HTMLAnchorElement>;
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { CSSObject } from '@emotion/react';
3
+ import { type CSSObject } from '@emotion/react';
4
4
  declare const _default: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.AllHTMLAttributes<HTMLElement>, "disabled">, "data-testid" | "data-has-overlay"> & {
5
5
  'data-testid'?: undefined;
6
6
  'data-has-overlay'?: undefined;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
1
+ import type React from 'react';
2
+ import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  export type Appearance = 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
4
4
  export type Spacing = 'compact' | 'default' | 'none';
5
5
  type Combine<First, Second> = Omit<First, keyof Second> & Second;
@@ -41,15 +41,15 @@ export type BaseOwnProps = {
41
41
  */
42
42
  isSelected?: boolean;
43
43
  /**
44
- * Handler to be called on blur.
44
+ * Handler called on blur.
45
45
  */
46
46
  onBlur?: React.FocusEventHandler<HTMLElement>;
47
47
  /**
48
- * Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details.
48
+ * Handler called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details.
49
49
  */
50
50
  onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
51
51
  /**
52
- * Handler to be called on focus.
52
+ * Handler called on focus.
53
53
  */
54
54
  onFocus?: React.FocusEventHandler<HTMLElement>;
55
55
  /**
@@ -41,12 +41,12 @@ declare const LinkButtonRender: React.ForwardRefExoticComponent<Omit<LinkButtonP
41
41
  href?: string | undefined;
42
42
  } & React.RefAttributes<HTMLAnchorElement>>;
43
43
  declare const IconButtonRender: React.ForwardRefExoticComponent<Omit<IconButtonProps, "label" | "icon"> & {
44
- icon?: import("../new-button/variants/types").IconProp | undefined;
44
+ icon?: React.ComponentType<import("@atlaskit/icon").IconProps | import("@atlaskit/icon").UNSAFE_NewIconProps> | undefined;
45
45
  label?: IconButtonProps['label'];
46
46
  } & React.RefAttributes<HTMLButtonElement>>;
47
47
  declare const LinkIconButtonRender: React.ForwardRefExoticComponent<Omit<LinkIconButtonProps, "label" | "href" | "icon"> & {
48
48
  href?: string | undefined;
49
- icon?: import("../new-button/variants/types").IconProp | undefined;
49
+ icon?: React.ComponentType<import("@atlaskit/icon").IconProps | import("@atlaskit/icon").UNSAFE_NewIconProps> | undefined;
50
50
  label?: LinkIconButtonProps['label'];
51
51
  } & React.RefAttributes<HTMLAnchorElement>>;
52
52
  declare const variants: Variant[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "17.14.2",
3
+ "version": "17.15.0",
4
4
  "description": "A button triggers an event or action. They let users know what will happen next.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -70,7 +70,8 @@
70
70
  "sortKey": 5
71
71
  }
72
72
  ]
73
- }
73
+ },
74
+ "runReact18": true
74
75
  },
75
76
  "af:exports": {
76
77
  "./button-group": "./src/entry-points/button-group.tsx",
@@ -85,19 +86,19 @@
85
86
  "@atlaskit/analytics-next": "^9.3.0",
86
87
  "@atlaskit/ds-lib": "^2.3.0",
87
88
  "@atlaskit/focus-ring": "^1.4.0",
88
- "@atlaskit/icon": "^22.1.0",
89
+ "@atlaskit/icon": "^22.3.0",
89
90
  "@atlaskit/interaction-context": "^2.1.0",
90
- "@atlaskit/primitives": "^6.0.0",
91
+ "@atlaskit/primitives": "^6.3.0",
91
92
  "@atlaskit/spinner": "^16.1.0",
92
- "@atlaskit/theme": "^12.7.0",
93
- "@atlaskit/tokens": "^1.45.0",
94
- "@atlaskit/tooltip": "^18.3.0",
93
+ "@atlaskit/theme": "^12.8.0",
94
+ "@atlaskit/tokens": "^1.49.0",
95
+ "@atlaskit/tooltip": "^18.4.0",
95
96
  "@atlaskit/visually-hidden": "^1.3.0",
96
97
  "@babel/runtime": "^7.0.0",
97
98
  "@emotion/react": "^11.7.1"
98
99
  },
99
100
  "peerDependencies": {
100
- "react": "^16.8.0"
101
+ "react": "^16.8.0 || ^17.0.0 || ~18.2.0"
101
102
  },
102
103
  "devDependencies": {
103
104
  "@af/accessibility-testing": "*",
@@ -107,7 +108,7 @@
107
108
  "@atlaskit/calendar": "^14.2.0",
108
109
  "@atlaskit/checkbox": "^13.3.0",
109
110
  "@atlaskit/ssr": "*",
110
- "@atlaskit/toggle": "^13.0.0",
111
+ "@atlaskit/toggle": "^13.1.0",
111
112
  "@atlaskit/visual-regression": "*",
112
113
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
113
114
  "@testing-library/react": "^12.1.5",