@atlaskit/button 16.13.0 → 16.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.
Files changed (26) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/index.js +55 -0
  3. package/dist/cjs/new-button/variants/shared/use-button-base.js +1 -1
  4. package/dist/cjs/old-button/shared/button-base.js +1 -1
  5. package/dist/es2019/index.js +9 -1
  6. package/dist/es2019/new-button/variants/shared/use-button-base.js +1 -1
  7. package/dist/es2019/old-button/shared/button-base.js +1 -1
  8. package/dist/esm/index.js +9 -1
  9. package/dist/esm/new-button/variants/shared/use-button-base.js +1 -1
  10. package/dist/esm/old-button/shared/button-base.js +1 -1
  11. package/dist/types/index.d.ts +6 -0
  12. package/dist/types/new-button/variants/default/link.d.ts +1 -3
  13. package/dist/types/new-button/variants/icon/link.d.ts +1 -3
  14. package/dist/types/new-button/variants/types.d.ts +23 -11
  15. package/dist/types-ts4.5/index.d.ts +6 -0
  16. package/dist/types-ts4.5/new-button/variants/default/link.d.ts +1 -3
  17. package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -3
  18. package/dist/types-ts4.5/new-button/variants/types.d.ts +23 -11
  19. package/extract-react-types/legacy-button/custom-theme-button-props.tsx +7 -0
  20. package/extract-react-types/legacy-button/loading-button-props.tsx +5 -0
  21. package/extract-react-types/legacy-button/shared-props.tsx +5 -0
  22. package/extract-react-types/new-button/variants/default/button-props.tsx +5 -0
  23. package/extract-react-types/new-button/variants/default/common-props.tsx +11 -0
  24. package/extract-react-types/new-button/variants/default/link-button-props.tsx +5 -0
  25. package/package.json +3 -3
  26. package/tmp/api-report-tmp.d.ts +0 -133
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/button
2
2
 
3
+ ## 16.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#42950](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42950) [`9691abc55ce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9691abc55ce) - Restructure new Button (in Alpha) types for documentation purposes
8
+
9
+ ## 16.14.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#42928](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42928) [`f858870ae90`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f858870ae90) - Added new Button variants (in Alpha) unsafe exports to root entrypoint for documentation purposes
14
+
3
15
  ## 16.13.0
4
16
 
5
17
  ### Minor Changes
package/dist/cjs/index.js CHANGED
@@ -29,6 +29,60 @@ Object.defineProperty(exports, "Theme", {
29
29
  return _customThemeButton.Theme;
30
30
  }
31
31
  });
32
+ Object.defineProperty(exports, "UNSAFE_BUTTON", {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _unsafe.UNSAFE_BUTTON;
36
+ }
37
+ });
38
+ Object.defineProperty(exports, "UNSAFE_DIVIDER", {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _unsafe.UNSAFE_DIVIDER;
42
+ }
43
+ });
44
+ Object.defineProperty(exports, "UNSAFE_GET_ACTIONS", {
45
+ enumerable: true,
46
+ get: function get() {
47
+ return _unsafe.UNSAFE_GET_ACTIONS;
48
+ }
49
+ });
50
+ Object.defineProperty(exports, "UNSAFE_ICON_BUTTON", {
51
+ enumerable: true,
52
+ get: function get() {
53
+ return _unsafe.UNSAFE_ICON_BUTTON;
54
+ }
55
+ });
56
+ Object.defineProperty(exports, "UNSAFE_LINK_BUTTON", {
57
+ enumerable: true,
58
+ get: function get() {
59
+ return _unsafe.UNSAFE_LINK_BUTTON;
60
+ }
61
+ });
62
+ Object.defineProperty(exports, "UNSAFE_LINK_ICON_BUTTON", {
63
+ enumerable: true,
64
+ get: function get() {
65
+ return _unsafe.UNSAFE_LINK_ICON_BUTTON;
66
+ }
67
+ });
68
+ Object.defineProperty(exports, "UNSAFE_SPLIT_BUTTON", {
69
+ enumerable: true,
70
+ get: function get() {
71
+ return _unsafe.UNSAFE_SPLIT_BUTTON;
72
+ }
73
+ });
74
+ Object.defineProperty(exports, "UNSAFE_SPLIT_BUTTON_CONTAINER", {
75
+ enumerable: true,
76
+ get: function get() {
77
+ return _unsafe.UNSAFE_SPLIT_BUTTON_CONTAINER;
78
+ }
79
+ });
80
+ Object.defineProperty(exports, "UNSAFE_SPLIT_BUTTON_CONTEXT", {
81
+ enumerable: true,
82
+ get: function get() {
83
+ return _unsafe.UNSAFE_SPLIT_BUTTON_CONTEXT;
84
+ }
85
+ });
32
86
  Object.defineProperty(exports, "default", {
33
87
  enumerable: true,
34
88
  get: function get() {
@@ -39,5 +93,6 @@ var _standardButton = _interopRequireDefault(require("./entry-points/standard-bu
39
93
  var _loadingButton = _interopRequireDefault(require("./entry-points/loading-button"));
40
94
  var _customThemeButton = _interopRequireWildcard(require("./entry-points/custom-theme-button"));
41
95
  var _buttonGroup = _interopRequireDefault(require("./entry-points/button-group"));
96
+ var _unsafe = require("./entry-points/unsafe");
42
97
  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); }
43
98
  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; }
@@ -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.13.0",
118
+ packageVersion: "16.15.0",
119
119
  analyticsData: analyticsContext,
120
120
  actionSubject: buttonType
121
121
  });
@@ -118,7 +118,7 @@ var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(function
118
118
  action: 'clicked',
119
119
  componentName: 'button',
120
120
  packageName: "@atlaskit/button",
121
- packageVersion: "16.13.0",
121
+ packageVersion: "16.15.0",
122
122
  analyticsData: analyticsContext
123
123
  });
124
124
 
@@ -5,4 +5,12 @@ export {
5
5
  default } from './entry-points/standard-button';
6
6
  export { default as LoadingButton } from './entry-points/loading-button';
7
7
  export { default as CustomThemeButton, Theme } from './entry-points/custom-theme-button';
8
- export { default as ButtonGroup } from './entry-points/button-group';
8
+ export { default as ButtonGroup } from './entry-points/button-group';
9
+
10
+ // New Button
11
+ export { UNSAFE_BUTTON } from './entry-points/unsafe';
12
+ export { UNSAFE_LINK_BUTTON } from './entry-points/unsafe';
13
+ export { UNSAFE_ICON_BUTTON } from './entry-points/unsafe';
14
+ export { UNSAFE_LINK_ICON_BUTTON } from './entry-points/unsafe';
15
+ export { UNSAFE_SPLIT_BUTTON, UNSAFE_SPLIT_BUTTON_CONTAINER, UNSAFE_DIVIDER, UNSAFE_GET_ACTIONS } from './entry-points/unsafe';
16
+ export { UNSAFE_SPLIT_BUTTON_CONTEXT } from './entry-points/unsafe';
@@ -97,7 +97,7 @@ const useButtonBase = ({
97
97
  action: 'clicked',
98
98
  componentName: 'button',
99
99
  packageName: "@atlaskit/button",
100
- packageVersion: "16.13.0",
100
+ packageVersion: "16.15.0",
101
101
  analyticsData: analyticsContext,
102
102
  actionSubject: buttonType
103
103
  });
@@ -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.13.0",
106
+ packageVersion: "16.15.0",
107
107
  analyticsData: analyticsContext
108
108
  });
109
109
 
package/dist/esm/index.js CHANGED
@@ -5,4 +5,12 @@ export {
5
5
  default } from './entry-points/standard-button';
6
6
  export { default as LoadingButton } from './entry-points/loading-button';
7
7
  export { default as CustomThemeButton, Theme } from './entry-points/custom-theme-button';
8
- export { default as ButtonGroup } from './entry-points/button-group';
8
+ export { default as ButtonGroup } from './entry-points/button-group';
9
+
10
+ // New Button
11
+ export { UNSAFE_BUTTON } from './entry-points/unsafe';
12
+ export { UNSAFE_LINK_BUTTON } from './entry-points/unsafe';
13
+ export { UNSAFE_ICON_BUTTON } from './entry-points/unsafe';
14
+ export { UNSAFE_LINK_ICON_BUTTON } from './entry-points/unsafe';
15
+ export { UNSAFE_SPLIT_BUTTON, UNSAFE_SPLIT_BUTTON_CONTAINER, UNSAFE_DIVIDER, UNSAFE_GET_ACTIONS } from './entry-points/unsafe';
16
+ export { UNSAFE_SPLIT_BUTTON_CONTEXT } from './entry-points/unsafe';
@@ -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.13.0",
110
+ packageVersion: "16.15.0",
111
111
  analyticsData: analyticsContext,
112
112
  actionSubject: buttonType
113
113
  });
@@ -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.13.0",
112
+ packageVersion: "16.15.0",
113
113
  analyticsData: analyticsContext
114
114
  });
115
115
 
@@ -6,3 +6,9 @@ export type { LoadingButtonProps, LoadingButtonOwnProps, } from './entry-points/
6
6
  export { default as CustomThemeButton, Theme, } from './entry-points/custom-theme-button';
7
7
  export type { ThemeTokens, ThemeProps, InteractionState, CustomThemeButtonProps, CustomThemeButtonOwnProps, } from './entry-points/custom-theme-button';
8
8
  export { default as ButtonGroup } from './entry-points/button-group';
9
+ export { UNSAFE_BUTTON } from './entry-points/unsafe';
10
+ export { UNSAFE_LINK_BUTTON } from './entry-points/unsafe';
11
+ export { UNSAFE_ICON_BUTTON } from './entry-points/unsafe';
12
+ export { UNSAFE_LINK_ICON_BUTTON } from './entry-points/unsafe';
13
+ export { UNSAFE_SPLIT_BUTTON, UNSAFE_SPLIT_BUTTON_CONTAINER, UNSAFE_DIVIDER, UNSAFE_GET_ACTIONS, } from './entry-points/unsafe';
14
+ export { UNSAFE_SPLIT_BUTTON_CONTEXT } from './entry-points/unsafe';
@@ -14,9 +14,7 @@ declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = ne
14
14
  * - [Code](https://atlassian.design/components/button/code)
15
15
  * - [Usage](https://atlassian.design/components/button/usage)
16
16
  */
17
- declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & {
18
- href: string | RouterLinkConfig;
19
- } & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
17
+ declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & import("../types").AdditionalLinkVariantProps<RouterLinkConfig> & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
20
18
  ref?: React.Ref<HTMLAnchorElement> | undefined;
21
19
  }) => ReturnType<typeof LinkButtonBase>;
22
20
  export default LinkButton;
@@ -14,9 +14,7 @@ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any>
14
14
  * - [Code](https://atlassian.design/components/button/code)
15
15
  * - [Usage](https://atlassian.design/components/button/usage)
16
16
  */
17
- declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & {
18
- href: string | RouterLinkConfig;
19
- } & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
17
+ declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & import("../types").AdditionalLinkVariantProps<RouterLinkConfig> & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
20
18
  ref?: React.Ref<HTMLAnchorElement> | undefined;
21
19
  }) => ReturnType<typeof LinkIconButtonBase>;
22
20
  export default LinkIconButton;
@@ -5,7 +5,7 @@ export type Spacing = 'compact' | 'default' | 'none';
5
5
  type Combine<First, Second> = Omit<First, keyof Second> & Second;
6
6
  export type CommonButtonProps<TagName extends HTMLElement> = {
7
7
  /**
8
- * The base styling to apply to the button
8
+ * The button style variation
9
9
  */
10
10
  appearance?: Appearance;
11
11
  /**
@@ -17,11 +17,11 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
17
17
  */
18
18
  overlay?: React.ReactNode;
19
19
  /**
20
- * Set if the button is disabled
20
+ * Disable the button to prevent user interaction
21
21
  */
22
22
  isDisabled?: boolean;
23
23
  /**
24
- * Change the style to indicate the button is selected
24
+ * Indicates that the button is selected
25
25
  */
26
26
  isSelected?: boolean;
27
27
  /**
@@ -37,11 +37,11 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
37
37
  */
38
38
  onFocus?: React.FocusEventHandler<TagName>;
39
39
  /**
40
- * Set the amount of padding in the button
40
+ * Controls the amount of padding in the button
41
41
  */
42
42
  spacing?: Spacing;
43
43
  /**
44
- * Text content to be rendered in the button
44
+ * Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
45
45
  */
46
46
  children: React.ReactNode;
47
47
  /**
@@ -49,8 +49,8 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
49
49
  */
50
50
  testId?: string;
51
51
  /**
52
- * An optional name used to identify this component to press listeners. E.g. interaction tracing
53
- * @see https://hello.atlassian.net/wiki/spaces/UFO/pages/2010358949/UFO+Integration+into+Design+System+components
52
+ * An optional name used to identify this component to press listeners. For example, interaction tracing. For more information,
53
+ * see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration)
54
54
  */
55
55
  interactionName?: string;
56
56
  /**
@@ -58,10 +58,15 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
58
58
  */
59
59
  analyticsContext?: Record<string, any>;
60
60
  };
61
+ export type SupportedElements = HTMLButtonElement | HTMLAnchorElement;
61
62
  type SupportedElementAttributes = React.ButtonHTMLAttributes<HTMLButtonElement> | React.AnchorHTMLAttributes<HTMLAnchorElement>;
62
63
  export type AdditionalHTMLElementPropsExtender<Props extends SupportedElementAttributes> = Combine<Omit<Props, 'className' | 'style' | 'role' | 'disabled'>, {
63
64
  'data-testid'?: never;
64
65
  }>;
66
+ /**
67
+ * Common additional props for button `<button>` variants
68
+ */
69
+ export type AdditionalButtonVariantProps = {};
65
70
  /**
66
71
  * Combines common button props with additional HTML attributes.
67
72
  */
@@ -69,11 +74,18 @@ export type CombinedButtonProps<TagName extends HTMLElement, HTMLAttributes exte
69
74
  /**
70
75
  * Common props for Button `<button>` variants
71
76
  */
72
- export type CommonButtonVariantProps = CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
77
+ export type CommonButtonVariantProps = AdditionalButtonVariantProps & CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
73
78
  /**
74
- * Common props for Link `<a>` Button variants
79
+ * Common additional props for Link `<a>` Button variants
75
80
  */
76
- export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
81
+ export type AdditionalLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
82
+ /**
83
+ * Provides a URL for link buttons. When using an AppProvider with a configured router link component, a `RouterLinkConfig` object type can be provided for advanced usage. See the [Link Button routing example](https://atlassian.design/components/button/button-new/examples#routing) for more details.
84
+ */
77
85
  href: string | RouterLinkConfig;
78
- } & CombinedButtonProps<HTMLAnchorElement, AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>>>;
86
+ };
87
+ /**
88
+ * Common props for Link `<a>` Button variants
89
+ */
90
+ export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = AdditionalLinkVariantProps<RouterLinkConfig> & CombinedButtonProps<HTMLAnchorElement, AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>>>;
79
91
  export {};
@@ -6,3 +6,9 @@ export type { LoadingButtonProps, LoadingButtonOwnProps, } from './entry-points/
6
6
  export { default as CustomThemeButton, Theme, } from './entry-points/custom-theme-button';
7
7
  export type { ThemeTokens, ThemeProps, InteractionState, CustomThemeButtonProps, CustomThemeButtonOwnProps, } from './entry-points/custom-theme-button';
8
8
  export { default as ButtonGroup } from './entry-points/button-group';
9
+ export { UNSAFE_BUTTON } from './entry-points/unsafe';
10
+ export { UNSAFE_LINK_BUTTON } from './entry-points/unsafe';
11
+ export { UNSAFE_ICON_BUTTON } from './entry-points/unsafe';
12
+ export { UNSAFE_LINK_ICON_BUTTON } from './entry-points/unsafe';
13
+ export { UNSAFE_SPLIT_BUTTON, UNSAFE_SPLIT_BUTTON_CONTAINER, UNSAFE_DIVIDER, UNSAFE_GET_ACTIONS, } from './entry-points/unsafe';
14
+ export { UNSAFE_SPLIT_BUTTON_CONTEXT } from './entry-points/unsafe';
@@ -14,9 +14,7 @@ declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = ne
14
14
  * - [Code](https://atlassian.design/components/button/code)
15
15
  * - [Usage](https://atlassian.design/components/button/usage)
16
16
  */
17
- declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & {
18
- href: string | RouterLinkConfig;
19
- } & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
17
+ declare const LinkButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonDefaultButtonProps & import("../types").AdditionalLinkVariantProps<RouterLinkConfig> & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
20
18
  ref?: React.Ref<HTMLAnchorElement> | undefined;
21
19
  }) => ReturnType<typeof LinkButtonBase>;
22
20
  export default LinkButton;
@@ -14,9 +14,7 @@ declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any>
14
14
  * - [Code](https://atlassian.design/components/button/code)
15
15
  * - [Usage](https://atlassian.design/components/button/usage)
16
16
  */
17
- declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & {
18
- href: string | RouterLinkConfig;
19
- } & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
17
+ declare const LinkIconButton: <RouterLinkConfig extends Record<string, any> = never>(props: CommonIconButtonProps & import("../types").AdditionalLinkVariantProps<RouterLinkConfig> & Omit<import("../types").AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">>, keyof import("../types").CommonButtonProps<TagName>> & import("../types").CommonButtonProps<HTMLAnchorElement> & {
20
18
  ref?: React.Ref<HTMLAnchorElement> | undefined;
21
19
  }) => ReturnType<typeof LinkIconButtonBase>;
22
20
  export default LinkIconButton;
@@ -5,7 +5,7 @@ export type Spacing = 'compact' | 'default' | 'none';
5
5
  type Combine<First, Second> = Omit<First, keyof Second> & Second;
6
6
  export type CommonButtonProps<TagName extends HTMLElement> = {
7
7
  /**
8
- * The base styling to apply to the button
8
+ * The button style variation
9
9
  */
10
10
  appearance?: Appearance;
11
11
  /**
@@ -17,11 +17,11 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
17
17
  */
18
18
  overlay?: React.ReactNode;
19
19
  /**
20
- * Set if the button is disabled
20
+ * Disable the button to prevent user interaction
21
21
  */
22
22
  isDisabled?: boolean;
23
23
  /**
24
- * Change the style to indicate the button is selected
24
+ * Indicates that the button is selected
25
25
  */
26
26
  isSelected?: boolean;
27
27
  /**
@@ -37,11 +37,11 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
37
37
  */
38
38
  onFocus?: React.FocusEventHandler<TagName>;
39
39
  /**
40
- * Set the amount of padding in the button
40
+ * Controls the amount of padding in the button
41
41
  */
42
42
  spacing?: Spacing;
43
43
  /**
44
- * Text content to be rendered in the button
44
+ * Text content to be rendered in the button. Required so that screen readers always have an accessible label provided for the button.
45
45
  */
46
46
  children: React.ReactNode;
47
47
  /**
@@ -49,8 +49,8 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
49
49
  */
50
50
  testId?: string;
51
51
  /**
52
- * An optional name used to identify this component to press listeners. E.g. interaction tracing
53
- * @see https://hello.atlassian.net/wiki/spaces/UFO/pages/2010358949/UFO+Integration+into+Design+System+components
52
+ * An optional name used to identify this component to press listeners. For example, interaction tracing. For more information,
53
+ * see [UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration)
54
54
  */
55
55
  interactionName?: string;
56
56
  /**
@@ -58,10 +58,15 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
58
58
  */
59
59
  analyticsContext?: Record<string, any>;
60
60
  };
61
+ export type SupportedElements = HTMLButtonElement | HTMLAnchorElement;
61
62
  type SupportedElementAttributes = React.ButtonHTMLAttributes<HTMLButtonElement> | React.AnchorHTMLAttributes<HTMLAnchorElement>;
62
63
  export type AdditionalHTMLElementPropsExtender<Props extends SupportedElementAttributes> = Combine<Omit<Props, 'className' | 'style' | 'role' | 'disabled'>, {
63
64
  'data-testid'?: never;
64
65
  }>;
66
+ /**
67
+ * Common additional props for button `<button>` variants
68
+ */
69
+ export type AdditionalButtonVariantProps = {};
65
70
  /**
66
71
  * Combines common button props with additional HTML attributes.
67
72
  */
@@ -69,11 +74,18 @@ export type CombinedButtonProps<TagName extends HTMLElement, HTMLAttributes exte
69
74
  /**
70
75
  * Common props for Button `<button>` variants
71
76
  */
72
- export type CommonButtonVariantProps = CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
77
+ export type CommonButtonVariantProps = AdditionalButtonVariantProps & CombinedButtonProps<HTMLButtonElement, AdditionalHTMLElementPropsExtender<React.ButtonHTMLAttributes<HTMLButtonElement>>>;
73
78
  /**
74
- * Common props for Link `<a>` Button variants
79
+ * Common additional props for Link `<a>` Button variants
75
80
  */
76
- export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
81
+ export type AdditionalLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = {
82
+ /**
83
+ * Provides a URL for link buttons. When using an AppProvider with a configured router link component, a `RouterLinkConfig` object type can be provided for advanced usage. See the [Link Button routing example](https://atlassian.design/components/button/button-new/examples#routing) for more details.
84
+ */
77
85
  href: string | RouterLinkConfig;
78
- } & CombinedButtonProps<HTMLAnchorElement, AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>>>;
86
+ };
87
+ /**
88
+ * Common props for Link `<a>` Button variants
89
+ */
90
+ export type CommonLinkVariantProps<RouterLinkConfig extends Record<string, any> = never> = AdditionalLinkVariantProps<RouterLinkConfig> & CombinedButtonProps<HTMLAnchorElement, AdditionalHTMLElementPropsExtender<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>>>;
79
91
  export {};
@@ -0,0 +1,7 @@
1
+ import { CustomThemeButtonOwnProps } from '../../src/old-button/custom-theme-button/custom-theme-button-types';
2
+
3
+ export default function CustomThemeButtonProps(
4
+ props: CustomThemeButtonOwnProps,
5
+ ) {
6
+ return null;
7
+ }
@@ -0,0 +1,5 @@
1
+ import { LoadingButtonOwnProps } from '../../src/old-button/loading-button';
2
+
3
+ export default function LoadingButtonProps(props: LoadingButtonOwnProps) {
4
+ return null;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { BaseOwnProps } from '../../src/old-button/types';
2
+
3
+ export default function SharedProps(props: BaseOwnProps) {
4
+ return null;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { AdditionalButtonVariantProps } from '../../../../src/new-button/variants/types';
2
+
3
+ export default function ButtonProps(props: AdditionalButtonVariantProps) {
4
+ return null;
5
+ }
@@ -0,0 +1,11 @@
1
+ import { type CommonDefaultButtonProps } from '../../../../src/new-button/variants/default/types';
2
+ import {
3
+ type CommonButtonProps,
4
+ type SupportedElements,
5
+ } from '../../../../src/new-button/variants/types';
6
+
7
+ export default function CommonProps(
8
+ props: CommonButtonProps<SupportedElements> & CommonDefaultButtonProps,
9
+ ) {
10
+ return null;
11
+ }
@@ -0,0 +1,5 @@
1
+ import { AdditionalLinkVariantProps } from '../../../../src/new-button/variants/types';
2
+
3
+ export default function LinkButtonProps(props: AdditionalLinkVariantProps) {
4
+ return null;
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.13.0",
3
+ "version": "16.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/"
@@ -33,7 +33,7 @@
33
33
  "title": "Button (new)",
34
34
  "id": "button-new",
35
35
  "status": {
36
- "type": "draft"
36
+ "type": "alpha"
37
37
  },
38
38
  "sortKey": 1
39
39
  },
@@ -81,7 +81,7 @@
81
81
  "@atlaskit/focus-ring": "^1.3.0",
82
82
  "@atlaskit/interaction-context": "^2.1.0",
83
83
  "@atlaskit/platform-feature-flags": "^0.2.0",
84
- "@atlaskit/primitives": "^1.9.0",
84
+ "@atlaskit/primitives": "^1.10.0",
85
85
  "@atlaskit/spinner": "^15.6.0",
86
86
  "@atlaskit/theme": "^12.6.0",
87
87
  "@atlaskit/tokens": "^1.28.0",
@@ -1,133 +0,0 @@
1
- ## API Report File for "@atlaskit/button"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- /// <reference types="react" />
8
-
9
- import { ComponentType } from 'react';
10
- import { CSSObject } from '@emotion/react';
11
- import { jsx } from '@emotion/react';
12
- import { default as React_2 } from 'react';
13
- import { ReactNode } from 'react';
14
- import { ThemeModes } from '@atlaskit/theme/types';
15
- import { ThemeModes as ThemeModes_2 } from '@atlaskit/theme';
16
- import { ThemeProp } from '@atlaskit/theme/components';
17
- import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
18
-
19
- // @public (undocumented)
20
- export type Appearance = 'danger' | 'default' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
21
-
22
- // @public (undocumented)
23
- export type BaseOwnProps = {
24
- appearance?: Appearance;
25
- autoFocus?: boolean;
26
- className?: string;
27
- overlay?: React_2.ReactNode;
28
- href?: string;
29
- iconAfter?: React_2.ReactChild;
30
- iconBefore?: React_2.ReactChild;
31
- isDisabled?: boolean;
32
- isSelected?: boolean;
33
- onBlur?: React_2.FocusEventHandler<HTMLElement>;
34
- onClick?: (e: React_2.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
35
- onFocus?: React_2.FocusEventHandler<HTMLElement>;
36
- spacing?: Spacing;
37
- target?: React_2.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
38
- type?: React_2.ButtonHTMLAttributes<HTMLButtonElement>['type'];
39
- shouldFitContainer?: boolean;
40
- children?: React_2.ReactNode;
41
- testId?: string;
42
- component?: React_2.ComponentType<React_2.AllHTMLAttributes<HTMLElement>> | React_2.ElementType;
43
- interactionName?: string;
44
- analyticsContext?: Record<string, any>;
45
- };
46
-
47
- // @public (undocumented)
48
- export type BaseProps = Combine<Combine<Omit<React_2.AllHTMLAttributes<HTMLElement>, 'disabled'>, {
49
- 'data-testid'?: never;
50
- 'data-has-overlay'?: never;
51
- }>, BaseOwnProps>;
52
-
53
- // @public
54
- const Button: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<HTMLElement>>>;
55
- export default Button;
56
-
57
- // @public (undocumented)
58
- export function ButtonGroup({ appearance, children, }: ButtonGroupProps): jsx.JSX.Element;
59
-
60
- // @public (undocumented)
61
- type ButtonGroupProps = {
62
- appearance?: Appearance;
63
- children?: React_2.ReactNode;
64
- };
65
-
66
- // @public (undocumented)
67
- export interface ButtonProps extends BaseProps {
68
- }
69
-
70
- // @public (undocumented)
71
- type Combine<First, Second> = Omit<First, keyof Second> & Second;
72
-
73
- // @public
74
- export const CustomThemeButton: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<Omit<BaseProps, "overlay"> & CustomThemeButtonOwnProps & React_2.RefAttributes<HTMLElement>>>;
75
-
76
- // @public (undocumented)
77
- export type CustomThemeButtonOwnProps = {
78
- isLoading?: boolean;
79
- theme?: (current: (props: ThemeProps) => ThemeTokens, props: ThemeProps) => ThemeTokens;
80
- };
81
-
82
- // @public (undocumented)
83
- export type CustomThemeButtonProps = Omit<BaseProps, 'overlay'> & CustomThemeButtonOwnProps;
84
-
85
- // @public (undocumented)
86
- export type InteractionState = 'active' | 'default' | 'disabled' | 'focus' | 'focusSelected' | 'hover' | 'selected';
87
-
88
- // @public
89
- export const LoadingButton: React_2.ForwardRefExoticComponent<Omit<BaseProps, "overlay"> & LoadingButtonOwnProps & React_2.RefAttributes<HTMLElement>>;
90
-
91
- // @public (undocumented)
92
- export type LoadingButtonOwnProps = {
93
- isLoading?: boolean;
94
- };
95
-
96
- // @public (undocumented)
97
- export type LoadingButtonProps = Omit<BaseProps, 'overlay'> & LoadingButtonOwnProps;
98
-
99
- // @public (undocumented)
100
- export type Spacing = 'compact' | 'default' | 'none';
101
-
102
- // @public (undocumented)
103
- export const Theme: {
104
- Consumer: ComponentType< {
105
- children: (tokens: ThemeTokens) => ReactNode;
106
- } & Partial<CustomThemeButtonProps> & {
107
- state: InteractionState;
108
- iconIsOnlyChild?: boolean | undefined;
109
- mode?: ThemeModes_2 | undefined;
110
- }>;
111
- Provider: ComponentType< {
112
- children?: ReactNode;
113
- value?: ThemeProp<ThemeTokens, ThemeProps> | undefined;
114
- }>;
115
- useTheme: (props: ThemeProps) => ThemeTokens;
116
- };
117
-
118
- // @public (undocumented)
119
- export type ThemeProps = Partial<CustomThemeButtonProps> & {
120
- state: InteractionState;
121
- iconIsOnlyChild?: boolean;
122
- mode?: ThemeModes;
123
- };
124
-
125
- // @public (undocumented)
126
- export type ThemeTokens = {
127
- buttonStyles: CSSObject;
128
- spinnerStyles: CSSObject;
129
- };
130
-
131
- // (No @packageDocumentation comment for this package)
132
-
133
- ```